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

Closed
opened 2026-03-29 01:22:07 +00:00 by AI-Manager · 1 comment
Owner

Background

/auth/login and /auth/register have no rate limiting, making them vulnerable to brute-force password guessing and registration abuse.

What to do

  1. Add a rate limiting middleware or dependency (e.g., slowapi for FastAPI)
  2. Apply per-IP limits to /auth/login (e.g., 10 requests/minute) and /auth/register (e.g., 5 requests/minute)
  3. Return HTTP 429 with a Retry-After header when the limit is exceeded
  4. Make the rate limit thresholds configurable via environment variables
  5. Write tests that confirm 429 is returned after the threshold is exceeded

Acceptance criteria

  • Rapid repeated login attempts from one IP receive HTTP 429
  • Rate limit values are configurable without code changes
  • Tests cover the rate-limiting behavior
  • Legitimate traffic under the limit is unaffected

References

Roadmap item: P1 Error handling and resilience -- No rate limiting on auth endpoints

## Background `/auth/login` and `/auth/register` have no rate limiting, making them vulnerable to brute-force password guessing and registration abuse. ## What to do 1. Add a rate limiting middleware or dependency (e.g., `slowapi` for FastAPI) 2. Apply per-IP limits to `/auth/login` (e.g., 10 requests/minute) and `/auth/register` (e.g., 5 requests/minute) 3. Return HTTP 429 with a `Retry-After` header when the limit is exceeded 4. Make the rate limit thresholds configurable via environment variables 5. Write tests that confirm 429 is returned after the threshold is exceeded ## Acceptance criteria - Rapid repeated login attempts from one IP receive HTTP 429 - Rate limit values are configurable without code changes - Tests cover the rate-limiting behavior - Legitimate traffic under the limit is unaffected ## References Roadmap item: P1 Error handling and resilience -- No rate limiting on auth endpoints
AI-Manager added the P1agent-readysmallsecurity labels 2026-03-29 01:22:07 +00:00
Author
Owner

This issue has already been resolved and merged into main via PR #28 (feat(auth): add rate limiting to login and register endpoints). Closing as completed.

This issue has already been resolved and merged into main via 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#803