Skip to content

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

Revert "Patch CLI auto select file vault "

Maidul Islamd91fb0db0277
diff --git a/cli/packages/util/keyringwrapper.go b/cli/packages/util/keyringwrapper.go
index 4ca5ae98d1..0652719065 100644
--- a/cli/packages/util/keyringwrapper.go
+++ b/cli/packages/util/keyringwrapper.go
@@ -32,16 +32,18 @@ func SetValueInKeyring(key, value string) error {
configFile, _ := GetConfigFile()
if configFile.VaultBackendPassphrase == "" {
+ PrintWarning("System keyring could not be used, falling back to `file` vault for sensitive data storage.")
passphrasePrompt := promptui.Prompt{
- Label: "Enter a passphrase to encrypt sensitive CLI data at rest",
+ Label: "Enter the passphrase to use for keyring encryption",
}
passphrase, err := passphrasePrompt.Run()
if err != nil {
return err
}
+
encodedPassphrase := base64.StdEncoding.EncodeToString([]byte(passphrase))
configFile.VaultBackendPassphrase = encodedPassphrase
- configFile.VaultBackendType = VAULT_BACKEND_FILE_MODE
+ err = WriteConfigFile(&configFile)
if err != nil {
return err
}
@@ -63,7 +65,12 @@ func GetValueInKeyring(key string) (string, error) {
PrintErrorAndExit(1, err, "Unable to get current vault. Tip: run [infisical reset] then try again")
}
- return keyring.Get(currentVaultBackend, MAIN_KEYRING_SERVICE, key)
+ value, err := keyring.Get(currentVaultBackend, MAIN_KEYRING_SERVICE, key)
+
+ if err != nil {
+ value, err = keyring.Get(VAULT_BACKEND_FILE_MODE, MAIN_KEYRING_SERVICE, key)
+ }
+ return value, err
}
@@ -73,6 +80,11 @@ func DeleteValueInKeyring(key string) error {
return err
}
- return keyring.Delete(currentVaultBackend, MAIN_KEYRING_SERVICE, key)
+ err = keyring.Delete(currentVaultBackend, MAIN_KEYRING_SERVICE, key)
+ if err != nil {
+ err = keyring.Delete(VAULT_BACKEND_FILE_MODE, MAIN_KEYRING_SERVICE, key)
+ }
+
+ return err
}