From 4c8123a3c08298c8783f55fac0e9f85c5dccaddf Mon Sep 17 00:00:00 2001 From: Steven Gagniere <108363707+sgagniere@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:50:50 -0800 Subject: [PATCH] [CLI-2969] Prevent double decryption on Windows (#2966) --- pkg/config/api_key_pair.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/config/api_key_pair.go b/pkg/config/api_key_pair.go index ee4b1ca2ec..f81ac294e2 100644 --- a/pkg/config/api_key_pair.go +++ b/pkg/config/api_key_pair.go @@ -1,7 +1,6 @@ package config import ( - "runtime" "strings" "github.com/confluentinc/cli/v4/pkg/secret" @@ -16,7 +15,7 @@ type APIKeyPair struct { } func (c *APIKeyPair) DecryptSecret() error { - if (strings.HasPrefix(c.Secret, secret.AesGcm) && c.Salt != nil) || runtime.GOOS == "windows" { + if (strings.HasPrefix(c.Secret, secret.AesGcm) && c.Salt != nil) || strings.HasPrefix(c.Secret, secret.Dpapi) { decryptedSecret, err := secret.Decrypt(c.Key, c.Secret, c.Salt, c.Nonce) if err != nil { return err