-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
get_credential(service, None) does not find anything after deleting one of two usernames #664
Comments
At first blush, it looks like it's a bug... and probably has to do with the way that Windows doesn't support per-user credentials so keyring hacks it by creating "compound names" when the user names conflict for a given service. After the first set_password, the credential store looks like:
Then adding the second credential causes the first entry to get the username prepended:
At this stage, it's possible to get the most recent credential using just the system name, but without the username, it's not possible to get
It's no longer possible to query simply for When retrieving a credential, the following logic is used: keyring/keyring/backends/Windows.py Lines 163 to 169 in 3727268
See #47 for the motivation for this approach. I can't imagine a way for keyring to locate the compound name without being given the original username unless there were some way to enumerate all credentials. In #555, there was an attempt to implement some changes that would expose enumerating all credentials. If we had that capability, we could potentially scan all credentials for those where the username matches the I think we may be stuck with assuming that if the user is storing multiple passwords for the same system that they must always supply the username to retrieve them (and maybe document that expectation). I'm open to other ideas. |
To me the most straightforward path is to create an escape hatch by enabling an option like In my use cases, I much prefer the consistency that if I call We’d need to keep Thoughts? |
I can see a couple of different solutions, though I should stress that I don't know much about either this app or Windows credential manager - so feel free to ignore anything I write.
|
on Windows 10, using the default backend:
This returns
user-2 pwd-2
. So far, so good.Here, the first output is
user-1 pwd-1
, showing that the first credential is still there.However, the second output
None
, i.e. the credential is not found without a username.Is this a bug, or an expected behaviour?
The text was updated successfully, but these errors were encountered: