forked from 0xWheatyz/SPARC
Security: add rate limiting to /auth/login and /auth/register endpoints #359
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
/auth/loginand/auth/registerhave no protection against brute-force or abuse. An attacker can make unlimited login attempts or spam registrations with no throttling.Work
slowapior a custom middleware using a Redis or in-memory counter).POST /auth/login(e.g., 10 requests/minute per IP) andPOST /auth/register(e.g., 5 requests/minute per IP).Retry-Afterheader when the limit is exceeded.config.pyor as environment variables so they are adjustable without code changes.Acceptance Criteria
Reference
Roadmap item: P1 Error handling and resilience — No rate limiting on auth endpoints.
[Triage] Already implemented in main. api.py imports slowapi, configures a Limiter with get_remote_address, and has a rate_limit_handler. tests/test_rate_limit.py provides test coverage. Closing as resolved.