feat(approval-policies): ensure proper path syntax

This commit is contained in:
x032205
2026-01-06 21:05:44 -05:00
parent 3248aad3ae
commit fe214f21ee
3 changed files with 31 additions and 3 deletions

View File

@@ -22,6 +22,12 @@ export const PamAccessPolicyConditionsSchema = z
.object({
accountPaths: z
.string()
.refine((el) => el.startsWith("/"), {
message: "Path must start with /"
})
.refine((el) => !el.endsWith("/"), {
message: "Path cannot end with /"
})
.refine(
(el) => {
try {
@@ -57,7 +63,14 @@ export const PamAccessPolicyConstraintsSchema = z.object({
// Request Data
export const PamAccessPolicyRequestDataSchema = z.object({
accountPath: z.string(),
accountPath: z
.string()
.refine((el) => el.startsWith("/"), {
message: "Path must start with /"
})
.refine((el) => !el.endsWith("/"), {
message: "Path cannot end with /"
}),
accessDuration: DurationSchema
});