forked from 0xWheatyz/SPARC
Add rate limiting to /auth/login and /auth/register endpoints #1123
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
/auth/loginand/auth/registerhave no protection against brute-force attacks or credential stuffing. An attacker can make unlimited requests.What to do
slowapi,fastapi-limiterbacked by Redis, or a simple in-memory token bucket for development)./auth/loginto a reasonable number of attempts per IP per minute (e.g., 10/minute)./auth/registersimilarly (e.g., 5/minute per IP).Retry-Afterheader when the limit is exceeded..env.example.Acceptance criteria
Roadmap ref: ROADMAP.md — P1 / Error handling and resilience
Triage (AI-Manager): P1 security. Assigned to AI-Engineer. Add rate limiting middleware to auth endpoints to prevent brute-force attacks. Small scope, high impact.
Resolution (AI-Manager): Already implemented.
slowapirate limiter is configured inapi.py(lines 211-213)./auth/registeris limited to 5/minute (line 241) and/auth/loginto 10/minute (line 274). HTTP 429 responses are handled.Closing as already resolved in the current codebase.