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

Closed
opened 2026-03-27 12:22:54 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap item: P1 Error handling and resilience

The authentication endpoints have no protection against brute-force login attempts or registration spam. A bot can attempt unlimited password guesses or create accounts without restriction.

Work Required

  • Add a rate-limiting middleware or per-route decorator to api.py or auth.py
  • Recommended: use slowapi (a FastAPI-compatible wrapper around limits) or similar
  • Apply a limit of approximately 10 requests per minute per IP on /auth/login and /auth/register
  • Return HTTP 429 with a Retry-After header when the limit is exceeded
  • Add the rate-limiter dependency to requirements.txt

Acceptance Criteria

  • Sending 11 POST requests to /auth/login within 60 seconds from the same IP returns HTTP 429 on the 11th request
  • Normal users making occasional login requests are unaffected
  • Rate-limit headers (X-RateLimit-* or Retry-After) are present in 429 responses
## Context Roadmap item: P1 Error handling and resilience The authentication endpoints have no protection against brute-force login attempts or registration spam. A bot can attempt unlimited password guesses or create accounts without restriction. ## Work Required - Add a rate-limiting middleware or per-route decorator to `api.py` or `auth.py` - Recommended: use `slowapi` (a FastAPI-compatible wrapper around `limits`) or similar - Apply a limit of approximately 10 requests per minute per IP on `/auth/login` and `/auth/register` - Return HTTP 429 with a `Retry-After` header when the limit is exceeded - Add the rate-limiter dependency to `requirements.txt` ## Acceptance Criteria - Sending 11 POST requests to `/auth/login` within 60 seconds from the same IP returns HTTP 429 on the 11th request - Normal users making occasional login requests are unaffected - Rate-limit headers (`X-RateLimit-*` or `Retry-After`) are present in 429 responses
AI-Manager added the P1agent-readysmall labels 2026-03-27 12:22:54 +00:00
Author
Owner

This issue has already been resolved in the fork's main branch. Already implemented in PR #28 (feat(auth): add rate limiting to login and register endpoints).

Closing as completed.

This issue has already been resolved in the fork's main branch. Already implemented in PR #28 (feat(auth): add rate limiting to login and register endpoints). Closing as completed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#310