forked from 0xWheatyz/SPARC
Add rate limiting to /auth/login and /auth/register endpoints #121
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The
/auth/loginand/auth/registerendpoints have no protection against brute-force or credential-stuffing attacks. An attacker can make unlimited requests.Work
slowapifor FastAPI) to the application./auth/login(e.g., 10 requests per minute) and/auth/register(e.g., 5 requests per minute).Retry-Afterheader when the limit is exceeded.AUTH_RATE_LIMIT_LOGIN,AUTH_RATE_LIMIT_REGISTER).Acceptance Criteria
/auth/loginresults in HTTP 429.Retry-Afterheader is present in the 429 response.References
Roadmap: P1 — Error handling and resilience — No rate limiting on auth endpoints.
This issue has already been resolved. Rate limiting is implemented using
slowapiinSPARC/api.py:/auth/registeris limited to 5/minute and/auth/loginis limited to 10/minute. A customrate_limit_handlerreturns 429 with aRetry-Afterheader.Resolved by prior work. Closing.