fix(run): refuse symlinked .git / .git/config for the config overlay - #111
Merged
sbp-bvanb merged 2 commits intoSep 29, 2026
Merged
Conversation
The container-only .git/config overlay was built with [ -f ] and cp, which both follow symlinks. Workspaces are writable from the container, so the overlay step must not follow links out of the workspace. Overlay only when .git is a real directory and .git/config a regular file, neither a symlink. Adds tests/test_git_config_overlay.py, which runs the real run.sh against a stub runtime, and the archived OpenSpec change with the synced multi-workspace-mounts spec. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
stefanwb
approved these changes
Sep 29, 2026
stefanwb
left a comment
Contributor
There was a problem hiding this comment.
Thanks Joeri, this closes a real hole in something the threat model lists as protected, with a small fix. The new test runs in CI's unittest step. Approving.
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.
What
The container-only
.git/configoverlay inrun.shis now built only when.gitis a real directory and.git/configa regular file — neither may be a symlink.run.shruns host-side, and[ -f ]/cpfollow symlinks. The workspace is writable from the container, so a.gitor.git/configsymlink planted during one session made the next launch copy the link's host-side target into the stage dir and mount it into the container — a read of a host file outside the passed workspaces, which the threat model lists as protected.run.sh: symlink checks on both.gitand.git/config.tests/test_git_config_overlay.py: stdlib test that runs the realrun.shagainst a fakedockerrecording its argv; covers a real repo, a symlinked.git, and a symlinked.git/config.refuse-symlinked-git-config(archived;multi-workspace-mountsgains a scenario).Testing
python3 -m unittest discover -s tests -p 'test_*.py': 117 pass. The new test fails 2 of 3 cases againstmain'srun.sh.shellcheck -S warning run.sh: clean.openspec validate refuse-symlinked-git-config --strict: passes.run.shchange only.Touches the same loop and generated spec as the
.git/hooksread-only PR; whichever lands second needs a trivial rebase (keep both spec sections).🤖 Generated with Claude Code