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
Block duplicate destinations on updates if flag is enabled
Carlos Monastyrskid860c5380b16
diff --git a/backend/src/services/secret-sync/secret-sync-service.ts b/backend/src/services/secret-sync/secret-sync-service.tsindex b3eb05369d..a4e2fc4670 100644--- a/backend/src/services/secret-sync/secret-sync-service.ts+++ b/backend/src/services/secret-sync/secret-sync-service.ts@@ -454,6 +454,33 @@ export const secretSyncServiceFactory = ({let { folderId } = secretSync;+ if (params.destinationConfig) {+ const project = await projectDAL.findById(secretSync.projectId);+ if (!project) {+ throw new NotFoundError({ message: "Project not found" });+ }+ const organization = await orgDAL.findById(project.orgId);++ if (organization?.blockDuplicateSecretSyncDestinations) {+ const duplicateCheck = await checkDuplicateDestination(+ {+ destination,+ destinationConfig: params.destinationConfig,+ projectId: secretSync.projectId,+ excludeSyncId: secretSync.id+ },+ actor+ );+ if (duplicateCheck.hasDuplicate) {+ throw new BadRequestError({+ message: `A secret sync with this destination already exists${+ duplicateCheck.duplicateProjectId ? ` in project ${duplicateCheck.duplicateProjectId}` : ""+ }.`+ });+ }+ }+ }+if (params.connectionId) {const destinationApp = SECRET_SYNC_CONNECTION_MAP[secretSync.destination as SecretSync];