Repository navigation
Conversation
The sandbox bind-mounts the repo read-write, so the agent could edit .devcontainer/: the host runs initializeCommand from it at the next start, and the firewall reads allowed-domains.txt from it. Mount it read-only on top of /workspace. Branch switches, pulls and merges that touch .devcontainer/ now fail in the sandbox, which the README documents. .git/config and .git/hooks stay writable: a read-only mount breaks `git push -u`, `gh pr checkout` and worktree workspaces, and git has no setting that ignores repository-local config (protected configuration covers only safe.* and uploadpack.packObjectsHook). The README lists what to check on the host after a sandbox session. Also notes that the firewall allows a CDN host's shared IPs (refs #296). Closes #289
gatezh
added a commit
that referenced
this pull request
Nov 27, 2026
…ntainer The sandbox now mounts .devcontainer/ read-only (#289, PR #319). The skill checks test -w .devcontainer first and, when it fails, audits and reports instead of starting edits it can't finish; run the sync on the host or in the default variant. Workflow 1 also flags a sandbox docker-compose.yml without the read-only mount as a security finding, next to the existing shared-volumes one. The compose file is starter-customize, so the skill surfaces the line and asks. Part of the 1.4.0 release; no further bump.
gatezh
changed the base branch from
master
to
claude-code/safe-directory-worktrees
November 27, 2026 20:22
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
Mounts the project's
.devcontainer/read-only in the sandbox variant, and documents the host-executed files the sandbox can still write (.git/config,.git/hooks/, ignored files) and how to check them.Why
The sandbox bind-mounts the repository read-write, and Claude Code runs there with permission prompts skipped. The agent could edit
.devcontainer/: the host runsinitializeCommandfrom it at the next start, and the firewall readsallowed-domains.txtfrom it. Both take effect before anyone reviewsgit diff..git/is worse, becausegit diffnever shows it (#289).Changes
claude-sandbox/docker-compose.yml: adds../../.devcontainer:/workspace/.devcontainer:roon top of the/workspacebind..git/config,.git/hooks/, ignored files like.claude/settings.local.json, and files hidden through.git/info/exclude), why git can't block them, and three commands to run on the host after a session.allowed-domains.txtsection: the "Why the script is in the image" paragraph now says the agent can't edit the allowlist. A new "Shared CDN addresses" note explains that the firewall allows IPs, not names, so a CDN host opens other sites on the same addresses (refs claude-code template: the sandbox firewall allows whole shared CDN IPs, so each allowlisted CDN host likely opens unrelated sites #296).Closes #289
Refs #296
Notes
Cost for sandbox users: git in the sandbox can't write
.devcontainer/. Probed with the published image:git mergeof a branch that changes.devcontainer/fails cleanly (exit 2).git switchreports success but leaves the file as stale content that shows as modified. A latercommit -awould revert it.git merge --ff-onlyfails and leaves other files half updated.The README tells users to switch and pull on the host and not to commit
.devcontainer/changes from the sandbox. The upstream-sync skill has to run on the host or in the default variant.Why not option 2 (read-only
.git/configand.git/hooks): it breaksgit push -uandgh pr checkout, stops husky settingcore.hooksPath, and breaks worktree workspaces, where.gitis a file and the mount can't start. Making hooks read-only alone does nothing whilecore.hooksPathstays writable.No native git mitigation exists:
safe.directorychecks only ownership, and Docker Desktop's fakeowner shows sandbox-written files as the host user (uid 502 in the probe).safe.directory,safe.bareRepositoryanduploadpack.packObjectsHookfrom protected config alone. Nothing makes git ignorecore.fsmonitor,core.hooksPath,core.sshCommandor aliases from repo-local config.-corGIT_CONFIG_*override would mean listing every key that runs a command, and it would turn off legitimate hooks too.So the README documents the check instead. Probed on host git 2.50:
git statusrunscore.fsmonitor, and on a ttygit config --listruns a repo-setpager.config. So the README says to read.git/configwithcatfirst, including anyinclude.pathfile.Placement: the mount lives in
docker-compose.yml(next to the bind it narrows), as [BUG] sandbox: agent can write .git/ and .devcontainer/, which the host then runs #289 suggests. The upstream-sync skill classes that file asstarter-customize, so it surfaces the change to adopting projects without applying it.Validation:
docker compose configresolves the mount asread_only: true.docker compose runwith the sandbox image showed/workspacerw and/workspace/.devcontainerro. A write failed withRead-only file system, and reads still worked.Wiki: no page goes stale. Cloudflare CLI tells sandbox users to allowlist
api.cloudflare.comanddash.cloudflare.com, which are on Cloudflare's shared CDN (claude-code template: the sandbox firewall allows whole shared CDN IPs, so each allowlisted CDN host likely opens unrelated sites #296).