Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check for keychain permission denied error and bail #14134

Merged
merged 5 commits into from Oct 8, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion go/libkb/secret_store.go
Expand Up @@ -4,8 +4,9 @@
package libkb

import (
keybase1 "github.com/keybase/client/go/protocol/keybase1"
"sync"

keybase1 "github.com/keybase/client/go/protocol/keybase1"
)

type SecretRetriever interface {
Expand Down Expand Up @@ -51,6 +52,7 @@ func (s *SecretStoreImp) RetrieveSecret(m MetaContext) (LKSecFullSecret, error)
}
sec, err := s.store.RetrieveSecret(m, s.username)
if err != nil {
MobileKeychainPermissionDeniedCheck(m.G(), err)
return sec, err
}
s.secret = sec
Expand Down
13 changes: 13 additions & 0 deletions go/libkb/util.go
Expand Up @@ -27,6 +27,8 @@ import (
"time"
"unicode"

"github.com/keybase/go-keychain"

"github.com/keybase/client/go/kbcrypto"
"github.com/keybase/client/go/logger"
"github.com/keybase/client/go/profiling"
Expand Down Expand Up @@ -786,6 +788,17 @@ func MobilePermissionDeniedCheck(g *GlobalContext, err error, msg string) {
os.Exit(4)
}

func MobileKeychainPermissionDeniedCheck(g *GlobalContext, err error) {
if !isIOS || g.GetAppType() != MobileAppType {
return
}
if err != keychain.ErrorInteractionNotAllowed {
return
}
g.Log.Warning("keychain permission denied on mobile: %s", err)
os.Exit(4)
}

// IsNoSpaceOnDeviceError will return true if err is an `os` error
// for "no space left on device".
func IsNoSpaceOnDeviceError(err error) bool {
Expand Down