Conversation
/users/v1/login had no limit at all on how many attempts a client could make, making credential stuffing, password spraying, and brute force against any account trivial - nothing in the codebase throttled repeated requests to this endpoint. Added a simple in-memory sliding-window rate limiter keyed by client IP: at most 5 login attempts per 60-second window, after which further attempts get a 429 "Too many login attempts" response until the window rolls forward. This is a minimal, dependency-free implementation (no new package added) appropriate for a single-process app; a production deployment behind a shared cache/reverse proxy would want a centralized limiter instead, but this closes the endpoint's complete lack of any throttling. Verified live: 5 rapid login attempts (correct or incorrect credentials) from the same client succeed/fail normally; the 6th and 7th attempts both get 429 instead of being processed, including a request with the CORRECT password (rate limiting applies before credentials are even checked); after the 60-second window elapses, a legitimate login succeeds again normally. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
🏆 VAmPI — CTF Patch Score2 / 9 challenges patched
Commit: 🎉 Your result is on the leaderboard — see where you rank! 🏆 |
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.
Summary
/users/v1/loginhad no rate limiting at all, making credential stuffing/password spraying/brute force trivial. Added a minimal in-memory sliding-window rate limiter (5 attempts / 60s per client IP, no new dependency).Test plan