Repository navigation
fix(files): open links out of the task, read-only unless the user granted the target - #469
Merged
Merged
Conversation
A worktree's `.claude` link into the main checkout opened in the editor but failed on save with "path escapes task", and a link to notes kept outside the repo could not be opened at all. Reads now follow a link out of the task at any depth and the file opens read-only: a locked buffer, a Read-only badge on the breadcrumb, no preview edits, and a toast on Cmd+S saying why. - writes stay strict: `task_file_write`, rename, delete and git paths keep `safe_task_path`, and the new `task_file_writable` command tells the editor which files those are - a link into termic's data dir, the keychain dirs or the broker's per-spawn dirs is still refused; the skills, agents and `mcp.json` termic links into `.agents` / `.mcp.json` stay readable - the read side is a display rule, not a boundary (the webview can already read any path), so it is not kept in step with the sandbox allowlist - a read-only buffer uses `EditorState.readOnly` alone, so it still takes focus and Cmd+S / Cmd+F reach it - `task_path_stat`, `task_reveal_path` and `task_file_fp` run off the main thread; a missing file under a followed link reads as a dead link - server tasks still write through links on the box (docs/sandbox.md) Refs simion#250 Signed-off-by: Alex Goodman <[email protected]>
…ion#250) A file reached through a link out of the task opened read-only even when the link landed in a dir the user had allowlisted for the sandbox (e.g. `~/.local`), so the agent could write a file the editor could not. `task_file_write` and `task_file_writable` now go through `safe_task_write_path`: the task as before, or a link's target inside a sandbox grant from a layer the user owns (global defaults, the task's and project's personal lists, the task agent's list). - `.termic.yaml` never counts, since a repo authors it, and neither do the built-in runtime paths or `regex:` entries - the data dir, keychain dirs, broker spawn dirs, the main checkout and every member repo are refused ahead of any grant, so granting `~` cannot make the `.claude` link write into the repo behind the worktree - rename, delete and git paths keep the strict check Refs simion#250 Signed-off-by: Alex Goodman <[email protected]>
The link write rule counted the agent's own `sandbox_allowed_paths` as a
user grant in every realm, but Docker never mounts that list. In a Docker
task the editor could write host paths the container cannot reach (an
agent's config or installed binaries), so an agent could steer a save
there through a link.
- write grants now come from the personal half of `live_sandbox_lists`
(same layers the spawn reads, `.termic.yaml` dropped), plus the agent
list only outside Docker
- relative grant entries and ones holding `..` no longer canonicalize
into something Seatbelt would never match (termic's cwd, every sibling
task)
- `write_atomic` names its temp file randomly and opens it `O_EXCL`. The
`{pid}.{seq}` name opened with `File::create` let an agent plant a link
there ahead of a save and have termic write the buffer through it
- docs and comments now describe the grant exception, and the write rule
has its own section in docs/sandbox.md
Refs simion#250
Signed-off-by: Alex Goodman <[email protected]>
Owner
|
Thanks for the contribution! |
simion
approved these changes
Nov 26, 2026
simion
left a comment
Owner
There was a problem hiding this comment.
Good catch on the read-only link-out behavior, matches the sandbox model well. Merging now.
simion
added a commit
that referenced
this pull request
Nov 26, 2026
Both cases #469 added failed on all three platforms. The right panel's file tree is not inside the task view's [data-task-id], so the scoped row selectors matched nothing (the tree had every row, "deep" included; measured with a probe of the DOM). And WebKit's WebDriver returns an undefined property as null, so the recycled tab's cleared readOnly read null where the store holds undefined: both mean "not read-only". Refs #469 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018opNL4DeF5MZjpvmckKSwo
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.
A worktree's
.claudelink into the main checkout opened in the editor but failed on save with "path escapes task", and a link to files kept outside the repo could not be opened at all.I ran into this while looking at dirs within the task that pointed to outside of the task dir:

This isn't necessary to block since I already have sandbox exceptions allowing agents to write to the target dir... so the UI should be able to do the same thing.
Links out of the task now open, read-only by default:
The buffer is locked, the breadcrumb shows a Read-only badge, and Cmd+S shows a toast saying why
so the editor can save anything the agent itself can write
.termic.yamlgrants, built-in runtime paths andregex:entries never count, since a repo or termic authors them, not the user.claudeis always read-only, even if~is grantedtask_file_writableIPC tells the editor which files it can save (advisory, the write command checks again)Also fixes
write_atomic, which used a predictable temp name opened withFile::create. An agent could plant a link at that name ahead of a save and have termic write the buffer through it. It now uses a random name openedO_EXCL.Refs #250