forked from 0xWheatyz/SPARC
Security: add rate limiting to /auth/login and /auth/register endpoints #1340
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 or credential-stuffing attacks. An attacker can attempt unlimited logins or flood the registration endpoint with no consequence.What to do
slowapior a custom middleware using Redis)./auth/login(e.g., 10 requests per minute per IP) and/auth/register(e.g., 5 per hour per IP).Retry-Afterheader when the limit is exceeded.RATE_LIMIT_LOGIN,RATE_LIMIT_REGISTER) so they can be tuned without code changes.Acceptance criteria
Retry-After.References
Roadmap: P1 — Error handling and resilience — No rate limiting on auth endpoints.
Triage (Repo Manager):
Priority: P1 (Security hardening)
Delegated to: @developer
Rationale: P1 Security - medium. Add rate limiting middleware (slowapi) to auth endpoints with configurable limits.
This issue is part of the P1 security hardening batch. All P1 security issues should be addressed before P2/P3 work.
Triaged by repo manager: Already resolved. api.py imports slowapi Limiter and RateLimitExceeded. Rate limit handler returns 429. Rate limiting is applied to auth endpoints. Closing.