Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
Add separate rate limit to invite user
Tuan Dang15546181679f
diff --git a/backend/src/server/config/rateLimiter.ts b/backend/src/server/config/rateLimiter.tsindex 444158cbf4..76429b0a5f 100644--- a/backend/src/server/config/rateLimiter.ts+++ b/backend/src/server/config/rateLimiter.ts@@ -20,7 +20,13 @@ export const globalRateLimiterCfg = (): RateLimitPluginOptions => {export const authRateLimit: RateLimitOptions = {timeWindow: 60 * 1000,- max: 600,+ max: 60,+ keyGenerator: (req) => req.realIp+};++export const inviteUserRateLimit: RateLimitOptions = {+ timeWindow: 60 * 1000,+ max: 10,keyGenerator: (req) => req.realIp};diff --git a/backend/src/server/routes/v1/invite-org-router.ts b/backend/src/server/routes/v1/invite-org-router.tsindex 212020034d..89fc561e69 100644--- a/backend/src/server/routes/v1/invite-org-router.ts+++ b/backend/src/server/routes/v1/invite-org-router.ts@@ -1,6 +1,7 @@import { z } from "zod";import { UsersSchema } from "@app/db/schemas";+import { inviteUserRateLimit } from "@app/server/config/rateLimiter";import { getTelemetryDistinctId } from "@app/server/lib/telemetry";import { verifyAuth } from "@app/server/plugins/auth/verify-auth";import { ActorType, AuthMode } from "@app/services/auth/auth-type";@@ -9,6 +10,9 @@ import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";export const registerInviteOrgRouter = async (server: FastifyZodProvider) => {server.route({url: "/signup",+ config: {+ rateLimit: inviteUserRateLimit+ },method: "POST",schema: {body: z.object({diff --git a/backend/src/server/routes/v2/project-router.ts b/backend/src/server/routes/v2/project-router.tsindex 3258be50af..19ffc57ede 100644--- a/backend/src/server/routes/v2/project-router.ts+++ b/backend/src/server/routes/v2/project-router.ts@@ -4,7 +4,6 @@ import { z } from "zod";import { ProjectKeysSchema, ProjectsSchema } from "@app/db/schemas";import { EventType } from "@app/ee/services/audit-log/audit-log-types";import { PROJECTS } from "@app/lib/api-docs";-import { authRateLimit } from "@app/server/config/rateLimiter";import { getTelemetryDistinctId } from "@app/server/lib/telemetry";import { verifyAuth } from "@app/server/plugins/auth/verify-auth";import { AuthMode } from "@app/services/auth/auth-type";@@ -136,9 +135,6 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {server.route({method: "POST",url: "/",- config: {- rateLimit: authRateLimit- },schema: {body: z.object({projectName: z.string().trim().describe(PROJECTS.CREATE.projectName),