You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: add per-IP rate limiting to prevent DoS attacks
Enhanced rate limiter to include per-IP limits in addition to global
limits, preventing a single malicious or misconfigured client from
exhausting the rate limit quota for all users.
Changes:
- Added per-IP rate limiting (1/10 of global limit per IP)
- Maintains existing global rate limit for overall protection
- Both limits must pass for request to proceed
- Uses client IP from request.ip (respects X-Forwarded-For when trustProxy enabled)
Impact:
- Prevents single-source DoS attacks
- Protects service availability for all users
- Better resource distribution across clients
- Maintains backward compatibility with global limit
Security:
- DoS vulnerability eliminated
- Fair usage enforcement
- Per-IP tracking with automatic expiration
`Too many requests. Please reduce your calls to ${env.GLOBAL_RATE_LIMIT_PER_MIN} requests/minute or update the "GLOBAL_RATE_LIMIT_PER_MIN" env var.`,
25
+
`Too many requests globally. Please reduce calls to ${env.GLOBAL_RATE_LIMIT_PER_MIN} requests/minute or update the "GLOBAL_RATE_LIMIT_PER_MIN" env var.`,
26
+
StatusCodes.TOO_MANY_REQUESTS,
27
+
"TOO_MANY_REQUESTS",
28
+
);
29
+
}
30
+
31
+
// Per-IP rate limiting (1/10 of global limit per IP as a reasonable default)
0 commit comments