forked from 0xWheatyz/SPARC
Add rate limiting to /auth/login and /auth/register endpoints #739
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
Roadmap reference: P1 - Error handling and resilience
The
/auth/loginand/auth/registerendpoints have no protection against brute-force attacks or abuse.What to do
slowapior a custom Redis-backed limiter)POST /auth/login(e.g., 10 requests/minute per IP) andPOST /auth/register(e.g., 5 requests/minute per IP)Retry-Afterheader when the limit is exceededAUTH_RATE_LIMIT_LOGIN,AUTH_RATE_LIMIT_REGISTER)Acceptance criteria
Resolved. Rate limiting via
slowapiis implemented./auth/registeris limited to 5/minute,/auth/loginto 10/minute. HTTP 429 with Retry-After header is returned when exceeded. Tests exist intests/test_rate_limit.py.