fix: apply authLimiter to OTP and password reset routes#264
Conversation
|
Warning Review limit reached
More reviews will be available in 47 minutes and 57 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR applies the strict ChangesAuth endpoint rate limiting
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5–10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/dashboard-api/src/routes/auth.js`:
- Around line 43-47: The four routes using authLimiter (router.post('/send-otp',
authLimiter, sendOtp); router.post('/verify-otp', authLimiter, verifyOtp);
router.post('/forgot-password', authLimiter, forgotPassword);
router.post('/reset-password', authLimiter, resetPassword);) are currently
registered after router.use(dashboardLimiter) and thus inherit dashboardLimiter
in addition to authLimiter; move these four router.post registrations up so they
are placed alongside the existing /register and /login routes (before the
router.use(dashboardLimiter) call) so only authLimiter is applied and the
dashboardLimiter state is not unnecessarily tracked for these endpoints.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: bab88a21-50dc-4571-af39-55d4e1e07041
📒 Files selected for processing (1)
apps/dashboard-api/src/routes/auth.js
Summary
This PR applies
authLimiterto OTP and password reset endpoints that were previously protected only bydashboardLimiter.Changes Made
Added
authLimiterto:/send-otp/verify-otp/forgot-password/reset-passwordWhy
These endpoints were inheriting
dashboardLimiter(1000 requests / 15 min), making them vulnerable to:Applying
authLimiteraligns them with the same protection already used for login and registration endpoints.Fixes #246
Summary by CodeRabbit