jaraco / jaraco/keyring

get_credential race for latest password

Open
#700 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.5k
Forks
196
PR merge metrics
No merged PRs in 30d

Description

Considered adding this additional assertion too (see [previous commit)](https://github.com/jaraco/keyring/pull/699/commits/27d0e0ea3ea75ad7400e9d1d42bcbbbe088aaa01) but it was failing intermittently on linux.

Sometimes `keyring.get_credential(service, None).password ` would equate to `password_2` and sometimes to `password_1`.

Sticking a `time.sleep(1)` between the 2 `set_password` calls above helped it reliably pass so perhaps there's some async/timing thing happening with dbus (can possibly look into that deeper but a bit out of my depths w/ dbus)

```suggestion
assert keyring.get_credential(service, "user2").password == password_2
# Most recent entered
assert keyring.get_credential(service, None).password == password_2
```

_Originally posted by @JamieBeverley in https://github.com/jaraco/keyring/pull/699#discussion_r1787020071_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the credential test and the set_password calls discussed in pull request #699, then inspect the Linux credential backend and its D-Bus interactions. Done means repeated password updates make get_credential(service, None) return the latest password reliably without timing-dependent failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.