mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix(security): correct Docker rate limit defaults
- LOGIN_ATTEMPT_LIMIT: 500 -> 30 in Dockerfile (matching code default) - RATE_LIMIT_PER_MIN=0 now means no global limit (50K ceiling) instead of 1 req/min, preserving backward compatibility with existing deploys while keeping per-route limits (login brute-force) active
This commit is contained in:
@@ -156,9 +156,9 @@ app.addHook("onSend", async (_request, reply) => {
|
||||
});
|
||||
|
||||
// Always register rate-limit plugin so per-route limits (login brute-force protection) work.
|
||||
// RATE_LIMIT_PER_MIN defaults to 300 via env schema; floor at 1 as a safety net.
|
||||
// RATE_LIMIT_PER_MIN=0 means no global limit (per-route limits still apply).
|
||||
await app.register(rateLimit, {
|
||||
max: Math.max(env.RATE_LIMIT_PER_MIN, 1),
|
||||
max: env.RATE_LIMIT_PER_MIN > 0 ? env.RATE_LIMIT_PER_MIN : 50_000,
|
||||
timeWindow: "1 minute",
|
||||
allowList: (request) => !request.url.startsWith("/api/"),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user