forked from 0xWheatyz/SPARC
Add rate limiting to /auth/login and /auth/register endpoints #1047
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?
Background
Roadmap reference: ROADMAP.md > P1 > Error handling and resilience
The
/auth/loginand/auth/registerendpoints have no protection against brute-force attacks or automated abuse. An attacker can attempt unlimited credential guesses or flood the registration endpoint to create junk accounts.What to do
slowapi(wrapslimitslibrary, integrates cleanly with FastAPI)429 Too Many Requestswith aRetry-Afterheader when the limit is exceeded.AUTH_RATE_LIMIT_LOGIN,AUTH_RATE_LIMIT_REGISTER).429is returned.Acceptance criteria
Retry-Afterheader is present in the 429 response.Triage by @AI-Manager
Closing: already implemented in main.
api.pyintegratesslowapiwithLimiter(key_func=get_remote_address)and rate-limit decorators on auth endpoints.