Skip to content

ci(devcontainer): mount the history file, not the host home - #1007

Merged
KaiSchwarz-cnic merged 1 commit into
masterfrom
RSRMID-3052/narrow-host-mounts
Sep 8, 2026
Merged

KaiSchwarz-cnic merged 1 commit into
masterfrom
RSRMID-3052/narrow-host-mounts

Conversation

@KaiSchwarz-cnic

@KaiSchwarz-cnic KaiSchwarz-cnic commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Part of RSRMID-3052 — a fleet-wide fix. This 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.

Why this is more than untidy

In the workspace repository the same pattern made the readonly flag on its GitHub token directory decorative — the same inodes were reachable read-write by the second path, verified there by inode before the fix:

readonly  /home/vscode/.config/rtldev-middleware-workspace/tokens
WRITABLE  /WSL_USER/.config/rtldev-middleware-workspace/tokens

1454160 /home/vscode/.config/rtldev-middleware-workspace/tokens/centralnicgroup
1454160 /WSL_USER/.config/rtldev-middleware-workspace/tokens/centralnicgroup

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 initializeCommand touches ~/.zsh_history so Docker cannot create a directory where the file belongs — on the host, where it would outlive the container.

~/.gitconfig also becomes readonly: 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 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: no shell-history persistence (which means the mount narrowed above currently feeds nothing), no team zsh prompt, no gh credential helper from it — and env-info.conf is 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.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 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.

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.
@KaiSchwarz-cnic
KaiSchwarz-cnic merged commit 1ef11f3 into master Sep 8, 2026
3 checks passed
@KaiSchwarz-cnic
KaiSchwarz-cnic deleted the RSRMID-3052/narrow-host-mounts branch September 8, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant