Merge pull request #4939 from Infisical/fix/duplicate-secrets-deletion

fix: default duplicate secret deletion
This commit is contained in:
Piyush Gupta
2025-11-27 22:19:09 +05:30
committed by GitHub
3 changed files with 5 additions and 8 deletions
@@ -421,11 +421,12 @@ export const fnSecretBulkDelete = async ({
); );
const changes = deletedSecrets const changes = deletedSecrets
.filter(({ type }) => type === SecretType.Shared) .filter(({ type, id }) => type === SecretType.Shared && secretVersions[id])
.map(({ id }) => ({ .map(({ id }) => ({
type: CommitType.DELETE, type: CommitType.DELETE,
secretVersionId: secretVersions[id].id secretVersionId: secretVersions[id]?.id
})); }));
if (changes.length > 0) { if (changes.length > 0) {
if (commitChanges) { if (commitChanges) {
commitChanges.push(...changes); commitChanges.push(...changes);
@@ -2254,7 +2254,8 @@ export const secretV2BridgeServiceFactory = ({
] ]
} }
}); });
if (secretsToDelete.length !== inputSecrets.length) const secretsToDeleteSet = new Set(secretsToDelete.map((el) => el.key));
if (secretsToDeleteSet.size !== inputSecrets.length)
throw new NotFoundError({ throw new NotFoundError({
message: `One or more secrets does not exist: ${secretsToDelete.map((el) => el.key).join(", ")}` message: `One or more secrets does not exist: ${secretsToDelete.map((el) => el.key).join(", ")}`
}); });
-5
View File
@@ -14,11 +14,6 @@ const secretsToBeAdded = [
secretValue: "OVERRIDE_THIS", secretValue: "OVERRIDE_THIS",
secretComment: "Override secrets with personal value" secretComment: "Override secrets with personal value"
}, },
{
secretKey: "DB_PASSWORD",
secretValue: "OVERRIDE_THIS",
secretComment: "Another secret override"
},
{ {
secretKey: "DB_PASSWORD", secretKey: "DB_PASSWORD",
secretValue: "example_password" secretValue: "example_password"