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
feat: added approval handling for metadata in replicate
Sheen Capadngan356e7c5958f6
diff --git a/backend/src/ee/services/secret-replication/secret-replication-service.ts b/backend/src/ee/services/secret-replication/secret-replication-service.tsindex e72f3b4fad..3c25db98c4 100644--- a/backend/src/ee/services/secret-replication/secret-replication-service.ts+++ b/backend/src/ee/services/secret-replication/secret-replication-service.ts@@ -342,13 +342,29 @@ export const secretReplicationServiceFactory = ({.map((el) => ({ ...el, operation: SecretOperations.Create })); // rewrite update ops to createconst locallyUpdatedSecrets = sourceSecrets- .filter(- ({ key, secretKey, secretValue }) =>+ .filter(({ key, secretKey, secretValue, secretMetadata }) => {+ const sourceSecretMetadataJson = JSON.stringify(+ (secretMetadata ?? []).map((entry) => ({+ key: entry.key,+ value: entry.value+ }))+ );++ const destinationSecretMetadataJson = JSON.stringify(+ (destinationLocalSecretsGroupedByKey[key]?.[0]?.secretMetadata ?? []).map((entry) => ({+ key: entry.key,+ value: entry.value+ }))+ );++ return (destinationLocalSecretsGroupedByKey[key]?.[0] &&// if key or value changed(destinationLocalSecretsGroupedByKey[key]?.[0]?.secretKey !== secretKey ||- destinationLocalSecretsGroupedByKey[key]?.[0]?.secretValue !== secretValue)- )+ destinationLocalSecretsGroupedByKey[key]?.[0]?.secretValue !== secretValue ||+ sourceSecretMetadataJson !== destinationSecretMetadataJson)+ );+ }).map((el) => ({ ...el, operation: SecretOperations.Update })); // rewrite update ops to createconst locallyDeletedSecrets = destinationLocalSecrets