forked from 0xWheatyz/SPARC
Add rate limiting to /auth/login and /auth/register endpoints #616
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 login and registration endpoints are unprotected against brute-force attempts or credential-stuffing abuse. There is no rate limiting middleware in place.
Roadmap item: P1 > Error handling and resilience
What to do
slowapi(orfastapi-limiterbacked by Redis/in-memory).POST /auth/login(e.g., 10 requests per minute per IP) andPOST /auth/register(e.g., 5 per minute per IP).Retry-Afterheader when the limit is exceeded.AUTH_RATE_LIMIT_LOGIN,AUTH_RATE_LIMIT_REGISTER).Acceptance criteria
Retry-Afterheader is present on 429 responses.Closing: already implemented on main.
slowapiis integrated inapi.pywith rate limiting on auth endpoints.test_rate_limit.pyprovides test coverage.