fix: add rate limiting to /auth/login and /auth/register - #268
fix: add rate limiting to /auth/login and /auth/register#268RudraDudhat2509 wants to merge 1 commit into
Conversation
Login had zero throttling — only /auth/forgot-password had a rate limiter. Combined with predictable @iitbhilai.ac.in usernames, this left login open to unlimited brute-force/credential-stuffing. Added the same express-rate-limit pattern already used for forgot-password (10 requests/15min for login and register). Bootstraps backend testing (jest + supertest + mongodb-memory-server) since this branch was cut before OpenLake#266 (same infra) was merged. Fixes OpenLake#260
|
@RudraDudhat2509 is attempting to deploy a commit to the openlake's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Warning Review limit reached
Next review available in: 42 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
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 |
Fixes #260
What changed
/auth/loginhad zero rate limiting — only/auth/forgot-passwordhad a limiter. Combined with predictable@iitbhilai.ac.inusernames, this left the login endpoint open to unlimited automated password guessing.Added the same
express-rate-limitpattern already used forforgot-password— 10 requests per 15 minutes — to both/auth/loginand/auth/register.Testing
This PR was cut before #266 merged, so it re-adds the same backend test setup (
jest+supertest+mongodb-memory-server) — no conflict, just means both PRs happen to touchpackage.jsonthe same way; whichever merges first, the other will just no-op that part.Test fires 11 login attempts with bad credentials against a live (in-memory) Mongo instance and asserts the limiter kicks in before all 11 go through.
Verified the test is meaningful — ran it against the old unprotected route first:
Run with
npm testinbackend/.