Skip to content

Sandbox follows Codex: every Unix socket with the network on, file pages in the browser - #526

Merged
lydakis merged 8 commits into
mainfrom
claude/project-thread-xdi5gl
Oct 31, 2026
Merged

lydakis merged 8 commits into
mainfrom
claude/project-thread-xdi5gl

Conversation

@lydakis

@lydakis lydakis commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

George, 10-31: "We should follow what Codex does, and we should not limit the user from doing useful things." Where an earlier choice (#508, #514, #515) was stricter than Codex, Codex wins.

What changes

  • Unix sockets. An agent that reaches the network reaches every Unix socket, as Codex's full network does. MCPX, Docker and ssh-agent just work, and a test suite can listen on its own socket. An agent kept off the network still reaches only the sockets its row's unix_sockets names (Codex's network off reaches none).
    • macOS: the blanket (deny network-outbound (remote unix-socket)) is gone, and AF_UNIX sockets may be made and bound.
    • Linux: the seccomp AF_UNIX block applies only with the network off.
  • The daemon's socket and other bots' sockets stay out of reach either way. On macOS a hard link to them is refused too (file-link), since a link in the agent's folder would otherwise name them. The macOS CI job checks this.
  • sonny zen works in Auto and Ask me. As Codex adds its own folders to the roots it may write, every row that writes now also writes ~/.agent/sonny/zen (made 0700). Nothing new leaves the sandbox: an earlier draft let sonny zen out by prefix, which a sonny earlier on PATH could have hijacked. /permissions still recognises a custom row with the zen root added.
  • Files are replaced through a temporary made anew (client::files::replace_mode): create_new with O_NOFOLLOW, mode set on the open file, so a link planted at the temporary's name is never written through.
  • Browser tool. It opens file:// pages anywhere, since the sandbox reads anywhere, Codex's included, and it takes --new-tab. Writes still stay in the agent's folder.
  • tests/test_workflows.py (George's idea): useful work in each permission row.
    • The agent and sonny CLIs work in every row (sonny zen in every row but Read only).
    • An MCPX socket is reached with the network on. In Read only it asks once, then "always allow" lets it through.
    • A test suite runs with its own Unix socket and a localhost server, and it commits.
    • A write outside the folder asks once, then "always allow" lets it through.

Left as is

Tests

  • cargo test --workspace, clippy -D warnings, fmt
  • tests.test_served, tests.test_approvals, tests.test_workflows (Linux, bubblewrap, agent-browser)
  • The macOS e2e test a_sandboxed_command_reaches_only_the_sockets_it_names now covers the hard link and a server of the agent's own. It runs on the macOS CI job.

Security review owed (Codex security reviews are out of usage): listed in #531.

🤖 Generated with Claude Code

…ges in the browser

George, 10-31: follow what Codex does, and don't limit the user from
doing useful things; where an earlier choice was stricter than Codex,
Codex wins.

- An agent that reaches the network reaches every Unix socket, as
  Codex's full network does, so MCPX, Docker and ssh-agent just work and
  a test suite may listen on its own. One kept off the network still
  reaches only those its row's unix_sockets names. On macOS the Seatbelt
  blanket deny goes and AF_UNIX sockets may be made and bound; on Linux
  the seccomp block applies only with the network off.
- The daemon's socket and other bots' stay out of reach either way; on
  macOS a hard link to them is refused (file-link), as one in the
  agent's folder would otherwise name them.
- `sonny zen`, which an agent's shell runs and which writes only Sonny's
  state, is let out of every sandbox (OWN_UNSANDBOXED).
- The browser tool opens file pages anywhere and takes --new-tab, as the
  sandbox reads anywhere; writes still stay in the agent's folder.
- tests/test_workflows.py: useful work in each permission row (the agent
  and sonny CLIs, an MCPX socket, a suite with its own servers, commits,
  a write outside the folder that asks once and then is always allowed).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGDM2LnoDcXYpJdFY7Y
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T17:28:38.274361Z 9a34fc2 Manual request
🔒 Security Review ⚠️ Failed 2026-10-31T16:51:54.348970Z
We couldn’t complete this review. Comment @codex security review to try again.
f056187 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@chatgpt-codex-connector

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a252736f6e

ℹ️ 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".

Comment thread sonny/src/approvals.rs Resolved
… out

A command prefix let out of the sandbox is matched by its words, so a
`sonny` earlier on PATH in a folder the agent writes would have run
outside it. As Codex adds its own folders to the roots it may write,
every row that writes now writes ~/.agent/sonny/zen, and nothing new
leaves the sandbox.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGDM2LnoDcXYpJdFY7Y
@chatgpt-codex-connector

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@chatgpt-codex-connector

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 806d53c4f4

ℹ️ 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".

Comment thread sonny/src/approvals.rs Resolved
A row of the person's that writes no folder of its own was no longer
recognised once the zen folder was added, and fell back to auto.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGDM2LnoDcXYpJdFY7Y
@chatgpt-codex-connector

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ae3edec4f1

ℹ️ 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".

Comment thread sonny/src/approvals.rs Resolved
@chatgpt-codex-connector

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

A folder Sonny writes may now be one a sandboxed agent writes too (the
zen folder): a link left by the temporary's name would have been written
through, truncating any file. The temporary is made exclusively, without
following a link, and its mode set on the file opened.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGDM2LnoDcXYpJdFY7Y
@chatgpt-codex-connector

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@chatgpt-codex-connector

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

lydakis commented Oct 31, 2026

Copy link
Copy Markdown
Owner Author

@codex security review

This PR's automatic security review failed on the usage limit; it is one of the riskier rows in #531 (sandbox: every Unix socket with the network on).


Generated by Claude Code

@lydakis
lydakis merged commit 9a34fc2 into main Oct 31, 2026
5 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f056187e4b

ℹ️ 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".

Comment thread sonny/src/approvals.rs
&& writable.len() < MAX_WRITABLE
&& let Some(zen) = zen_root()
{
writable.push(json!(zen));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Harden zen reads before granting agents directory write access

A sandboxed bot can now replace a focus file with a FIFO, causing the unsandboxed Sonny window to hang indefinitely: zen::focus_in() calls blocking std::fs::read_to_string(), and App::zen_taken_up() invokes it directly while handling turn completion and accepted/steered events. Because this directory is shared, a bot can also target another bot's window. I reproduced the blocking read with the actual focus_in() implementation. Before exposing this directory, make focus reads reject non-regular files using a nonblocking open and descriptor-based validation, so checking the file type cannot itself race with replacement.

Useful? React with 👍 / 👎.

lydakis commented Oct 31, 2026

Copy link
Copy Markdown
Owner Author

@codex security review


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 9a34fc29b2

ℹ️ 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".

lydakis added a commit that referenced this pull request Oct 31, 2026
…541)

The Sandbox section said a sandboxed bot reaches only the Unix sockets
its unix_sockets names, network on or off; since #526 that holds only
with the network off. install.sh and the formula called bubblewrap the
daemon's default sandbox; the daemon confines nothing unless asked, and
it is Sonny's agents that are sandboxed by default. APPROVALS.md said
the automatic approver was not built and that any bot's shell reaches
the daemon and the approval channel; scope those to unsandboxed bots
and allowed escalations, pointing at the sandbox section.
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.

2 participants