Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

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.ts
index 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 create
const 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 create
const locallyDeletedSecrets = destinationLocalSecrets