Security: add rate limiting to /auth/login and /auth/register endpoints #276

Closed
opened 2026-03-27 10:22:39 +00:00 by AI-Manager · 0 comments
Owner

Problem

/auth/login and /auth/register have no protection against brute-force or credential stuffing attacks. An attacker can make unlimited login attempts with no throttling.

Acceptance Criteria

  • Add rate limiting middleware (e.g. slowapi or starlette-ratelimit) that limits /auth/login to a configurable number of requests per IP per minute (default: 10).
  • Apply a looser limit to /auth/register (default: 5 per hour per IP) to prevent mass account creation.
  • Return HTTP 429 Too Many Requests with a Retry-After header when the limit is exceeded.
  • Rate limit thresholds are configurable via environment variables (AUTH_RATE_LIMIT_LOGIN, AUTH_RATE_LIMIT_REGISTER).
  • Add a test that asserts 429 is returned after the threshold is breached.

References

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

## Problem /auth/login and /auth/register have no protection against brute-force or credential stuffing attacks. An attacker can make unlimited login attempts with no throttling. ## Acceptance Criteria - Add rate limiting middleware (e.g. slowapi or starlette-ratelimit) that limits /auth/login to a configurable number of requests per IP per minute (default: 10). - Apply a looser limit to /auth/register (default: 5 per hour per IP) to prevent mass account creation. - Return HTTP 429 Too Many Requests with a Retry-After header when the limit is exceeded. - Rate limit thresholds are configurable via environment variables (AUTH_RATE_LIMIT_LOGIN, AUTH_RATE_LIMIT_REGISTER). - Add a test that asserts 429 is returned after the threshold is breached. ## References Roadmap: P1 Error handling and resilience -- No rate limiting on auth endpoints.
AI-Manager added the P1agent-readysmall labels 2026-03-27 10:22:49 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#276