ci(devcontainer): mount the history file, not the host home - #1007
Merged
Merged
Conversation
The frame mounted ${localEnv:HOME} at /WSL_USER to reach one file inside it,
~/.zsh_history. That granted the container read-write reach over the host's SSH
keys, shell profiles and every other repository on the machine as a side effect
of wanting one history file.
In the workspace repository the same pattern made the readonly flag on its
GitHub token directory decorative — the same inodes were writable by the second
path, verified by inode before the fix. That is what makes this a fleet-wide
change (RSRMID-3052) rather than a per-repository tidy-up.
Bind the single file at the same path instead, with a touch in initializeCommand
so Docker cannot create a directory where the file belongs. ~/.gitconfig also
becomes readonly: the container reads that identity, it does not maintain it.
docs/agents/project-policies.md carried the mount list as an explicit "accepted,
not fixed" risk register, so it is rewritten rather than find-and-replaced — the
risk it accepted (any mounted path being reachable by anything in the container)
is now scoped to four named paths instead of the whole home directory, which is
the part that actually changed. The bullet describing the
${localEnv:HOME}${localEnv:USERPROFILE} idiom goes with the mount that needed it.
That doc now also records something found while making this change and verified
rather than inferred: the commit titled "build(devcontainer): migrate onto the
shared devbase Feature" added only .dockerignore and .devcontainer/env-info.conf.
`features` still lists just github-cli and claude-code, and devcontainer-lock.json
has no devbase entry — so this repository gets none of that Feature's behaviour,
the history bind above feeds nothing, and env-info.conf is read by nobody.
Completing that migration is its own change; this commit only stops the mount
being wider than it needs to be.
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.
Part of RSRMID-3052 — a fleet-wide fix. This frame mounted
${localEnv:HOME}at/WSL_USERto reach one file inside it,~/.zsh_history. That granted the container read-write reach over the host's SSH keys, shell profiles and every other repository on the machine.Why this is more than untidy
In the workspace repository the same pattern made the
readonlyflag on its GitHub token directory decorative — the same inodes were reachable read-write by the second path, verified there by inode before the fix:That workspace fix is merged and verified after a rebuild: no host-home mount remains, and writes to the token directory now fail.
What changed here
The bind names the single file at the same path, and
initializeCommandtouches~/.zsh_historyso Docker cannot create a directory where the file belongs — on the host, where it would outlive the container.~/.gitconfigalso becomesreadonly: the container reads that identity, it does not maintain it.A pre-existing defect found on the way, and recorded rather than fixed
The devbase migration here never completed. The commit titled
build(devcontainer): migrate onto the shared devbase Featureadded only.dockerignoreand.devcontainer/env-info.conf.featuresstill lists justgithub-cliandclaude-code, anddevcontainer-lock.jsonhas nodevbaseentry.So this repository gets none of that Feature's behaviour: no shell-history persistence (which means the mount narrowed above currently feeds nothing), no team zsh prompt, no
ghcredential helper from it — andenv-info.confis read by nobody. Verified by reading the frame, the lock and that commit's diff rather than inferred from its subject, which is exactly why it is worth writing down.Completing that migration is its own change. This PR only stops the mount being wider than it needs to be.
docs/agents/project-policies.mdcarried the mount list as an explicit "accepted, not fixed" risk register, so it is rewritten rather than find-and-replaced: the risk it accepted (any mounted path being reachable by anything running in the container) is now scoped to four named paths instead of the entire home directory, which is the part that actually changed. The bullet describing the${localEnv:HOME}${localEnv:USERPROFILE}idiom retires with the mount that needed it, and the incomplete-migration finding is recorded there too.