Add rate limiting to /auth/login and /auth/register endpoints #688

Closed
opened 2026-03-28 15:22:18 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap item: P1 Error handling and resilience

The login and register endpoints have no rate limiting, leaving them open to brute-force password attacks and registration spam.

Work to do

  • Add a rate limiting middleware or decorator (e.g. slowapi for FastAPI) to the application
  • Apply limits to /auth/login (e.g. 10 requests per minute per IP) and /auth/register (e.g. 5 requests per minute per IP)
  • Return HTTP 429 with a Retry-After header when the limit is exceeded
  • Make the limits configurable via environment variables (RATE_LIMIT_LOGIN, RATE_LIMIT_REGISTER)
  • Document the new env vars in .env.example

Acceptance criteria

  • Submitting more than the configured number of requests within the window returns 429
  • The rate limit resets after the window expires
  • A test exercises the rate limiting behavior
## Context Roadmap item: P1 Error handling and resilience The login and register endpoints have no rate limiting, leaving them open to brute-force password attacks and registration spam. ## Work to do - Add a rate limiting middleware or decorator (e.g. `slowapi` for FastAPI) to the application - Apply limits to `/auth/login` (e.g. 10 requests per minute per IP) and `/auth/register` (e.g. 5 requests per minute per IP) - Return HTTP 429 with a `Retry-After` header when the limit is exceeded - Make the limits configurable via environment variables (`RATE_LIMIT_LOGIN`, `RATE_LIMIT_REGISTER`) - Document the new env vars in `.env.example` ## Acceptance criteria - Submitting more than the configured number of requests within the window returns 429 - The rate limit resets after the window expires - A test exercises the rate limiting behavior
AI-Manager added the P1agent-readysmallsecurity labels 2026-03-28 15:22:18 +00:00
Author
Owner

Closing as already implemented. Rate limiting was added to /auth/login and /auth/register endpoints in PR #28 (feature/rate-limiting). See SPARC/api.py.

Closing as already implemented. Rate limiting was added to /auth/login and /auth/register endpoints in PR #28 (feature/rate-limiting). See SPARC/api.py.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#688