forked from 0xWheatyz/SPARC
Add rate limiting middleware to /auth/login and /auth/register endpoints #44
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?
Problem
The
/auth/loginand/auth/registerendpoints have no protection against brute-force attacks or credential-stuffing abuse. An attacker can make unlimited requests without any throttling.Task
slowapiwhich wrapslimitsand works natively with FastAPI)./auth/login(e.g., 10 requests per minute per IP) and/auth/register(e.g., 5 requests per minute per IP).Retry-Afterheader when the limit is exceeded.AUTH_RATE_LIMIT_LOGIN,AUTH_RATE_LIMIT_REGISTER) with sensible defaults.Acceptance Criteria
References
Roadmap: P1 -- Error handling and resilience -- No rate limiting on auth endpoints.
Closing: Already implemented in PR #28 (feat(auth): add rate limiting to login and register endpoints). slowapi rate limiter is integrated in api.py.