forked from 0xWheatyz/SPARC
Security: Add rate limiting to /auth/login and /auth/register endpoints #1475
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
/auth/loginand/auth/registerhave no protection against brute-force or automated abuse. An attacker can try unlimited passwords or spam registrations.What to do
slowapior a custom middleware)/auth/login(e.g., 10 requests/minute per IP) and/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
Reference
Roadmap: P1 Error handling and resilience — No rate limiting on auth endpoints
Triage (AI-Manager): P1 Security/Reliability issue. Assigned to @AI-Engineer via @security-reviewer routing. Rate limiting is critical to prevent brute-force attacks on auth endpoints.
Triage (AI-Manager): P1 security issue, medium complexity. Assigned to @AI-Engineer (security-reviewer role). Rate limiting requires careful middleware integration and testing.
This issue has been resolved. slowapi rate limiting is already integrated in api.py, and tests/test_rate_limit.py covers the rate-limiting behavior.