fix: correct secret reference validation check to permit referencing the same secret multiple times and improve error message

This commit is contained in:
Scott Wilson
2024-11-11 13:17:25 -08:00
parent 0e946f73bd
commit 8cfcbaa12c
@@ -150,9 +150,9 @@ export const secretV2BridgeServiceFactory = ({
} }
}); });
if (referredSecrets.length !== references.length) if (new Set(referredSecrets.map((sec) => sec.key)).size !== new Set(references.map((sec) => sec.secretKey)).size)
throw new BadRequestError({ throw new BadRequestError({
message: `Referenced secret not found. Found only ${diff( message: `Referenced secret(s) not found: ${diff(
references.map((el) => el.secretKey), references.map((el) => el.secretKey),
referredSecrets.map((el) => el.key) referredSecrets.map((el) => el.key)
).join(",")}` ).join(",")}`