Open voidus opened 1 year ago
test get
-> err, org.freedesktop.Secret.Error.IsLocked
./test set
-> password is saved, but application freezes
./test get
-> err, org.freedesktop.Secret.Error.IsLocked
./test set
-> I get a keepassxc popup asking if test
is allowed to access.
I click "Allow" -> freeze
For comparison, secret-tool lookup service gh:github.com username foo
prints aloha!
after
I click "Accept" in the keepassxc popup.
expected.
@voidus Thanks for all the detailed info. I am the maintainer of GitHub CLI and I'm also wondering about the freezes and slow credential lookups that some of our users were experiencing (typically either under Windows proper or under WSL2). Do you have an idea of what the go-keyring could improve or change to avoid these types of hangs?
Also would love to hear any thoughts on this
I'm not sure, but I assume that either keepassxc or go-keyring aren't fully compliant with the spec. If someone has time, they could read into it and look at the dbus monitor output for anything amiss.
I have a feeling that nobody here knows enough about the spec, maybe we could ask this in a forum or reddit or twitter bubble where there is a chance to find people who could help?
FYI I get a similar issue using Supersonic (which uses go-keyring) while using KeepassXC as my secret service. It works the first time I connect, but if I quit the application and re-open it, after I put in my credentials, the application basically hangs, and I get the following error in the application logs:
error getting password from keyring: org.freedesktop.Secret.Error.IsLocked
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x5e33a2]
goroutine 79 [running]:
github.com/zalando/go-keyring/secret_service.(*SecretService).handlePrompt(0xc0091ef050, {0xc000462380?, 0x2c?})
github.com/zalando/go-keyring@v0.2.1/secret_service/secret_service.go:197 +0x122
github.com/zalando/go-keyring/secret_service.(*SecretService).CreateItem(0xd69990?, {0xe6cdb0, 0xc0089842d0}, {0xc009084780, 0x43}, 0xc00a337620, {{0xc008e7d1d0, 0x41}, {0x1b1af00, 0x0, ...}, ...})
github.com/zalando/go-keyring@v0.2.1/secret_service/secret_service.go:175 +0x370
github.com/zalando/go-keyring.secretServiceProvider.Set({}, {0xd1127f, 0xa}, {0xc0089b61b0, 0x24}, {0xc008402c80, 0x40})
github.com/zalando/go-keyring@v0.2.1/keyring_unix.go:43 +0x3be
github.com/zalando/go-keyring.Set(...)
github.com/zalando/go-keyring@v0.2.1/keyring.go:27
[...]
This seems to be resolved with KeePassXC - Version 2.7.9 and gh version 2.49.2 (which uses go-keyring v0.2.4)
Anybody seeing something similar?
Heya :wave:
I was checking out gh (the github cli) and it got stuck after running
gh auth login
. So I dug a little and localized the issue in the interaction between this library and keepassxc, which I use as a keyring.As far as I can tell, both this library and keepassxc are weird with the secret service protocol, so I'll cross-post it to their issue tracker.
While playring around, I've encountered unhandled errors and freeze.
Not sure about the freezes, but the secret service api spec this regarding IsLocked:
gh auth login
freezes instead of exiting, but it does get a new token from github and saves it. It doesn't seem to apply, but as far as I can tell, that's because it fails to read the secret from the store. (Which arguably should be reported to the user, but it should also work.)dbus-monitor, with messages not containing org.freedesktop.Secret removed
``` # 1.241 is gh method call time=1681678963.125907 sender=:1.241 -> destination=org.freedesktop.secrets serial=2 path=/org/freedesktop/secrets; interface=org.freedesktop.DBus.Properties; member=Get string "org.freedesktop.Secret.Service" string "Collections" method return time=1681678963.130388 sender=:1.28 -> destination=:1.241 serial=1575 reply_serial=2 variant array [ object path "/org/freedesktop/secrets/collection/passwords" ] method call time=1681678963.130985 sender=:1.241 -> destination=org.freedesktop.secrets serial=3 path=/org/freedesktop/secrets; interface=org.freedesktop.Secret.Service; member=Unlock array [ object path "/org/freedesktop/secrets/aliases/default" ] method return time=1681678963.131601 sender=:1.28 -> destination=:1.241 serial=1576 reply_serial=3 array [ object path "/org/freedesktop/secrets/collection/passwords" ] object path "/" method call time=1681678963.132177 sender=:1.241 -> destination=org.freedesktop.secrets serial=4 path=/org/freedesktop/secrets/aliases/default; interface=org.freedesktop.Secret.Collection; member=SearchItems array [ dict entry( string "username" string "" ) dict entry( string "service" string "gh:github.com" ) ] method return time=1681678963.133262 sender=:1.28 -> destination=:1.241 serial=1577 reply_serial=4 array [ object path "/org/freedesktop/secrets/collection/passwords/d72fb5ce71ea4196835b86ff53826c9b" ] method call time=1681678963.133718 sender=:1.241 -> destination=org.freedesktop.secrets serial=5 path=/org/freedesktop/secrets; interface=org.freedesktop.Secret.Service; member=OpenSession string "plain" variant string "" method return time=1681678963.134195 sender=:1.28 -> destination=:1.241 serial=1578 reply_serial=5 variant string "" object path "/org/freedesktop/secrets/session/f4c480f8b9e64673ae53238eee74a4d6" method call time=1681678963.134689 sender=:1.241 -> destination=org.freedesktop.secrets serial=6 path=/org/freedesktop/secrets/collection/passwords/d72fb5ce71ea4196835b86ff53826c9b; interface=org.freedesktop.Secret.Item; member=GetSecret object path "/org/freedesktop/secrets/session/f4c480f8b9e64673ae53238eee74a4d6" error time=1681678963.135092 sender=:1.28 -> destination=:1.241 error_name=org.freedesktop.Secret.Error.IsLocked reply_serial=6 method call time=1681678963.135611 sender=:1.241 -> destination=org.freedesktop.secrets serial=7 path=/org/freedesktop/secrets/session/f4c480f8b9e64673ae53238eee74a4d6; interface=org.freedesktop.Secret.Session; member=Close method return time=1681678963.136162 sender=:1.28 -> destination=:1.241 serial=1580 reply_serial=7 method call time=1681678963.136718 sender=:1.241 -> destination=org.freedesktop.secrets serial=8 path=/org/freedesktop/secrets; interface=org.freedesktop.DBus.Properties; member=Get string "org.freedesktop.Secret.Service" string "Collections" method return time=1681678963.137231 sender=:1.28 -> destination=:1.241 serial=1581 reply_serial=8 variant array [ object path "/org/freedesktop/secrets/collection/passwords" ] method call time=1681678963.137773 sender=:1.241 -> destination=org.freedesktop.secrets serial=9 path=/org/freedesktop/secrets; interface=org.freedesktop.Secret.Service; member=Unlock array [ object path "/org/freedesktop/secrets/aliases/default" ] method return time=1681678963.138249 sender=:1.28 -> destination=:1.241 serial=1582 reply_serial=9 array [ object path "/org/freedesktop/secrets/collection/passwords" ] object path "/" method call time=1681678963.138731 sender=:1.241 -> destination=org.freedesktop.secrets serial=10 path=/org/freedesktop/secrets/aliases/default; interface=org.freedesktop.Secret.Collection; member=SearchItems array [ dict entry( string "service" string "gh:github.com" ) dict entry( string "username" string "" ) ] method return time=1681678963.139639 sender=:1.28 -> destination=:1.241 serial=1583 reply_serial=10 array [ object path "/org/freedesktop/secrets/collection/passwords/d72fb5ce71ea4196835b86ff53826c9b" ] method call time=1681678963.140248 sender=:1.241 -> destination=org.freedesktop.secrets serial=11 path=/org/freedesktop/secrets; interface=org.freedesktop.Secret.Service; member=OpenSession string "plain" variant string "" method return time=1681678963.140984 sender=:1.28 -> destination=:1.241 serial=1584 reply_serial=11 variant string "" object path "/org/freedesktop/secrets/session/3754810ae21f448091efecb69caf0fa5" method call time=1681678963.141441 sender=:1.241 -> destination=org.freedesktop.secrets serial=12 path=/org/freedesktop/secrets/collection/passwords/d72fb5ce71ea4196835b86ff53826c9b; interface=org.freedesktop.Secret.Item; member=GetSecret object path "/org/freedesktop/secrets/session/3754810ae21f448091efecb69caf0fa5" error time=1681678963.142054 sender=:1.28 -> destination=:1.241 error_name=org.freedesktop.Secret.Error.IsLocked reply_serial=12 method call time=1681678963.142504 sender=:1.241 -> destination=org.freedesktop.secrets serial=13 path=/org/freedesktop/secrets/session/3754810ae21f448091efecb69caf0fa5; interface=org.freedesktop.Secret.Session; member=Close method return time=1681678963.142976 sender=:1.28 -> destination=:1.241 serial=1586 reply_serial=13 ```Tests
Here's my test tool:
These have a single password file opened and unlocked
Actual test cases have to go in comments because of github length restrictions :panda_face:
Versions and stuff
Go stuff:
Keepassxc debug output:
dbus-daemon is
1.14.6
, just in case. Generally, I'm on arch linux with a lot of stuff, including keepassxc, gh and go, pulled in via nix and home-manager