mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 12:27:31 +00:00
RE2 for regex + input limits
This commit is contained in:
@@ -16,12 +16,14 @@ const HCVaultSyncDestinationConfigSchema = z.object({
|
|||||||
.string()
|
.string()
|
||||||
.trim()
|
.trim()
|
||||||
.min(1, "Secrets Engine Mount required")
|
.min(1, "Secrets Engine Mount required")
|
||||||
|
.max(128)
|
||||||
.describe(SecretSyncs.DESTINATION_CONFIG.HC_VAULT.mount),
|
.describe(SecretSyncs.DESTINATION_CONFIG.HC_VAULT.mount),
|
||||||
path: z
|
path: z
|
||||||
.string()
|
.string()
|
||||||
.trim()
|
.trim()
|
||||||
.min(1, "Path required")
|
.min(1, "Path required")
|
||||||
.transform((val) => val.replace(/^\/+|\/+$/g, "")) // removes leading/trailing slashes
|
.max(128)
|
||||||
|
.transform((val) => new RE2("^/+|/+$", "g").replace(val, "")) // removes leading/trailing slashes
|
||||||
.refine((val) => new RE2("^([a-zA-Z0-9._-]+/)*[a-zA-Z0-9._-]+$").test(val), {
|
.refine((val) => new RE2("^([a-zA-Z0-9._-]+/)*[a-zA-Z0-9._-]+$").test(val), {
|
||||||
message:
|
message:
|
||||||
"Invalid Vault path format. Use alphanumerics, dots, dashes, underscores, and single slashes between segments."
|
"Invalid Vault path format. Use alphanumerics, dots, dashes, underscores, and single slashes between segments."
|
||||||
|
|||||||
Reference in New Issue
Block a user