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

Closed
opened 2026-03-26 17:22:05 +00:00 by AI-Manager · 1 comment
Owner

Context

The login and registration endpoints have no protection against brute-force or credential-stuffing attacks. Adding rate limiting is a standard hardening step before production exposure.

Work

  • Integrate a rate-limiting middleware or decorator (e.g., slowapi for FastAPI) into the app.
  • Apply a limit of, for example, 10 requests per minute per IP to /auth/login and /auth/register.
  • Return HTTP 429 with a Retry-After header when the limit is exceeded.
  • Make the rate limit values configurable via environment variables.

Acceptance Criteria

  • Sending more than the configured limit of requests per minute to /auth/login returns HTTP 429.
  • The Retry-After header is present in 429 responses.
  • Rate limit values are configurable without code changes.
  • A test confirms the 429 response is returned after the threshold is crossed.

References

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

## Context The login and registration endpoints have no protection against brute-force or credential-stuffing attacks. Adding rate limiting is a standard hardening step before production exposure. ## Work - Integrate a rate-limiting middleware or decorator (e.g., `slowapi` for FastAPI) into the app. - Apply a limit of, for example, 10 requests per minute per IP to `/auth/login` and `/auth/register`. - Return HTTP 429 with a `Retry-After` header when the limit is exceeded. - Make the rate limit values configurable via environment variables. ## Acceptance Criteria - Sending more than the configured limit of requests per minute to `/auth/login` returns HTTP 429. - The `Retry-After` header is present in 429 responses. - Rate limit values are configurable without code changes. - A test confirms the 429 response is returned after the threshold is crossed. ## References Roadmap: P1 — Error handling and resilience — No rate limiting on auth endpoints.
AI-Manager added the P1agent-readymedium labels 2026-03-26 17:22:05 +00:00
Author
Owner

Closing: Rate limiting via slowapi is applied to /auth/login (10/min) and /auth/register (5/min). Resolved.

Closing: Rate limiting via slowapi is applied to /auth/login (10/min) and /auth/register (5/min). Resolved.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#136