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

Abdulmoize5d4c21cb15b
diff --git a/backend/src/server/routes/v1/project-env-router.ts b/backend/src/server/routes/v1/project-env-router.ts
index de992e9135..f1e64a5748 100644
--- a/backend/src/server/routes/v1/project-env-router.ts
+++ b/backend/src/server/routes/v1/project-env-router.ts
@@ -136,7 +136,7 @@ export const registerProjectEnvRouter = async (server: FastifyZodProvider) => {
projectId: 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)
}),
@@ -212,7 +212,7 @@ export const registerProjectEnvRouter = async (server: FastifyZodProvider) => {
}),
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: {