mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 16:27:46 +00:00
added RE2 to regex
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import RE2 from "re2";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import { SecretSyncs } from "@app/lib/api-docs";
|
import { SecretSyncs } from "@app/lib/api-docs";
|
||||||
@@ -15,8 +16,8 @@ const OCIVaultSyncDestinationConfigSchema = z.object({
|
|||||||
.string()
|
.string()
|
||||||
.trim()
|
.trim()
|
||||||
.min(1, "Compartment OCID required")
|
.min(1, "Compartment OCID required")
|
||||||
.regex(
|
.refine(
|
||||||
/^ocid1\.(tenancy|compartment)\.oc1\..+$/,
|
(val) => new RE2("^ocid1\\.(tenancy|compartment)\\.oc1\\..+$").test(val),
|
||||||
"Invalid Compartment OCID format. Must start with ocid1.tenancy.oc1. or ocid1.compartment.oc1."
|
"Invalid Compartment OCID format. Must start with ocid1.tenancy.oc1. or ocid1.compartment.oc1."
|
||||||
)
|
)
|
||||||
.describe(SecretSyncs.DESTINATION_CONFIG.OCI_VAULT.compartmentOcid),
|
.describe(SecretSyncs.DESTINATION_CONFIG.OCI_VAULT.compartmentOcid),
|
||||||
@@ -24,13 +25,19 @@ const OCIVaultSyncDestinationConfigSchema = z.object({
|
|||||||
.string()
|
.string()
|
||||||
.trim()
|
.trim()
|
||||||
.min(1, "Vault OCID required")
|
.min(1, "Vault OCID required")
|
||||||
.regex(/^ocid1\.vault\.oc1\..+$/, "Invalid Vault OCID format. Must start with ocid1.vault.oc1.")
|
.refine(
|
||||||
|
(val) => new RE2("^ocid1\\.vault\\.oc1\\..+$").test(val),
|
||||||
|
"Invalid Vault OCID format. Must start with ocid1.vault.oc1."
|
||||||
|
)
|
||||||
.describe(SecretSyncs.DESTINATION_CONFIG.OCI_VAULT.vaultOcid),
|
.describe(SecretSyncs.DESTINATION_CONFIG.OCI_VAULT.vaultOcid),
|
||||||
keyOcid: z
|
keyOcid: z
|
||||||
.string()
|
.string()
|
||||||
.trim()
|
.trim()
|
||||||
.min(1, "Key OCID required")
|
.min(1, "Key OCID required")
|
||||||
.regex(/^ocid1\.key\.oc1\..+$/, "Invalid Key OCID format. Must start with ocid1.key.oc1.")
|
.refine(
|
||||||
|
(val) => new RE2("^ocid1\\.key\\.oc1\\..+$").test(val),
|
||||||
|
"Invalid Key OCID format. Must start with ocid1.key.oc1."
|
||||||
|
)
|
||||||
.describe(SecretSyncs.DESTINATION_CONFIG.OCI_VAULT.keyOcid)
|
.describe(SecretSyncs.DESTINATION_CONFIG.OCI_VAULT.keyOcid)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user