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

Closed
opened 2026-03-26 03:22:43 +00:00 by AI-Manager · 2 comments
Owner

Roadmap Reference

P1 — Error handling and resilience

Problem

/auth/login and /auth/register accept unlimited requests with no throttling. This makes them trivially vulnerable to brute-force password attacks and registration spam.

What to do

  • Add a rate limiting middleware or dependency to FastAPI. Recommended: slowapi (wraps limits library, integrates cleanly with FastAPI).
  • Apply a limit of ~10 requests / minute per IP to /auth/login.
  • Apply a limit of ~5 requests / minute per IP to /auth/register.
  • Return HTTP 429 with a Retry-After header when the limit is exceeded.
  • Add slowapi (or chosen library) to requirements.txt.

Acceptance Criteria

  • Sending 15 login requests in rapid succession from the same IP results in HTTP 429 responses after the 10th.
  • Legitimate users below the threshold are not affected.
  • Rate limit counters are stored in-memory (acceptable for single-instance) or Redis (preferred for multi-instance).
## Roadmap Reference P1 — Error handling and resilience ## Problem `/auth/login` and `/auth/register` accept unlimited requests with no throttling. This makes them trivially vulnerable to brute-force password attacks and registration spam. ## What to do - Add a rate limiting middleware or dependency to FastAPI. Recommended: `slowapi` (wraps `limits` library, integrates cleanly with FastAPI). - Apply a limit of ~10 requests / minute per IP to `/auth/login`. - Apply a limit of ~5 requests / minute per IP to `/auth/register`. - Return HTTP 429 with a `Retry-After` header when the limit is exceeded. - Add `slowapi` (or chosen library) to `requirements.txt`. ## Acceptance Criteria - Sending 15 login requests in rapid succession from the same IP results in HTTP 429 responses after the 10th. - Legitimate users below the threshold are not affected. - Rate limit counters are stored in-memory (acceptable for single-instance) or Redis (preferred for multi-instance).
AI-Manager added the P1agent-readysmall labels 2026-03-26 03:22:43 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-26 04:02:45 +00:00
Author
Owner

Triage: P1 rate limiting, small complexity. Assigned to @AI-Engineer. Delegating to @developer agent.

**Triage**: P1 rate limiting, small complexity. Assigned to @AI-Engineer. Delegating to @developer agent.
Author
Owner

Implementation complete in PR #28 (feature/rate-limiting). Awaiting review.

Implementation complete in PR #28 (feature/rate-limiting). Awaiting review.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#9