fix(plugin-auth): reduce password rate limit aggressiveness and reset limits on password change#877
Conversation
🦋 Changeset detectedLatest commit: fb38c9a The changes in this PR will be included in the next version bump. This PR includes changesets to release 24 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe PR reduces password rate limiting aggressiveness by updating thresholds to 15 attempts/hour per IP and 10 consecutive failures/hour, introduces rate limit reset functionality after successful password resets, and enhances form validation with custom user-facing error messages across authentication routes and admin UI layouts. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Client
participant AuthAPI
participant RateLimiter
participant PasswordService
User->>Client: 1. Attempt login with incorrect password
Client->>AuthAPI: POST /login (email, password)
AuthAPI->>RateLimiter: Check consecutive-fails limit
RateLimiter-->>AuthAPI: Blocked (10 attempts/hour exceeded)
AuthAPI-->>Client: login-consecutive-fails-blocked error
Client->>User: Display "Too many failed attempts, reset password"
User->>Client: 2. Submit password reset form
Client->>AuthAPI: POST /reset-password (token, newPassword)
AuthAPI->>PasswordService: completePasswordReset(token, newPassword, context)
PasswordService->>RateLimiter: resetLoginRateLimits(email, ip)
RateLimiter->>RateLimiter: Delete rate limit counters
RateLimiter-->>PasswordService: Success
PasswordService-->>AuthAPI: Password reset complete
AuthAPI-->>Client: Success response
User->>Client: 3. Attempt login with new password
Client->>AuthAPI: POST /login (email, newPassword)
AuthAPI->>RateLimiter: Check rate limits (now reset)
RateLimiter-->>AuthAPI: Allowed
AuthAPI-->>Client: Login successful
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Summary
Details
Backend (plugin-auth):
user-password.service.ts: Relaxed rate limit thresholds and added limit reset on password changepassword-reset.service.ts: Added rate limit reset after successful password resetpassword-reset.mutations.ts: Minor schema adjustmentsFrontend (auth routes + admin layout):
Generator templates + examples:
plugin-authandreact-generatorsblog-with-authandtodo-with-better-authexamplesTesting
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Documentation