fix: TOTP の認証失敗で 500 Internal Server Error が返ってくる#17536
Open
nekochanfood wants to merge 5 commits into
Open
Conversation
パスワード・TOTP検証エラーをINVALID_CREDENTIALに統合し、 どちらが間違っているか判別できないようにした Closes misskey-dev#17522
apiWithDialogが既にエラーダイアログを表示するため、 冗長な.catch()を削除
TOTP有効時のみINVALID_CREDENTIALに統合し、 パスワード単体認証時はINCORRECT_PASSWORDを返す
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #17536 +/- ##
===========================================
- Coverage 24.93% 24.92% -0.01%
===========================================
Files 1158 1160 +2
Lines 39539 39608 +69
Branches 11011 11037 +26
===========================================
+ Hits 9858 9872 +14
- Misses 23780 23817 +37
- Partials 5901 5919 +18 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
|
このPRによるapi.jsonの差分 差分はこちら--- base
+++ head
@@ -53573,6 +53573,24 @@
"$ref": "#/components/schemas/Error"
},
"examples": {
+ "2FA_SETUP_NOT_INITIATED": {
+ "value": {
+ "error": {
+ "message": "2fa setup has not been initiated.",
+ "code": "2FA_SETUP_NOT_INITIATED",
+ "id": "283f18c1-5b84-4699-a7a4-2beec808b74c"
+ }
+ }
+ },
+ "VERIFICATION_FAILED": {
+ "value": {
+ "error": {
+ "message": "Verification failed. Please try again.",
+ "code": "VERIFICATION_FAILED",
+ "id": "90a0971b-f73a-4993-b224-8307ba7421e7"
+ }
+ }
+ },
"INVALID_PARAM": {
"value": {
"error": {
@@ -53761,6 +53779,15 @@
}
}
},
+ "INVALID_CREDENTIAL": {
+ "value": {
+ "error": {
+ "message": "Invalid credential.",
+ "code": "INVALID_CREDENTIAL",
+ "id": "430da61f-f346-411b-8aa0-fdeb0736dbe4"
+ }
+ }
+ },
"TWO_FACTOR_NOT_ENABLED": {
"value": {
"error": {
@@ -54113,6 +54140,15 @@
}
}
},
+ "INVALID_CREDENTIAL": {
+ "value": {
+ "error": {
+ "message": "Invalid credential.",
+ "code": "INVALID_CREDENTIAL",
+ "id": "4ccb213e-227e-4c18-8ddb-f2dddb31a9d0"
+ }
+ }
+ },
"INVALID_PARAM": {
"value": {
"error": {
@@ -54288,6 +54324,15 @@
}
}
},
+ "INVALID_CREDENTIAL": {
+ "value": {
+ "error": {
+ "message": "Invalid credential.",
+ "code": "INVALID_CREDENTIAL",
+ "id": "a1189f08-e4a2-462e-b5de-647c312efadb"
+ }
+ }
+ },
"TWO_FACTOR_NOT_ENABLED": {
"value": {
"error": {
@@ -54460,6 +54505,15 @@
}
}
},
+ "INVALID_CREDENTIAL": {
+ "value": {
+ "error": {
+ "message": "Invalid credential.",
+ "code": "INVALID_CREDENTIAL",
+ "id": "c1c5fa72-f66a-4935-b36a-cb8259e4b03e"
+ }
+ }
+ },
"INVALID_PARAM": {
"value": {
"error": {
@@ -54619,6 +54673,15 @@
}
}
},
+ "INVALID_CREDENTIAL": {
+ "value": {
+ "error": {
+ "message": "Invalid credential.",
+ "code": "INVALID_CREDENTIAL",
+ "id": "5ce7354e-d1d0-4305-b37c-9825b766f03f"
+ }
+ }
+ },
"INVALID_PARAM": {
"value": {
"error": {
@@ -55337,6 +55400,24 @@
"$ref": "#/components/schemas/Error"
},
"examples": {
+ "INCORRECT_PASSWORD": {
+ "value": {
+ "error": {
+ "message": "Incorrect password.",
+ "code": "INCORRECT_PASSWORD",
+ "id": "d46ffe5c-200b-4471-aca2-4d0ef197368f"
+ }
+ }
+ },
+ "INVALID_CREDENTIAL": {
+ "value": {
+ "error": {
+ "message": "Invalid credential.",
+ "code": "INVALID_CREDENTIAL",
+ "id": "1e5d4005-3eb0-43f8-b466-87ad864b9fd6"
+ }
+ }
+ },
"INVALID_PARAM": {
"value": {
"error": {
@@ -55711,6 +55792,24 @@
"$ref": "#/components/schemas/Error"
},
"examples": {
+ "INCORRECT_PASSWORD": {
+ "value": {
+ "error": {
+ "message": "Incorrect password.",
+ "code": "INCORRECT_PASSWORD",
+ "id": "9d72604c-9d55-4511-9b96-de11900925c7"
+ }
+ }
+ },
+ "INVALID_CREDENTIAL": {
+ "value": {
+ "error": {
+ "message": "Invalid credential.",
+ "code": "INVALID_CREDENTIAL",
+ "id": "d5af1163-2248-404f-a3d9-7b8c9e019723"
+ }
+ }
+ },
"INVALID_PARAM": {
"value": {
"error": {
@@ -63518,6 +63617,15 @@
}
}
},
+ "INVALID_CREDENTIAL": {
+ "value": {
+ "error": {
+ "message": "Invalid credential.",
+ "code": "INVALID_CREDENTIAL",
+ "id": "b8231819-bd85-4c24-83f1-657a3e0efad8"
+ }
+ }
+ },
"UNAVAILABLE": {
"value": {
"error": { |
Contributor
Backend memory usage comparisonBefore GC
After GC
After Request
|
Contributor
Author
|
パスキー追加後(i/2fa/key-done)に求められる認証ではパスワードないしはTOTPが間違っていても通るようになっている 🤔 追記: Issue に書いた #17537 |
Contributor
Author
|
失敗系のエラーのコードを400から401にしようと思います |
Member
|
https://datatracker.ietf.org/doc/html/rfc9110#name-401-unauthorized
適切な WWW-Authenticate がないと思うので 401 は微妙かも |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Backend
TOTP認証失敗時に500エラーが返される問題を修正し、適切なAPIエラーを返すようになります。
また、パスワードとTOTPでの認証のエラーを統一し、どちらの認証が失敗したかを外部から判別できないようになります。
INVALID_CREDENTIALVERIFICATION_FAILED2FA_SETUP_NOT_INITIATEDi/2fa/doneを呼んだとき用INCORRECT_PASSWORDchange-password,delete-accountに新規追加)Frontend
2FA解除時にエラーオブジェクトがそのままダイアログに渡されていた問題を修正しています。
Why
fix #17522
Additional info (optional)
エラーの確認用リスト:
Checklist