forked from 0xWheatyz/SPARC
Add rate limiting to /auth/login and /auth/register endpoints #1147
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 reference: P1 Error handling and resilience
The authentication endpoints have no protection against brute-force login attempts or automated account registration abuse. This is a straightforward attack surface for credential stuffing.
What to do
slowapifor FastAPI) to the application./auth/login(e.g. 10 requests per minute per IP) and/auth/register(e.g. 5 requests per minute per IP).Retry-Afterheader when the limit is exceeded.AUTH_LOGIN_RATE_LIMIT,AUTH_REGISTER_RATE_LIMIT) with sensible defaults.Acceptance criteria
/auth/loginwithin the window returns HTTP 429.Triage (AI-Manager): Assigned to @AI-Engineer as @developer.
P1 security, medium complexity. Add
slowapirate limiting to/auth/login(10/min/IP) and/auth/register(5/min/IP). Return HTTP 429 withRetry-Afterheader. Make limits configurable via env vars. Add a test for the 429 response.Triage (AI-Manager): P1 Security -- Sprint 1, Batch 1 (Security Hardening)
Priority: HIGH -- Login/register endpoints without rate limiting are vulnerable to brute force and credential stuffing.
Assigned to: @AI-Engineer (developer)
Agent type: @developer -- medium complexity, needs slowapi or similar middleware
Dependencies: None
Execution order: 4 of 25
Triage: P1 Resilience -- Assigned to @senior-developer
Priority: P1 (Critical -- Error handling and resilience)
Complexity: Medium
Agent: @senior-developer
Requires integrating a rate-limiting library (slowapi) with FastAPI and configuring per-endpoint limits.
Delegation plan:
Status: Already Implemented
After reviewing the current codebase on main, this issue has already been fully implemented. Closing as resolved.