Add new rate limits

This commit is contained in:
Tuan Dang
2024-04-04 18:12:23 -07:00
parent 1017707642
commit d3cdaa8449
55 changed files with 958 additions and 161 deletions
+26 -3
View File
@@ -18,6 +18,28 @@ export const globalRateLimiterCfg = (): RateLimitPluginOptions => {
};
};
// GET endpoints
export const readLimit: RateLimitOptions = {
timeWindow: 60 * 1000,
max: 600,
keyGenerator: (req) => req.realIp
};
// POST, PATCH, PUT, DELETE endpoints
export const writeLimit: RateLimitOptions = {
timeWindow: 60 * 1000,
max: 50,
keyGenerator: (req) => req.realIp
};
// special endpoints
export const secretsLimit: RateLimitOptions = {
// secrets, folders, secret imports
timeWindow: 60 * 1000,
max: 600,
keyGenerator: (req) => req.realIp
};
export const authRateLimit: RateLimitOptions = {
timeWindow: 60 * 1000,
max: 60,
@@ -26,12 +48,13 @@ export const authRateLimit: RateLimitOptions = {
export const inviteUserRateLimit: RateLimitOptions = {
timeWindow: 60 * 1000,
max: 10,
max: 30,
keyGenerator: (req) => req.realIp
};
export const passwordRateLimit: RateLimitOptions = {
export const creationLimit: RateLimitOptions = {
// identity, project, org
timeWindow: 60 * 1000,
max: 600,
max: 30,
keyGenerator: (req) => req.realIp
};