Skip to content

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

validate schema with slugName

Matheus Nogueiraf5b84ad47225
diff --git a/backend/src/ee/services/honey-token/honey-token-types.ts b/backend/src/ee/services/honey-token/honey-token-types.ts
index bd67f30520..ead1df624a 100644
--- a/backend/src/ee/services/honey-token/honey-token-types.ts
+++ b/backend/src/ee/services/honey-token/honey-token-types.ts
@@ -3,6 +3,7 @@ import { z } from "zod";
import { isValidAwsRegion } from "@app/lib/aws/region";
import { HoneyTokenEventType, HoneyTokenType } from "./honey-token-enums";
+import { slugSchema } from "@app/server/lib/schemas";
export const AwsHoneyTokenEventMetadataSchema = z.object({
accessKeyId: z.string(),
@@ -38,14 +39,7 @@ export const AwsHoneyTokenConfigSchema = z.object({
.string()
.min(1)
.regex(/^[a-fA-F0-9]+$/, "Signing key must be a hex string"),
- stackName: z
- .string()
- .min(1)
- .max(128)
- .regex(
- /^[a-zA-Z][a-zA-Z0-9-]*$/,
- "Stack name must start with a letter and contain only letters, numbers, and hyphens"
- )
+ stackName: slugSchema({max: 64, field: 'stackName'})
.default("infisical-honey-tokens"),
awsRegion: z
.string()
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/HoneyTokenModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/HoneyTokenModal.tsx
index 3008f097b3..856577e1a6 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/HoneyTokenModal.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/HoneyTokenModal.tsx
@@ -36,6 +36,7 @@ import {
useTestHoneyTokenConnection,
useUpsertHoneyTokenConfig
} from "@app/hooks/api/honeyToken";
+import { slugSchema } from "@app/lib/schemas";
const CF_TEMPLATE_URL =
"https://infisical-static-assets.s3.us-east-1.amazonaws.com/honey-tokens/honey-tokens-v1.yaml";
@@ -54,15 +55,7 @@ const schema = z.object({
.string()
.min(1, "Webhook Signing Key is required")
.regex(/^[a-fA-F0-9]+$/, "Signing key must be a hex string"),
- stackName: z
- .string()
- .trim()
- .min(1, "Stack name is required")
- .max(128)
- .regex(
- /^[a-zA-Z][a-zA-Z0-9-]*$/,
- "Stack name must start with a letter and contain only letters, numbers, and hyphens"
- ),
+ stackName: slugSchema({max: 128, field: 'stackName'}),
awsRegion: z
.string()
.trim()