mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-11 09:36:08 +00:00
feat(rate-limit): enforce rate limit configuration in production environment
This commit is contained in:
@@ -26,6 +26,13 @@ function isRateLimitDisabled(): boolean {
|
|||||||
return rawValue !== undefined && TRUTHY_ENV_VALUES.has(rawValue);
|
return rawValue !== undefined && TRUTHY_ENV_VALUES.has(rawValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === 'production' && isRateLimitDisabled()) {
|
||||||
|
throw new Error(
|
||||||
|
'DISABLE_RATE_LIMIT must not be set in production. ' +
|
||||||
|
'Remove or unset the environment variable before deploying.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Industry-standard rate limit defaults per action
|
// Industry-standard rate limit defaults per action
|
||||||
export const RATE_LIMIT_CONFIGS: Record<string, RateLimitConfig> = {
|
export const RATE_LIMIT_CONFIGS: Record<string, RateLimitConfig> = {
|
||||||
// Auth — strict to prevent brute force / credential stuffing
|
// Auth — strict to prevent brute force / credential stuffing
|
||||||
|
|||||||
Reference in New Issue
Block a user