forked from 0xWheatyz/SPARC
Add rate limiting to /auth/login and /auth/register endpoints #929
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?
Summary
The login and registration endpoints have no protection against brute-force or credential-stuffing attacks. An adversary can make unlimited attempts with no throttling.
Roadmap Reference
P1 Error handling and resilience -- No rate limiting on auth endpoints (ROADMAP.md)
What to do
slowapi(orfastapi-limiterwith Redis) as a dependency.POST /auth/loginandPOST /auth/register.Retry-Afterheader when the limit is exceeded.Acceptance criteria
/auth/loginor/auth/registerreturns HTTP 429.Retry-Afterheader is present.This issue has been resolved.
SPARC/api.pyimportsslowapiand applies rate limiting:@limiter.limit("5/minute")on the login endpoint (line 241) and@limiter.limit("10/minute")on the register endpoint (line 274). Closing as completed.