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

libsecret: Keys() unlocks collection first #61

Merged
merged 2 commits into from
Feb 11, 2020
Merged

libsecret: Keys() unlocks collection first #61

merged 2 commits into from
Feb 11, 2020

Conversation

pda
Copy link
Collaborator

@pda pda commented Feb 11, 2020

Fixes 99designs/aws-vault#513

This patch makes secretsKeyring.Keys() unlock a locked collection before getting its items and their labels. Otherwise, it returns a list of empty strings.

I spent quite a while trying to write a test for it, but testing over live D-Bus with locking and caching(?) proved beyond me. Instead I've verified it from ./cmd/keyring:

# build without this patch
go build ./cmd/keyring

# setting keys leaves the collection unlocked
./keyring -service keyringtest -key one -set hello
./keyring -service keyringtest -key two -set world

# Keys() works when the collection is unlocked
./keyring -service keyringtest -list-keys
# two
# one

# Reloading the keyring daemon locks the collections
gnome-keyring-daemon -r -d
# ** Message: 15:11:41.910: Replacing daemon, using directory: /run/user/1000/keyring
# GNOME_KEYRING_CONTROL=/run/user/1000/keyring
# SSH_AUTH_SOCK=/run/user/1000/keyring/ssh

# Keys() returns empty strings
./keyring -service keyringtest -list-keys
#
#

# apply this patch...
go build ./cmd/keyring

# Keys() returns actual strings
./keyring -service keyringtest -list-keys
# one
# two

Otherwise it will return empty strings if the collection is locked.
@pda pda requested a review from mtibben February 11, 2020 04:26
pda referenced this pull request in 99designs/aws-vault Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-vault >= 5.1 fails to open keyring on linux
2 participants