get_credential user doesn't match supplied user
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
Research direction
Start with the Windows.WinVaultKeyring backend and reproduce the issue using the set_password and get_credential calls shown in the report. Trace how a requested username is matched when several credentials share the same service. Done means an incorrect username no longer returns another stored user's credential, with the intended behavior covered by an appropriate test.
Written by the indexing model from the issue text.
Description
Describe the bug
I'm unsure if this is expected behaviour. When multiple credentials are stored and the username is wrong, (it seems) the credentials last stored are returned.
To Reproduce
Steps to reproduce the behavior:
# Create keyring with 2 users
keyring.set_password('test1', 'username', 'fancy-password-here')
keyring.set_password('test1', 'test', 'test')
# show keyring
keyring.get_keyring()
<keyring.backends.Windows.WinVaultKeyring at 0x2133429bfd0>
# correct username
keyring.get_credential('test1', 'username').username
username
# incorrect username
keyring.get_credential('test1', 'user').username
test
# incorrect service
keyring.get_credential('test3', 'username')
None
# add another username
keyring.set_password('test1', 'test2', 'test2')
# attempt 2 with wrong username
keyring.get_credential('test1', 'user').username
test2
Expected behavior
I'm not a programmer by any stretch, but I think I'd expect an exception raised if the username doesn't match what's requested...
Environment
- OS: Windows
> keyring --list-backends
keyring.backends.Windows.WinVaultKeyring (priority: 5)
keyring.backends.fail.Keyring (priority: 0)
keyring.backends.chainer.ChainerBackend (priority: -1)
Additional context
This was a fresh install and no credentials were stored with the python keyring before this. I don't have any other relevant OS's to test with right now.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 208
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from jaraco/keyring
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
macOS: denied keychain prompt on delete raises PasswordDeleteError instead of KeyringLockedPossibly taken @r3wretrhy claimed this 46 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Difficulty 3/5 1-2 days Newbie friendliness 50/100
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
-
Remove B018 suppressions after adopting skeleton's B018 ignorePossibly taken @Madin-H23 claimed this 26 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 78/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
benchflow-ai/skillsbench#1090 ·
-
Missing unit tests for human-readable date/time formatters in utils/datetime.pyPossibly taken @prabhleen2317 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
apache/iceberg-python#4387 ·
Maintainers usually reply within 1 day
-
[BUG] Hermes MCP adapter drops cwd, extra passthrough keys and the SSE transport when writing config.yamlPossibly taken @Parth-Vasave claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
microsoft/apm#3749 · 1 comment ·
Maintainers usually reply within 1 day
-
backend bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NVIDIA/numba-cuda-mlir#467 · 1 comment ·
Maintainers usually reply within 3 days