diff --git a/internal/app/app.go b/internal/app/app.go index b082d5b2..1d3cd246 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -236,7 +236,7 @@ func run(c *cli.Context) error { return withSingleInstance(settings, locations.GetLockFile(), version, func() error { // Look for available keychains - return WithKeychainList(func(keychains *keychain.List) error { + return WithKeychainList(crashHandler, func(keychains *keychain.List) error { // Unlock the encrypted vault. return WithVault(locations, keychains, crashHandler, func(v *vault.Vault, insecure, corrupt bool) error { if !v.Migrated() { @@ -482,9 +482,10 @@ func withCookieJar(vault *vault.Vault, fn func(http.CookieJar) error) error { } // WithKeychainList init the list of usable keychains. -func WithKeychainList(fn func(*keychain.List) error) error { +func WithKeychainList(panicHandler async.PanicHandler, fn func(*keychain.List) error) error { logrus.Debug("Creating keychain list") defer logrus.Debug("Keychain list stop") + defer async.HandlePanic(panicHandler) return fn(keychain.NewList()) } diff --git a/pkg/keychain/helper_darwin.go b/pkg/keychain/helper_darwin.go index ee21675d..1cba6de5 100644 --- a/pkg/keychain/helper_darwin.go +++ b/pkg/keychain/helper_darwin.go @@ -37,8 +37,9 @@ func listHelpers() (Helpers, string) { // MacOS always provides a keychain. if isUsable(newMacOSHelper("")) { helpers[MacOSKeychain] = newMacOSHelper + logrus.WithField("keychain", "MacOSKeychain").Info("Keychain is usable.") } else { - logrus.WithField("keychain", "MacOSKeychain").Warn("Keychain is not available.") + logrus.WithField("keychain", "MacOSKeychain").Debug("Keychain is not available.") } // Use MacOSKeychain by default. diff --git a/pkg/keychain/helper_linux.go b/pkg/keychain/helper_linux.go index 1ab288e9..ef21ec1d 100644 --- a/pkg/keychain/helper_linux.go +++ b/pkg/keychain/helper_linux.go @@ -36,20 +36,23 @@ func listHelpers() (Helpers, string) { if isUsable(newDBusHelper("")) { helpers[SecretServiceDBus] = newDBusHelper + logrus.WithField("keychain", "SecretServiceDBus").Info("Keychain is usable.") } else { - logrus.WithField("keychain", "SecretServiceDBus").Warn("Keychain is not available.") + logrus.WithField("keychain", "SecretServiceDBus").Debug("Keychain is not available.") } if _, err := execabs.LookPath("gnome-keyring"); err == nil && isUsable(newSecretServiceHelper("")) { helpers[SecretService] = newSecretServiceHelper + logrus.WithField("keychain", "SecretService").Info("Keychain is usable.") } else { - logrus.WithField("keychain", "SecretService").Warn("Keychain is not available.") + logrus.WithField("keychain", "SecretService").Debug("Keychain is not available.") } if _, err := execabs.LookPath("pass"); err == nil && isUsable(newPassHelper("")) { helpers[Pass] = newPassHelper + logrus.WithField("keychain", "Pass").Info("Keychain is usable.") } else { - logrus.WithField("keychain", "Pass").Warn("Keychain is not available.") + logrus.WithField("keychain", "Pass").Debug("Keychain is not available.") } defaultHelper := SecretServiceDBus diff --git a/pkg/keychain/helper_windows.go b/pkg/keychain/helper_windows.go index 718b42f1..e2658c86 100644 --- a/pkg/keychain/helper_windows.go +++ b/pkg/keychain/helper_windows.go @@ -30,8 +30,9 @@ func listHelpers() (Helpers, string) { // Windows always provides a keychain. if isUsable(newWinCredHelper("")) { helpers[WindowsCredentials] = newWinCredHelper + logrus.WithField("keychain", "WindowsCredentials").Info("Keychain is usable.") } else { - logrus.WithField("keychain", "WindowsCredentials").Warn("Keychain is not available.") + logrus.WithField("keychain", "WindowsCredentials").Debug("Keychain is not available.") } // Use WindowsCredentials by default. return helpers, WindowsCredentials diff --git a/utils/vault-editor/main.go b/utils/vault-editor/main.go index fd241461..0ac44ced 100644 --- a/utils/vault-editor/main.go +++ b/utils/vault-editor/main.go @@ -51,7 +51,7 @@ func main() { func readAction(c *cli.Context) error { return app.WithLocations(func(locations *locations.Locations) error { - return app.WithKeychainList(func(keychains *keychain.List) error { + return app.WithKeychainList(async.NoopPanicHandler{}, func(keychains *keychain.List) error { return app.WithVault(locations, keychains, async.NoopPanicHandler{}, func(vault *vault.Vault, insecure, corrupt bool) error { if _, err := os.Stdout.Write(vault.ExportJSON()); err != nil { return fmt.Errorf("failed to write vault: %w", err) @@ -65,7 +65,7 @@ func readAction(c *cli.Context) error { func writeAction(c *cli.Context) error { return app.WithLocations(func(locations *locations.Locations) error { - return app.WithKeychainList(func(keychains *keychain.List) error { + return app.WithKeychainList(async.NoopPanicHandler{}, func(keychains *keychain.List) error { return app.WithVault(locations, keychains, async.NoopPanicHandler{}, func(vault *vault.Vault, insecure, corrupt bool) error { b, err := io.ReadAll(os.Stdin) if err != nil {