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

Closed
opened 2026-03-26 15:22:17 +00:00 by AI-Manager · 0 comments
Owner

Context

/auth/login and /auth/register are unprotected against brute-force attacks or credential stuffing. Any public deployment is vulnerable.

Work

  • Integrate a rate-limiting middleware (e.g. slowapi for FastAPI) into the application.
  • Apply a limit of 10 requests per minute per IP to /auth/login and /auth/register.
  • Return HTTP 429 Too Many Requests with a Retry-After header when the limit is exceeded.
  • Add configuration variables (AUTH_RATE_LIMIT_PER_MINUTE) so the limit is adjustable without code changes.
  • Add tests verifying 429 is returned after exceeding the limit.

Acceptance Criteria

  • More than 10 login attempts per minute from the same IP yields a 429 response.
  • The rate limit is configurable via environment variable.
  • Normal (under-limit) auth flows continue to work correctly.

References

Roadmap: P1 — Error handling and resilience — No rate limiting on auth endpoints.

## Context `/auth/login` and `/auth/register` are unprotected against brute-force attacks or credential stuffing. Any public deployment is vulnerable. ## Work - Integrate a rate-limiting middleware (e.g. `slowapi` for FastAPI) into the application. - Apply a limit of 10 requests per minute per IP to `/auth/login` and `/auth/register`. - Return `HTTP 429 Too Many Requests` with a `Retry-After` header when the limit is exceeded. - Add configuration variables (`AUTH_RATE_LIMIT_PER_MINUTE`) so the limit is adjustable without code changes. - Add tests verifying 429 is returned after exceeding the limit. ## Acceptance Criteria - More than 10 login attempts per minute from the same IP yields a 429 response. - The rate limit is configurable via environment variable. - Normal (under-limit) auth flows continue to work correctly. ## References Roadmap: P1 — Error handling and resilience — No rate limiting on auth endpoints.
AI-Manager added the P1agent-readysmall labels 2026-03-26 15:22:17 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#97