Repository navigation
refactor(security): one keyring seam owns the keyring and the Secret Service, with a shared fake and its contract suite - #2532
Merged
Conversation
Owner
Author
|
Test evidence:
Pending a person: review the diff in tuicr ( |
dan-petty
force-pushed
the
refactor/1318-keyring-seam
branch
from
October 28, 2026 20:55
78e9fd4 to
c04675b
Compare
dan-petty
marked this pull request as ready for review
October 28, 2026 21:03
…Service `src/devops_cli/config/os_keyring.py` is the one module that reaches the OS keyring and the Secret Service. A `KeyringEdge` Protocol names the selected backend, the session-bus check and the lock check; `SystemKeyring` is the real edge, and `set_keyring_edge` installs another. The keyring operations, the in-memory store and the three keyring errors move into the seam from `config/settings.py`, and the D-Bus checks move into it from `commands/devcontainer.py`. Each caller imports the public operations of the seam. `FakeKeyring` moves to `tests/support/fakes/keyring.py` behind the `keyring_store` fixture, which replaces `mock_keyring`. The floor installs a deny edge through the seam before each test, and `tests/config/test_keyring_contract.py` is the fake's contract suite. The lenient reads now catch only the errors of a keyring that cannot answer, so `config/settings.py` loses three swallowed failures.
dan-petty
force-pushed
the
refactor/1318-keyring-seam
branch
from
October 28, 2026 21:05
c04675b to
7286976
Compare
24 tasks
dan-petty
pushed a commit
that referenced
this pull request
Oct 28, 2026
🤖 I have created a release *beep* *boop* --- ## [0.11.3](v0.11.2...v0.11.3) (2026-10-28) ### Bug Fixes * **roadmap:** refine wraps no link in the model's code, and wraps each reference and link that GitHub makes from its text ([#2540](#2540)) ([2d38f8d](2d38f8d)), closes [#2525](#2525) ### Code Refactoring * **docker:** DockerEngineService is the Docker engine seam, with an in-memory engine fake and its contract suite ([#2534](#2534)) ([1244cbf](1244cbf)), closes [#1316](#1316) * **security:** one keyring seam owns the keyring and the Secret Service, with a shared fake and its contract suite ([#2532](#2532)) ([866d2cb](866d2cb)), closes [#1318](#1318) * **telemetry:** OTLP export goes through one exporter seam, and tests read exported spans and metrics from a shared fake ([#2541](#2541)) ([8da35e6](8da35e6)), closes [#1319](#1319) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
src/devops_cli/config/os_keyring.pyis the one module that reaches the OS keyring and the Secret Service. Before,config/settings.pyimportedkeyringin seven functions, callers imported its private names, andcommands/devcontainer.pyconnected to the session bus and askedsecretstoragefor the lock state itself.KeyringEdgeProtocol names the three questions the seam asks: the backend that thekeyringlibrary selected, whether a D-Bus daemon answers on the session-bus socket, and whether the default Secret Service collection is locked.SystemKeyringis the real edge, andset_keyring_edge/reset_keyring_edgeinstall and restore it.SecretStorageError,KeyringLockedErrorandKeyringUnavailableErrormove into the seam. The private names become public operations (has_encrypted_backend,has_keyring_secret,store_keyring_secret,remember_secret,clear_remembered_secrets,backend_info), and each caller imports them from the seam.config/settings.pykeeps no keyring code and no forwarding functions.get_keyring_secretandhas_keyring_secretcatch only the errors of a keyring that cannot answer:KeyringError, and on Linuxsecretstorage'sSecretStorageException, which keyring's Secret Service backend passes through when the session bus fails. Any other exception now propagates instead of reading as a missing secret.config/settings.pytherefore loses three swallowed failures, and its ceiling falls from 5 to 2.FakeKeyringmoves totests/support/fakes/keyring.py. It is both akeyringbackend and aKeyringEdge, with a locked state, a replaceable selected backend, the session-bus and lock answers, and a record of reads, writes and bus checks. Thekeyring_storefixture installs it through the seam and replacesmock_keyring.keyringitself.tests/config/test_keyring_contract.pyis the contract suite. The session-bus and lock checks run over the fake and overSystemKeyringwith no program started. The entry cases run over the fake, whose answers follow keyring 25.7.0's Secret Service backend. Under the owner's rule of 2026-10-24, the real side over gnome-keyring-daemon is not built.The tests that patch a devops-cli keyring name at its import site move onto
keyring_storewith their package items (#1321, #1327, #1332).Closes #1318
Change:
openspec/changes/archive/2026-10-28-1318-keyring-seam/