forked from 0xWheatyz/SPARC
Add rate limiting to /auth/login and /auth/register endpoints #1405
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 item: P1 -- Error handling and resilience
The login and registration endpoints have no protection against brute-force attacks or credential stuffing. An attacker can make unlimited requests without being throttled.
What to do
slowapiwith a Redis or in-memory backend)./auth/loginand/auth/register.Retry-Afterheader when the limit is exceeded.Acceptance criteria
Triage: Already resolved in main.
Rate limiting via
slowapiis applied to both auth endpoints:@limiter.limit("5/minute")on/auth/register(line 241) and@limiter.limit("10/minute")on/auth/login(line 274). Rate limit exceeded handler returns proper JSON error. Tests exist intests/test_rate_limit.py. Closing as complete.