Skip to content

Commit

Permalink
[CLI-2969] Prevent double decryption on Windows (#2966)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgagniere authored Dec 9, 2024
1 parent 9bd4089 commit 4c8123a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/config/api_key_pair.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package config

import (
"runtime"
"strings"

"github.com/confluentinc/cli/v4/pkg/secret"
Expand All @@ -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
Expand Down

0 comments on commit 4c8123a

Please sign in to comment.