macOS: denied keychain prompt on delete raises PasswordDeleteError instead of KeyringLocked
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 86/100
Research direction
Start in keyring/backends/macOS/init.py and compare delete_password with the existing get_password and set_password handling of api.KeychainDenied. Verify that a denied delete raises KeyringLocked while api.NotFound and other api.Error cases still raise PasswordDeleteError; the issue does not name a test file.
Written by the indexing model from the issue text.
Description
Since #375, the macOS backend maps api.KeychainDenied (errSecUserCanceled, -128) to KeyringLocked in get_password and set_password. delete_password does not: it turns every api.Error into PasswordDeleteError, the same exception it raises for an item that does not exist (api.NotFound).
So a caller cannot tell "the user denied access, the secret is still there" from "nothing to delete". Code that treats PasswordDeleteError as "already gone" (a reasonable reading, since that is what SecretService and Windows raise for a missing entry) reports a successful delete while the secret stays in the keychain.
Suggested fix, in line with the other two methods:
except api.KeychainDenied as e:
raise KeyringLocked(f"Can't delete password in keychain: {e}") from e
except api.Error as e:
raise PasswordDeleteError(f"Can't delete password in keychain: {e}") from e
Found by reading keyring/backends/macOS/__init__.py on main (7603e7c); not reproduced interactively.
- 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
-
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
-
Difficulty 5/5 Over a week Newbie friendliness 35/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