From 5cc498dc6206c6b3e73f310c4345ac61944d2ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sun, 3 Mar 2024 01:21:17 +0100 Subject: [PATCH 1/2] Properly forward errors when log in is cancelled with client secret --- agent/actions/login.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/agent/actions/login.go b/agent/actions/login.go index 1109b06..92134a7 100644 --- a/agent/actions/login.go +++ b/agent/actions/login.go @@ -34,7 +34,8 @@ func handleLogin(msg messages.IPCMessage, cfg *config.Config, vault *vault.Vault var masterKey crypto.MasterKey var masterpasswordHash string - if secret, err := cfg.GetClientSecret(); err == nil && secret != "" { + var secret string // don't shadow err in the next line + if secret, err = cfg.GetClientSecret(); err == nil && secret != "" { actionsLog.Info("Logging in with client secret") token, masterKey, masterpasswordHash, err = bitwarden.LoginWithApiKey(ctx, req.Email, cfg, vault) } else if req.Passwordless { From 886b7f66c33bf7aa64534bac24084127d8d37644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sun, 3 Mar 2024 01:38:27 +0100 Subject: [PATCH 2/2] Fix error string formatting --- agent/vault/vault.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/vault/vault.go b/agent/vault/vault.go index c0548e6..7dccc4b 100644 --- a/agent/vault/vault.go +++ b/agent/vault/vault.go @@ -149,9 +149,9 @@ func (vault *Vault) isSSHKey(cipher models.Cipher) bool { cipherID := cipher.ID.String() if cipher.OrganizationID != nil { orgID := cipher.OrganizationID.String() - vaultLog.Error("Failed to decrypt field name with on cipher "+cipherID+" in organization "+orgID, err.Error()) + vaultLog.Error("Failed to decrypt field name with on cipher %s in organization %s: %s", cipherID, orgID, err.Error()) } else { - vaultLog.Error("Failed to decrypt field name with on cipher "+cipherID, err.Error()) + vaultLog.Error("Failed to decrypt field name with on cipher %s: %s", cipherID, err.Error()) } continue }