Unify authentication error messages to prevent username enumeration#1085
Unify authentication error messages to prevent username enumeration#108515921483570 wants to merge 3 commits intohydro-dev:masterfrom
Conversation
WalkthroughThe PR standardizes authentication failure messaging: Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/hydrooj/locales/zh.yaml(1 hunks)packages/hydrooj/src/error.ts(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/hydrooj/src/error.ts (1)
framework/framework/error.ts (2)
ForbiddenError(50-50)NotFoundError(51-51)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Analyze (javascript)
- GitHub Check: build
🔇 Additional comments (2)
packages/hydrooj/locales/zh.yaml (1)
428-428: LGTM! Translation is accurate.The Chinese translation "用户名或密码错误。" correctly conveys "Invalid username or password." and aligns with the security improvements in the error handling code.
packages/hydrooj/src/error.ts (1)
15-15: LGTM! Good security improvement.The generic error message "Invalid username or password." prevents information leakage about valid usernames and aligns with the PR's security objectives.
|
If users password is strong enough, it makes non-sense to brute-force password. Doing this only annoys those who actually have variants of usernames used on different platforms (and they might forget their username if not active for a period) If you want better security, either update the password rule, or setup 2fa instead. |
packages/hydrooj/src/error.ts:
用户名以及密码错误均使用“用户名或密码错误”,防止用户名被枚举+密码爆破导致后台被控制。
packages/hydrooj/locales/zh.yaml:
增加翻译:
Invalid username or password.: 用户名或密码错误。
Summary by CodeRabbit