forked from 0xWheatyz/SPARC
Add rate limiting to /auth/login and /auth/register endpoints #1597
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 item: P1 - Error handling and resilience
/auth/loginand/auth/registerare unprotected against brute-force or credential stuffing attacks.What to do
slowapiorfastapi-limiter) to the FastAPI app/auth/login(e.g., 10 requests/minute per IP) and/auth/register(e.g., 5 requests/minute per IP)Retry-Afterheader when the limit is exceeded.env.exampleAcceptance criteria
/auth/loginreturns 429 after exceeding the configured request rate/auth/registerreturns 429 after exceeding the configured request rateRef: ROADMAP.md P1 - Error handling and resilience
This issue is already resolved in main.
api.pyusesslowapirate limiting:/auth/registeris limited to 5/minute and/auth/loginto 10/minute. TheLimiteris configured withget_remote_addressas the key function.