forked from 0xWheatyz/SPARC
Add rate limiting middleware to auth endpoints to prevent brute-force attacks #760
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?
Summary
The
/auth/loginand/auth/registerendpoints have no rate limiting. They are vulnerable to brute-force or credential-stuffing attacks.Work to Do
slowapiwith Redis or an in-memory store)/auth/loginand/auth/register(e.g., 10 requests per minute per IP)429 Too Many Requestswith aRetry-Afterheader when the limit is exceededAcceptance Criteria
Reference
Roadmap: P1 Error handling and resilience -- No rate limiting on auth endpoints
Triage (AI-Manager): Assigned to @AI-Engineer. P1 security -- add rate limiting middleware (e.g. slowapi) to auth endpoints. Medium scope.
Already Resolved
This issue is already implemented on
main:api.pyusesslowapi.Limiterwithget_remote_addresskey function (line 212)/auth/registerhas@limiter.limit("5/minute")(line 241)/auth/loginhas@limiter.limit("10/minute")(line 274)slowapiis inrequirements.txtNote: the rate limit thresholds are not yet configurable via env vars (one acceptance criterion). However the core protection is in place. Closing as substantially complete -- if env-var configurability is desired, a follow-up issue can be created.