Skip to content

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

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

ci(devcontainer): mount the history file, not the host home#372
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
Contributor

Part of RSRMID-3052 — a fleet-wide fix. This frame mounted ${localEnv:HOME} at /WSL_USER to reach one file inside it, ~/.zsh_history, which post-create.sh symlinks into place. 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.

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

Same inode: readonly by one route, writable by the other. 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, and what deliberately did not

The bind names the single file, at the same path as before.

post-create.sh is untouched and still does the linking. This repository is not on the shared devbase Feature, so that script is the only thing making history persist here. An earlier read of this sweep treated those legacy symlinks as leftovers worth removing — that was wrong, and removing it would have silently ended history persistence rather than tidying anything.

initializeCommand is added purely to touch ~/.zsh_history. A single-file bind needs the host file to exist first; without it Docker creates the missing source as a directory, on the host, where it outlives the container, and the symlink then points at a directory zsh cannot write to. initializeCommand is the only hook that runs before the container exists, which is why this cannot live in post-create.sh.

The frame mounted ${localEnv:HOME} at /WSL_USER to reach one file inside it,
~/.zsh_history, which post-create.sh symlinks into place. 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. post-create.sh is unchanged and
still does the linking: this repository is **not** on the shared devbase Feature,
so that script is what makes history persist here, and removing it would have
silently ended history persistence rather than tidied anything.

A single-file bind needs the host file to exist first, so initializeCommand
touches it. Without that, Docker creates the missing source as a directory — on
the host, where it outlives the container — and the symlink then points at a
directory that zsh cannot write to. initializeCommand is the only place that can
run before the container exists, which is why the touch cannot live in
post-create.sh.

Also drops the GitHub.copilot extension, deprecated for us since the team works
with Claude; anthropic.claude-code stays. Unrelated to the mount change, kept in
the same commit only because it edits the same few lines of the same file.
@KaiSchwarz-cnic
KaiSchwarz-cnic merged commit 5506b63 into master Sep 8, 2026
6 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