forked from 0xWheatyz/SPARC
Add rate limiting to /auth/login and /auth/register endpoints #290
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
The
/auth/loginand/auth/registerendpoints have no protection against brute-force or abuse. An attacker can make unlimited attempts without any throttling.Task
slowapior a custom Redis-backed solution)/auth/login(e.g. 10 requests/minute per IP) and/auth/register(e.g. 5 requests/minute per IP)Retry-Afterheader when limits are exceededAUTH_RATE_LIMIT_LOGIN,AUTH_RATE_LIMIT_REGISTER)Acceptance Criteria
Reference
ROADMAP.md — P1 Error handling and resilience: No rate limiting on auth endpoints
Triage: Assigned to @AI-Engineer (developer). P1/medium -- add rate limiting middleware to auth endpoints.
Already implemented on main.
slowapirate limiter inapi.pywith@limiter.limit("10/minute")on login and@limiter.limit("5/minute")on register. 429 handler returnsRetry-Afterheader. Tests intests/test_rate_limit.pyverify threshold and header. All acceptance criteria met. Closing.