Repository navigation
Closed
Labels
priority/p1-highPriority P1: high-impact work for the next planned milestonescope/infraDocker container images, DevContainers, and infrastructure toolingscope/securitySecurity linters (trivy, bandit, gitleaks, kubeconform) and Vaulttype/securityType security: a vulnerability or a leak
Milestone
Description
Context & Rationale
The Debian sid devcontainer runs no freedesktop Secret Service (no D-Bus session bus, no keyring daemon). As a result:
gh auth loginfalls back to writing the OAuth token in plain text to~/.config/gh/hosts.yml("Authentication credentials saved in plain text").- Python
keyringresolves tokeyring.backends.fail.Keyring, sodevopscannot persist secrets._ensure_keyring_backendinsrc/devops_cli/config/settings.pycorrectly rejects plaintext backends, leaving no usable store. - Git HTTPS credentials go through the VS Code Dev Containers credential helper, which forwards to the host credential store.
Forwarding to the host is not an option, because several devcontainers run at once under different identities (personal vs work). Identity follows the /home/vscode named volume (home_volume in src/devops_cli/templates/devcontainer.json.j2):
- One home volume = one identity. Every container that mounts the same home volume uses that identity and shares one live set of credentials and auth sessions. A login, token refresh or logout in one container is immediately effective in the others.
- A different home volume = a separate identity. A project with its own home volume shares no credentials or sessions with any other volume.
This also closes a gap against the AGENTS.md rule: "Never store plaintext secrets… Always use OS Keyring or secure secret stores."
Scope & Deliverables
- Keyring selection*: Evaluate in-container Secret Service implementations hands-on in throwaway
debian:sidcontainers: gnome-keyring-daemon, pass + pass-secret-service, oo7-daemon, and KeePassXC/KWallet run headless. Compare them with baselines that need no daemon:--insecure-storage, an encryptedGH_TOKEN, git-credential-cache or -oauth, git-credential-manager with its gpg store, and the kernel keyring. Test each against thegh(go-keyring), git HTTPS and Pythonkeyring==25.7.0clients. - Identity = home volume*: Store all keyring data on the home volume, so it is the single source of truth for that identity. Only runtime state (bus and agent sockets) stays container-local under
/run/user/1000, not on the shared/tmpvolume. Verify all of the following:- A secret written, rotated or deleted in one container is visible in every other running container on the same volume, without restarting or re-unlocking.
- Concurrent writes from two containers do not clobber each other.
- Nothing is visible across different home volumes.
- Data survives a restart and a rebuild.
- Unlock model*: Define the unlock step for a container with no desktop session: a password at start, pinentry-tty, or auto-unlock. Document exactly what is encrypted at rest and how it compares with a
0600file on a per-identity volume. - Lifecycle integration*: Install the chosen daemon in
.devcontainer/Dockerfile. Expose a staticDBUS_SESSION_BUS_ADDRESSthroughcontainerEnv/remoteEnvso VS Code terminals, extensions, Claude Code and MCP servers can find the bus. Start the daemon idempotently fromdevops devcontainer post-start(_run_post_start_lifecycle), reusing the existing background-daemon pattern, and mirror the changes indevcontainer.json.j2. - Client configuration & migration*: Point
gh, git (gh auth git-credentialor a libsecret helper) anddevopsat the in-container keyring. Document how to turn off VS Code host credential forwarding (dev.containers.gitCredentialHelperConfigLocation). Move the existing plaintexthosts.ymltoken into the keyring and delete the plaintext copy. - Automated verification*: Add a post-start health check that reports the active keyring backend and warns when
ghordevopswould fall back to plaintext or the fail backend.
Strategic Alignment
- Milestone:
v0.2.23(Foundational Architectural Guardrails & Project Hygiene) - Roadmap Reference:
docs/ROADMAP.md
Metadata
Metadata
Assignees
Labels
priority/p1-highPriority P1: high-impact work for the next planned milestonescope/infraDocker container images, DevContainers, and infrastructure toolingscope/securitySecurity linters (trivy, bandit, gitleaks, kubeconform) and Vaulttype/securityType security: a vulnerability or a leak
Type
Projects
- StatusShow more project fieldsDone
Activity
[-]feat(security): in-container secret service keyring for per-identity devcontainers[/-][+]feat(security): in-container keyring scoped to the home-volume identity[/+]dan-petty commentedon Sep 23, 2026
Related symptom found while storing an API key (closed #454 as a duplicate of this issue): with no usable backend,
_keyring_setfalls back to the process-local_EPHEMERAL_CI_SECRETSdict, yetdevops config set <secret-key> <value>still printsSecret '<key>' stored in keyring.and exits 0. The secret is lost when the process exits anddevops config showthen reportsnot set. Outside headless mode (DEVOPS_CLI_HEADLESS_AUTH), storing a secret without a usable backend should fail with a non-zero exit and guidance, so the loss is visible.dan-petty commentedon Sep 23, 2026
Decision: oo7-daemon in one sidecar per identity
Status: the design is chosen and tested. An adversarial from-scratch reproduction is still running; the verified design and integration plan will follow in another comment.
Why one daemon per identity
Every reputable Secret Service we tested assumes it is the only writer to its store: gnome-keyring 51.1, oo7-daemon, KeePassXC 2.7.10 and KWallet. With one daemon per container on a shared home volume, every one of them lost writes or served stale data:
So each home volume (identity) gets exactly one keyring daemon, and every container of that identity connects to it.
Architecture
<home_volume>-keyringcontainer runningdbus-daemon1.16.2 and oo7-daemon 0.7.0-beta as uid 1000. It is started idempotently frominitializeCommandwithdocker compose up -d --no-recreate.<home_volume>-keyringvolume, not the home volume. A sidecar that creates the home volume first would skip Docker's copy-up of/home/vscode.DBUS_SESSION_BUS_ADDRESS=unix:path=/run/secret-service/busincontainerEnv, and run no daemon of their own.ghuses the keyring natively.gh auth git-credential. Host forwarding is turned off withdev.containers.gitCredentialHelperConfigLocation=none.devopsuses Pythonkeyringthrough the SecretService backend, which_ensure_keyring_backendaccepts.Why oo7-daemon
debian:sid-slim, and the binaries link only libc, libm and libgcc_s. The gnome-keyring sidecar was 939 MB, because its package pulls in GTK3/4, mesa and llvm; KWallet adds 444 MB and KeePassXC 413 MB.Test evidence
All tests ran on Docker-in-Docker with a personal and a work identity, several clients per identity, and fake tokens only:
ghlogin, rotate and logout, git credentials and Python set/get/delete all propagate between containers immediately, with no restart or re-unlock./tmpvolume.@devcontainers/cli0.89.0 raninitializeCommandand started the sidecar. A second project of the same identity came up already unlocked.Known upstream issues and their mitigations
/collection/Loginand breaks gh0.7.0-beta(cargo install --locked, built with sid's rustc 1.95) and publish the image pinned by digestoo7-cli unlockhangs forever on a wrong passworddevops keyring unlock(getpass, thenUnlockWithMasterPasswordover D-Bus); oo7-cli is optionalCreateItem(replace=true)is not atomic, so readers racing a rotation getItemNotFoundRLIMIT_MEMLOCKMALLOC_ARENA_MAX=1,TOKIO_WORKER_THREADS=2RUST_LOG=warnand capped json-file logsClient-side caveat (applies to any daemon)
gh 2.101 cannot be made fail-closed (cli/cli#10108). When the keyring is locked or down,
gh auth loginreturns 0 and writesoauth_tokentohosts.ymlin plaintext. Mitigation: detection in post-start,devops keyring doctorand a shell prompt warning. An AGENTS.md rule tells agents never to fall back to--insecure-storageorGH_TOKEN.To migrate the existing plaintext token without minting a new one, run
gh auth token -h github.com | gh auth login -h github.com --with-token. Avoidgh auth refreshand logout-then-login, because each mints a new token and GitHub keeps only 10 per user, app and scope. Do not use "Revoke access" on the GitHub CLI app: it kills every gh session for the account.Rejected
dan-petty commentedon Sep 24, 2026
Final direction: Debian's gnome-keyring, one daemon per container
This replaces the oo7-daemon sidecar design in the comment above. That design worked in testing, but it needed a host-side launch script in
initializeCommandand engine-specific flags (rootless Podman needs--userns=keep-id). That is more machinery than this problem warrants. The simpler setup is implemented on branchfeat/devcontainer-gnome-keyring(a62a0c5a):.devcontainer/Dockerfileinstalls Debian'sgnome-keyringanddbus-x11, and creates/run/user/1000.containerEnvsetsDBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus, in both the repodevcontainer.jsonanddevcontainer.json.j2.devops devcontainer post-startstarts the session bus if it is not already running, withXDG_RUNTIME_DIR=/run/user/1000. gnome-keyring is D-Bus-activated on first use. The bus and the keyring control socket stay container-local, because/tmpis a volume shared between containers.Verified in a throwaway
debian:sidcontainer: post-start started the bus and left a running one alone, Pythonkeyringchose SecretService and completed a set/get round trip, and the secret is encrypted inlogin.keyring. Full suite: 4,836 passed, plus one order-dependent k8s test that passes on its own.Usage
The first time, and after every container restart, create or unlock the keyring from a terminal. Type the password, then press Ctrl-D without pressing Enter first, or the newline becomes part of the password:
Then move an existing plaintext gh token into the keyring without minting a new one:
gh auth token -h github.com | gh auth login -h github.com --with-tokenKnown limitations, accepted
gh auth loginshould error if the system keyring is unavailable rather than falling back to insecure storage cli/cli#10108).dev.containers.gitCredentialHelperConfigLocationisnone, or git is pointed atgh auth git-credential.Possible follow-ups (not done)
oauth_tokenlines in~/.config/gh/hosts.yml.gh auth git-credential._ensure_keyring_backendso it distinguishes a locked keyring from a working one, and cannot be bypassed throughChainerBackend.feat(devcontainer): set up the keyring for every scaffolded devcontainer
feat(devcontainer): keep gh and devops secrets in gnome-keyring (#472)
fix(security): close the keyring's remaining plaintext and host-crede…
dan-petty commentedon Sep 24, 2026
Closed by #485, merged into
release/v0.2.23.GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by
devops gh issues close-merged.feat(devcontainer): unlock the keyring as the devcontainer starts (#490)
feat(release): v0.2.23 (#681)
fix(roadmap): intake calls a candidate a duplicate only when it asks …
fix(roadmap): intake judges a split part a duplicate of the issue tha…