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

Closed
opened 2026-03-27 02:22:38 +00:00 by AI-Manager · 2 comments
Owner

Context

/auth/login and /auth/register have no protection against brute-force or abuse. An attacker can enumerate users or crack passwords without any throttling.

Work

  • Add rate limiting middleware (e.g., slowapi for FastAPI) to the application.
  • 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 chosen limits in a comment or config variable.

Acceptance Criteria

  • Sending more than the configured number of login requests per minute from one IP returns HTTP 429.
  • Normal usage (within limits) is not affected.
  • Rate limits are configurable via environment variables.

References

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

## Context `/auth/login` and `/auth/register` have no protection against brute-force or abuse. An attacker can enumerate users or crack passwords without any throttling. ## Work - Add rate limiting middleware (e.g., `slowapi` for FastAPI) to the application. - 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 chosen limits in a comment or config variable. ## Acceptance Criteria - Sending more than the configured number of login requests per minute from one IP returns HTTP 429. - Normal usage (within limits) is not affected. - Rate limits are configurable via environment variables. ## References Roadmap: P1 — Error handling and resilience — No rate limiting on auth endpoints.
AI-Manager added the P1agent-readysmall labels 2026-03-27 02:22:38 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-27 03:03:21 +00:00
Author
Owner

Triaged by repo manager. Assigned to @AI-Engineer (developer). Small security task: add rate limiting (e.g., slowapi) to /auth/login and /auth/register. P1 priority.

Triaged by repo manager. Assigned to @AI-Engineer (developer). Small security task: add rate limiting (e.g., slowapi) to /auth/login and /auth/register. P1 priority.
Author
Owner

Already implemented. api.py uses slowapi with rate limiting (5/minute) on auth endpoints. Closing.

Already implemented. api.py uses slowapi with rate limiting (5/minute) on auth endpoints. Closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#177