Skip to content

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

slug names for API

x03220522d4fced3713
diff --git a/backend/src/ee/routes/v1/pam-routers/pam-account-router.ts b/backend/src/ee/routes/v1/pam-routers/pam-account-router.ts
index e595487d94..94ba896660 100644
--- a/backend/src/ee/routes/v1/pam-routers/pam-account-router.ts
+++ b/backend/src/ee/routes/v1/pam-routers/pam-account-router.ts
@@ -10,6 +10,7 @@ import {
} from "@app/ee/services/pam-account-template/pam-account-template-schemas";
import { ApiDocsTags } from "@app/lib/api-docs/constants";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
+import { slugSchema } from "@app/server/lib/schemas";
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { withRoutePrefix } from "@app/server/lib/with-route-prefix";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
@@ -76,7 +77,7 @@ const registerPerTypeEndpoints = (
description: `Create a new ${accountType} PAM account`,
tags: [ApiDocsTags.PamAccounts],
body: z.object({
- name: z.string().trim().min(1).max(64).describe("Display name for the account"),
+ name: slugSchema({ field: "Name" }).describe("Name for the account"),
description: z.string().trim().max(256).optional().describe("Optional description of the account"),
folderId: z.string().uuid().describe("The ID of the folder to place the account in"),
templateId: z.string().uuid().describe("The ID of the account template to use"),
@@ -151,7 +152,7 @@ const registerPerTypeEndpoints = (
tags: [ApiDocsTags.PamAccounts],
params: z.object({ accountId: z.string().uuid().describe("The ID of the account to update") }),
body: z.object({
- name: z.string().trim().min(1).max(64).optional().describe("Display name for the account"),
+ name: slugSchema({ field: "Name" }).optional().describe("New name for the account"),
description: z.string().trim().max(256).nullable().optional().describe("Optional description of the account"),
folderId: z.string().uuid().optional().describe("The ID of the folder to move the account to"),
templateId: z.string().uuid().optional().describe("The ID of the account template to use"),
diff --git a/backend/src/ee/routes/v1/pam-routers/pam-account-template-router.ts b/backend/src/ee/routes/v1/pam-routers/pam-account-template-router.ts
index 8b336a507d..ab223803a9 100644
--- a/backend/src/ee/routes/v1/pam-routers/pam-account-template-router.ts
+++ b/backend/src/ee/routes/v1/pam-routers/pam-account-template-router.ts
@@ -9,6 +9,7 @@ import {
} from "@app/ee/services/pam-account-template/pam-account-template-schemas";
import { ApiDocsTags } from "@app/lib/api-docs/constants";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
+import { slugSchema } from "@app/server/lib/schemas";
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
@@ -102,7 +103,7 @@ export const registerPamAccountTemplateRouter = async (server: FastifyZodProvide
description: "Create a new PAM account template",
tags: [ApiDocsTags.PamAccountTemplates],
body: z.object({
- name: z.string().trim().min(1).max(64).describe("Display name for the template"),
+ name: slugSchema({ field: "Name" }).describe("Name for the template"),
description: z.string().trim().max(256).optional().describe("Optional description"),
type: z.nativeEnum(PamAccountType).describe("The account type this template applies to"),
accessPolicy: PamTemplateAccessPolicySchema.optional().describe("Access policy configuration"),
@@ -167,7 +168,7 @@ export const registerPamAccountTemplateRouter = async (server: FastifyZodProvide
templateId: z.string().uuid().describe("The ID of the template")
}),
body: z.object({
- name: z.string().trim().min(1).max(64).optional().describe("New display name"),
+ name: slugSchema({ field: "Name" }).optional().describe("New name"),
description: z.string().trim().max(256).nullable().optional().describe("New description"),
accessPolicy: PamTemplateAccessPolicySchema.optional().describe("Updated access policy"),
settings: PamTemplateSettingsSchema.optional().describe("Updated settings"),
diff --git a/backend/src/ee/routes/v1/pam-routers/pam-folder-router.ts b/backend/src/ee/routes/v1/pam-routers/pam-folder-router.ts
index 5f958202fc..f41395a79f 100644
--- a/backend/src/ee/routes/v1/pam-routers/pam-folder-router.ts
+++ b/backend/src/ee/routes/v1/pam-routers/pam-folder-router.ts
@@ -3,6 +3,7 @@ import z from "zod";
import { PamFoldersSchema } from "@app/db/schemas";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags } from "@app/lib/api-docs/constants";
+import { slugSchema } from "@app/server/lib/schemas";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
@@ -95,7 +96,7 @@ export const registerPamFolderRouter = async (server: FastifyZodProvider) => {
description: "Create a new PAM folder",
tags: [ApiDocsTags.PamFolders],
body: z.object({
- name: z.string().trim().min(1).max(64).describe("Display name for the folder"),
+ name: slugSchema({ field: "Name" }).describe("Name for the folder"),
description: z.string().trim().max(256).optional().describe("Optional description")
}),
response: {
@@ -153,7 +154,7 @@ export const registerPamFolderRouter = async (server: FastifyZodProvider) => {
folderId: z.string().uuid().describe("The ID of the folder")
}),
body: z.object({
- name: z.string().trim().min(1).max(64).optional().describe("New display name"),
+ name: slugSchema({ field: "Name" }).optional().describe("New name"),
description: z.string().trim().max(256).nullable().optional().describe("New description")
}),
response: {