fix: handle empty string to allow clearing secret on update

This commit is contained in:
Scott Wilson
2024-11-19 08:16:30 -08:00
parent 61d516ef35
commit b6d8be2105
@@ -414,12 +414,13 @@ export const secretV2BridgeServiceFactory = ({
type: KmsDataKey.SecretManager, type: KmsDataKey.SecretManager,
projectId projectId
}); });
const encryptedValue = secretValue const encryptedValue =
? { typeof secretValue === "string"
encryptedValue: secretManagerEncryptor({ plainText: Buffer.from(secretValue) }).cipherTextBlob, ? {
references: getAllSecretReferences(secretValue).nestedReferences encryptedValue: secretManagerEncryptor({ plainText: Buffer.from(secretValue) }).cipherTextBlob,
} references: getAllSecretReferences(secretValue).nestedReferences
: {}; }
: {};
if (secretValue) { if (secretValue) {
const { nestedReferences, localReferences } = getAllSecretReferences(secretValue); const { nestedReferences, localReferences } = getAllSecretReferences(secretValue);