Repository navigation
Sandbox: Unix sockets reached only as a bot's settings name them - #508
Conversation
A program listening on a Unix socket runs what it is asked outside the sandbox, as a browser's daemon launches a browser or Docker runs a container. As Claude Code's sandbox blocks them by default, Seatbelt now lets a workspace-write bot's commands reach only the sockets in its own and writable folders, and those its new unix_sockets setting names; a read-only bot's only those named. Sonny's permission rows take unix_sockets too. Linux still reaches every socket it can see; that follows. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDM2LnoDcXYpJdFY7Y
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
Security findingsAdvisory findings (1)ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fc607651eb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…re they exist A create reply's bound now covers its unix_sockets, which take at most 32 KiB as JSON as writable folders do. A socket not made yet is stored with what of its path exists resolved, so a link above it, as macOS's /tmp is, still matches Seatbelt's real path; Sonny's rows resolve them the same way. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDM2LnoDcXYpJdFY7Y
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDM2LnoDcXYpJdFY7Y
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ed0bdbfae8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: ed0bdbfae8
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
The daemon's real-path resolver, which follows a dangling link to its target, moves to agent-client, so Sonny reads a row's sockets back exactly as the daemon stored them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDM2LnoDcXYpJdFY7Y
A hard link in a bot's folder to any socket, the daemon's among them, needs no right to the socket and would reach it by a name there. So, as Claude Code's sandbox and Codex's managed network do, a sandboxed bot's commands reach only the Unix sockets its unix_sockets names. A macOS test connects from inside Seatbelt to the daemon's socket in the workspace, another there, one outside, one named and one in a named folder. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDM2LnoDcXYpJdFY7Y
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDM2LnoDcXYpJdFY7Y
A program listening on a Unix socket does whatever its clients ask, outside the sandbox. A browser's daemon launches a browser, and Docker runs a container. Today a sandboxed command can connect to any socket it can see. This PR follows Claude Code's sandbox and Codex's managed network, which block Unix sockets by default and allow them per path.
Daemon
unix_sockets(--unix-socket PATH, repeatable). Each entry is an absolute path to a socket or to a folder of sockets.agent_client::files::real: the part of the path that exists is resolved, dangling links are followed, and the rest is kept as written. This used to besandbox::real; it moved so Sonny resolves paths the same way.configure's sandbox op takes it too.unix_socketsnames, plus its own capability socket. Sockets in its own folders aren't allowed by default. A hard link there to any socket, the daemon's included, needs no right to the socket and would reach it.Sonny
[sonny.permissions.NAME]row takesunix_sockets, with~for home.Not in this PR: Linux. Bubblewrap's read-only root does not stop a connection, because
connect()to a socket ignores read-only mounts. I checked this with bwrap 0.9 and--unshare-net. So a sandboxed Linux command reaches every host socket today, the systemd user bus included. The Linux mechanism is still being chosen and will follow in its own PR. The docs say Linux does not restrict sockets yet.Tests:
cargo clippy --workspace --all-targets -D warningsis clean.cargo test --workspacepasses.tests.test_approvals,tests.test_servedandtests.test_cliPython modules pass locally.unix_sockets_are_reached_only_as_named(Seatbelt profile)a_sandboxed_command_reaches_only_the_sockets_it_names(macOS end to end, network on and off)a_row_s_sockets_are_the_daemon_s_and_tell_it_from_auto(Sonny rows, including a link to a socket that doesn't exist yet)🤖 Generated with Claude Code