Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: add max length validation to environment name in deprecated router

Abdulmoiz433884f40195
diff --git a/backend/src/server/routes/v1/deprecated-project-env-router.ts b/backend/src/server/routes/v1/deprecated-project-env-router.ts
index 4909889833..4eff4999a6 100644
--- a/backend/src/server/routes/v1/deprecated-project-env-router.ts
+++ b/backend/src/server/routes/v1/deprecated-project-env-router.ts
@@ -128,7 +128,7 @@ export const registerDeprecatedProjectEnvRouter = async (server: FastifyZodProvi
workspaceId: z.string().trim().describe(ENVIRONMENTS.CREATE.projectId)
}),
body: z.object({
- name: z.string().trim().describe(ENVIRONMENTS.CREATE.name),
+ name: z.string().trim().min(1).max(64).describe(ENVIRONMENTS.CREATE.name),
position: z.number().min(1).optional().describe(ENVIRONMENTS.CREATE.position),
slug: slugSchema({ max: 64 }).describe(ENVIRONMENTS.CREATE.slug)
}),
@@ -191,7 +191,7 @@ export const registerDeprecatedProjectEnvRouter = async (server: FastifyZodProvi
}),
body: z.object({
slug: slugSchema({ max: 64 }).optional().describe(ENVIRONMENTS.UPDATE.slug),
- name: z.string().trim().optional().describe(ENVIRONMENTS.UPDATE.name),
+ name: z.string().trim().min(1).max(64).optional().describe(ENVIRONMENTS.UPDATE.name),
position: z.number().optional().describe(ENVIRONMENTS.UPDATE.position)
}),
response: {