forked from 0xWheatyz/SPARC
Add rate limiting to /auth/login and /auth/register endpoints #945
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?
Background
The
/auth/loginand/auth/registerendpoints have no protection against brute-force attacks or credential stuffing. An attacker can make unlimited attempts without consequence.Task
slowapior a custom dependency) to the FastAPI app./auth/login(e.g. 10 attempts per minute per IP) and/auth/register(e.g. 5 per hour per IP).429 Too Many Requestswith aRetry-Afterheader when the limit is exceeded.Acceptance Criteria
/auth/loginare rejected after the configured threshold with a429response.429.Reference
Roadmap: P1 Error handling and resilience — No rate limiting on auth endpoints.
Triaged by repo manager. This issue has already been resolved in the current codebase.
api.pyintegratesslowapi(lines 14-16) with aLimiterinstance (line 212). The login endpoint has@limiter.limit('10/minute')(line 274) and the register endpoint has@limiter.limit('5/minute')(line 241). A429handler is registered.tests/test_rate_limit.pyexists. Closing as already implemented.