Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
misc: fix error with multiple tags
Sheen Capadngan1003b008eeff
diff --git a/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts b/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.tsindex 2a588f9a12..f9ab8eb929 100644--- a/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts+++ b/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts@@ -1662,7 +1662,7 @@ export const secretV2BridgeServiceFactory = ({await scanSecretPolicyViolations(projectId, secretPath, inputSecrets, project.secretDetectionIgnoreValues || []);// get all tags- const sanitizedTagIds = inputSecrets.flatMap(({ tagIds = [] }) => tagIds);+ const sanitizedTagIds = [...new Set(inputSecrets.flatMap(({ tagIds = [] }) => tagIds))];const tags = sanitizedTagIds.length ? await secretTagDAL.findManyTagsById(projectId, sanitizedTagIds) : [];if (tags.length !== sanitizedTagIds.length)throw new NotFoundError({ message: `Tag not found. Found ${tags.map((el) => el.slug).join(",")}` });@@ -1910,7 +1910,7 @@ export const secretV2BridgeServiceFactory = ({});// get all tags- const sanitizedTagIds = secretsToUpdate.flatMap(({ tagIds = [] }) => tagIds);+ const sanitizedTagIds = [...new Set(secretsToUpdate.flatMap(({ tagIds = [] }) => tagIds))];const tags = sanitizedTagIds.length ? await secretTagDAL.findManyTagsById(projectId, sanitizedTagIds, tx) : [];if (tags.length !== sanitizedTagIds.length) throw new NotFoundError({ message: "Tag not found" });const tagsGroupByID = groupBy(tags, (i) => i.id);