review fixes

This commit is contained in:
x
2025-04-24 22:39:20 -04:00
parent c01c58fdcb
commit dd112b3850
6 changed files with 29 additions and 27 deletions
@@ -52,7 +52,7 @@ export const HCVaultSyncFns = {
const variables = await listHCVaultVariables({ instanceUrl, accessToken, mount, path });
let tainted = false;
for await (const entry of Object.entries(secretMap)) {
for (const entry of Object.entries(secretMap)) {
const [key, { value }] = entry;
if (value !== variables[key]) {
variables[key] = value;
@@ -1,3 +1,4 @@
import RE2 from "re2";
import { z } from "zod";
import { SecretSyncs } from "@app/lib/api-docs";
@@ -20,8 +21,8 @@ const HCVaultSyncDestinationConfigSchema = z.object({
.string()
.trim()
.min(1, "Path required")
.transform((val) => val.trim().replace(/^\/+|\/+$/g, "")) // removes leading/trailing slashes
.refine((val) => /^([a-zA-Z0-9._-]+\/)*[a-zA-Z0-9._-]+$/.test(val), {
.transform((val) => val.replace(/^\/+|\/+$/g, "")) // removes leading/trailing slashes
.refine((val) => new RE2("^([a-zA-Z0-9._-]+/)*[a-zA-Z0-9._-]+$").test(val), {
message:
"Invalid Vault path format. Use alphanumerics, dots, dashes, underscores, and single slashes between segments."
})