feat: rate-limit /auth/login, /register, /me/password (0.35.0)
A hand-rolled token-bucket limiter (5 req/sec, 10-request burst by default; AUTH_RATE_PER_SEC/AUTH_RATE_BURST env knobs) gates the three auth-mutation endpoints. One bucket per AppState so tests stay isolated. Tower-governor wasn't wired in because the reverse proxy doesn't yet forward client IPs — a global bucket gives equivalent brute-force protection until that lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -29,6 +29,13 @@ COOKIE_DOMAIN=
|
||||
# get reaped lazily.
|
||||
SESSION_TTL_DAYS=30
|
||||
|
||||
# ----- Auth brute-force rate limits -----
|
||||
# Token-bucket budget shared across /auth/login, /auth/register, and
|
||||
# /auth/me/password. Set per_sec=0 to disable (e.g. behind a
|
||||
# rate-limiting reverse proxy that already enforces a budget).
|
||||
AUTH_RATE_PER_SEC=5
|
||||
AUTH_RATE_BURST=10
|
||||
|
||||
# ----- CORS -----
|
||||
# Comma-separated origins allowed to call the API with credentials.
|
||||
# Default is empty: same-origin only. Set when frontend and backend live
|
||||
|
||||
Reference in New Issue
Block a user