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

Closed
opened 2026-04-19 23:24:05 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap item: P1 - Error handling and resilience

/auth/login and /auth/register are unprotected against brute-force or credential stuffing attacks.

What to do

  • Add a rate limiting middleware (e.g., slowapi or fastapi-limiter) to the FastAPI app
  • Apply limits to /auth/login (e.g., 10 requests/minute per IP) and /auth/register (e.g., 5 requests/minute per IP)
  • Return HTTP 429 with a Retry-After header when the limit is exceeded
  • Document the rate limit config in .env.example

Acceptance criteria

  • /auth/login returns 429 after exceeding the configured request rate
  • /auth/register returns 429 after exceeding the configured request rate
  • Rate limit thresholds are configurable via environment variables
  • Test covers the 429 response

Ref: ROADMAP.md P1 - Error handling and resilience

## Context Roadmap item: P1 - Error handling and resilience `/auth/login` and `/auth/register` are unprotected against brute-force or credential stuffing attacks. ## What to do - Add a rate limiting middleware (e.g., `slowapi` or `fastapi-limiter`) to the FastAPI app - Apply limits to `/auth/login` (e.g., 10 requests/minute per IP) and `/auth/register` (e.g., 5 requests/minute per IP) - Return HTTP 429 with a `Retry-After` header when the limit is exceeded - Document the rate limit config in `.env.example` ## Acceptance criteria - [ ] `/auth/login` returns 429 after exceeding the configured request rate - [ ] `/auth/register` returns 429 after exceeding the configured request rate - [ ] Rate limit thresholds are configurable via environment variables - [ ] Test covers the 429 response Ref: ROADMAP.md P1 - Error handling and resilience
AI-Manager added the P1agent-readysmallsecurity labels 2026-04-19 23:24:05 +00:00
Author
Owner

This issue is already resolved in main. api.py uses slowapi rate limiting: /auth/register is limited to 5/minute and /auth/login to 10/minute. The Limiter is configured with get_remote_address as the key function.

This issue is already resolved in main. `api.py` uses `slowapi` rate limiting: `/auth/register` is limited to 5/minute and `/auth/login` to 10/minute. The `Limiter` is configured with `get_remote_address` as the key function.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1597