Skip to content

Sonny: a linked browser's saves are written through no link - #1503

Merged
lydakis merged 1 commit into
mainfrom
claude/project-thread-zjjclr
Dec 1, 2026
Merged

lydakis merged 1 commit into
mainfrom
claude/project-thread-zjjclr

Conversation

@lydakis

@lydakis lydakis commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Requested by George · project thread

What

Over a link, the agent's machine writes what the linked browser saved (landed() → land() in sonny/src/browser.rs). It checked the path (Reach::output, real path inside the agent's folders), then ran create_dir_all on the parent and opened the file with O_NOFOLLOW on the last part only. A confined agent that swapped a folder on the way for a link after the check had the write land anywhere the person may write (a shell rc, say).

Local saves already did this right since #1197: land_staged() opens each folder below the agent's with openat following no link (crate::git::folders), then the file with O_NOFOLLOW.

Now both go through one writer, opened(), so a save over a link is written exactly as a confined agent's local save is. An agent that runs unconfined writes anywhere, as before (no folders to keep it in, so nothing changes for it).

Sonny only, no daemon change. From the Codex security findings George picked on 12-01.

Tests

  • what_a_linked_browser_saves_is_written_on_the_agent_s_machine_as_it_may gains: a folder checked, then swapped for a link to a folder outside, is not written through (neither the file nor a folder made under it); a folder made on the way where none was lands inside; an unconfined agent still writes anywhere, its folder made.
  • With the walk turned off, the test fails (the write went through the swapped link), so it catches the race.
  • cargo test -p sonny --bin sonny browser:: 21 passed; clippy clean.

Performance

No benchmark covers browser saves. The cost is one openat/mkdirat per folder below the agent's, once per saved file (a screenshot, a PDF), which is what local confined saves already pay.


Generated by Claude Code

Over a link, the agent's machine checked where a saved file goes, then
made its folders and opened it following every link but one in the
file's own place. A folder on the way swapped for a link after the check
led the write anywhere the person may write.

Now it writes as a confined agent's saves here already are (#1197):
each folder below the agent's opened, or made, following no link, and
the file opened in it following none. One shared writer serves both.
An agent that runs unconfined writes anywhere, as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGHWYTLgA8idNmFy5qp
@lydakis lydakis self-assigned this Dec 1, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-01T04:44:30.377007Z af10f32 PR opened
🔒 Security Review ✅ Completed 2026-12-01T04:46:57.366830Z af10f32 PR opened
ℹ️ 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.

@lydakis
lydakis merged commit 8a230d4 into main Dec 1, 2026
7 checks passed
@lydakis
lydakis deleted the claude/project-thread-zjjclr branch December 1, 2026 06:43
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