Repository navigation
Conversation
On Linux, Claude Code ignores sandbox.network.allowUnixSockets and its seccomp filter rejects every AF_UNIX socket, so the container gateway and ssh-agent signing only work with allowAllUnixSockets: true. The setup docs never said so, and nothing warned that the flag lets a sandboxed command connect to every socket it can see: the Docker and Podman daemons, the user D-Bus (systemd-run --user runs commands outside the sandbox), the system bus, X11, and on WSL the interop and WSLg sockets. The reference denyRead of ~/ hides none of them. Document the Linux requirement and the denyRead entries that must go with it, make verify check 12c accept allowAllUnixSockets as the Linux socket half and check 12d require denyRead cover for each host socket path that exists, mirror both in the verification prompt and install Step L, and add a sandbox-lint invariant for the daemon sockets and the per-user runtime directory, with an eval case for 12d. Also catalogue two Linux traps met on the same setup: an allowRead parent of an allowWrite path makes bubblewrap mount it read-only so every Bash call fails with "bwrap: Can't create file ... Read-only file system" (troubleshooting entry, hint-hook pattern, lint check), and denied paths showing up in git status as /dev/null placeholders. Generated-by: Claude Code (Claude Opus 5.5)
The systemd user manager also listens on /run/user/<uid>/systemd/private, so denying only bus and podman under the runtime directory still lets a sandboxed command run systemctl --user; the directory also holds editor askpass and systemd ssh-agent sockets. Require the whole directory of the current uid in sandbox-lint, verify and the docs, and drop the advice to deny single sockets in it. Move the socket-cover requirement into its own verify check 12e, which runs whenever allowAllUnixSockets is set, even with no container runtime (the flag may be there only for ssh-agent signing). Make sandbox-lint list the same paths as the docs and 12e, accept only the current uid, and note it reads only project layers. Correct the ssh-agent caveat (allow the socket or its own subdirectory, never /run/user/<uid>; unverified on Linux), name AF_VSOCK as residual risk, fix the /dev/null placeholder explanation (write-denied paths only), let the bwrap hint match paths with spaces, and add the missing tests. The verify eval case moves to case-23 to avoid a numbering clash. Generated-by: Claude Code (Claude Opus 5.5)
9 tasks done
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.
Summary
allowAllUnixSocketsis undocumented and unguarded.AF_UNIX, unlesssandbox.network.allowAllUnixSocketsistrue. The container gateway and ssh-agent need it, becauseallowUnixSocketsonly applies on macOS./run/docker.sock, Docker Desktop's/run/docker-cli.sock, all of/run/user/<uid>(D-Bus andsystemd/private, i.e.systemd-run --user),/run/dbus, X11, and on WSL/run/WSLinterop and/mnt/wslg.sandbox.filesystem.denyReadentries for those paths, and namesAF_VSOCKas the residual riskdenyReadcannot hide. It also makes verify check 12c Linux-consistent and adds a check 12e that requires the socketdenyReadcoverage whenever the flag is on, even when check 12 is otherwise n/a. Install Step L.3 andtools/sandbox-lintget matching rules and tests.allowReadmakes the project read-only. AnallowReadentry that is a strict parent of anallowWritepath makes bubblewrap mount the write path read-only. Every Bash call then fails withbwrap: Can't create file … Read-only file system. This PR adds a troubleshooting entry, asandbox-error-hint.shpattern, and a sandbox-lint rule.git status. A troubleshooting entry explains why write-protected paths that do not exist appear as character devices1,3and are listed as untracked.Type of change
.claude/skills/<name>/) — eval fixtures updated belowtools/*/withpyproject.toml)docs/,README.md,CONTRIBUTING.md)Test plan
prek run --all-files --skip workspace-pytestpassesprek run workspace-pytest --from-ref upstream/main --to-ref HEADpasses;tools/sandbox-lintpytest and the agent-isolationtest_sandbox_error_hint.pypass. New tests cover:os.getuid(), plus~and relative entries;~, a trailing slash, and.;/tmphint.skill-eval --cli "claude -p" tools/skill-evals/evals/setup-isolated-setup-verify/: 23/28 pass.upstream/main(step-1 case-7; step-2 case-3, case-5, case-6).case-23-linux-all-unix-sockets-exposedpassed 3 of 4 runs.denyReadentries added, the host sockets are no longer sockets inside the sandbox (test -Sis false)./tmpkeep working:docker versionthrough the gateway andssh-keygen -Y signboth succeed.allowReadfailure was reproduced and fixed by listing the specific directories.denyReadpaths, so listing paths that a host lacks is harmless.RFC-AI-0004 compliance
check-placeholderspasses)Notes for reviewers (optional)
allowReadinside a denied/run/user/<uid>re-opens an agent socket that lives there. The doc marks it as unverified.allowReadtrap is Claude Code's mount ordering, so it may also be worth an upstream Claude Code report. The lint rule fails closed, including outsidedenyRead.Generative AI: drafted with Claude Code (Claude Opus 5.5) and checked by an independent Claude Opus review agent; opened as a draft for the author's line-by-line review before it is marked ready.
🤖 Generated with Claude Code