Repository navigation
fix(cli): a confined Seatbelt turn's write grants hold only for the folders the CLI made - #3519
Merged
Merged
Conversation
…e folder, and a public seat reaps every process it started - buildSeatbeltProfile pins the state folder, and on public seats the writable scratch workspace: the turn is refused unless the folder is not a link and its realpath is its parent's realpath plus its own name. Both are folders the CLI creates. An operator-chosen workspace on a workspace-trust seat keeps today's link-following grant, since the profile cannot tell an operator's link from any other. - A public seat no longer honours COMMONLY_KEEP_PROCESS: every process the turn marked is reaped, and the reap log names the pid that asked to stay. Workspace-trust seats keep the setting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MDs9DPFVAooJnqCSwrdxVw
…every public Seatbelt adapter has a test for it - qwen passes pinWorkspace on its public Seatbelt profile. - qwen, pi, goose and opencode each get a test that a public seat whose workspace is a link is refused with nothing spawned; dropping the flag from any adapter fails its test. - pinnedRealpath resolves its input first, so a trailing "." is checked against the real folder. - Comments: a public seat given environment.workspace.path that is a link is refused; the reaper comment says only that the pin is the boundary. - The confinement probe script builds the public profile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MDs9DPFVAooJnqCSwrdxVw
lilyshen0722
commented
Nov 5, 2026
lilyshen0722
left a comment
Contributor
Author
There was a problem hiding this comment.
HEAD: f75b874 — GATE: PASS
This is an Opus review. The first round at b8fd4fc was a HOLD, because a public qwen Seatbelt profile left its writable workspace unpinned. f75b874 fixes that.
Every public file-write* grant is now pinned.
- claude: pinned on public trust. A workspace seat that gets downgraded arrives as public.
- qwen, pi, goose and opencode: pinned. Each one builds a Seatbelt profile only on its public path.
- dsh: refuses public trust, so it only ever runs private.
- The state folder is pinned on every caller.
- The only other write rules are fixed
/devpaths.
Pin check
pinnedRealpathresolves its input before comparing, so a trailing.is caught.- The grant uses that same resolved path.
Time between check and use
- Seatbelt checks each access against its resolved path.
- After the check, a swap can only break that turn's own writes.
- A link inside the granted folder is denied.
Tests: seatbelt 32/32 and qwen 20/20. On a scratch copy, removing qwen's pin and removing the resolve each turn the matching new test red. Each public adapter has a test that fails if its flag is dropped.
Reaper: it re-reads each process's start time before SIGTERM and SIGKILL, so a reused pid is skipped.
Comments: they're neutral.
Filed, not blocking:
- F200: a workspace-trust seat can replace its operator workspace with a link within one turn.
- F201: public codex seats still honour
COMMONLY_KEEP_PROCESS.
GATE: PASS
lilyshen0722
added a commit
that referenced
this pull request
Nov 5, 2026
…ame confinement rule as Claude Code and Codex (F175a) Squashed onto main 06798fa to clear a test-file conflict with #3519 (both sides added tests at the end of adapters.opencode.test.mjs; both kept). Earlier heads: 3fcd909, ae2bd1f, 4c8b485. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MDs9DPFVAooJnqCSwrdxVw
This was referenced Nov 5, 2026
lilyshen0722
added a commit
to KGKallasmaa/commonly
that referenced
this pull request
Nov 10, 2026
…a public Claude Code seat does (F201) (Team-Commonly#3522) Team-Commonly#3519 made public Claude Code seats ignore COMMONLY_KEEP_PROCESS when a turn ends. Codex still marked its turns without `confined`, so a public Codex seat kept a process the turn asked to keep. runCodex now passes `confined` for a public seat (publicSandboxMode !== null, which codex only sets for trust: 'public'); markTurn turns that into honorKeep: false. Private Codex seats are unchanged. Claude-Session: https://claude.ai/code/session_01MDs9DPFVAooJnqCSwrdxVw Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
lilyshen0722
added a commit
to KGKallasmaa/commonly
that referenced
this pull request
Nov 10, 2026
…nfined seat (D252, F175a) (Team-Commonly#3487) * feat(cli): OpenCode joins the connector grant broker set, under the same confinement rule as Claude Code and Codex (F175a) Squashed onto main 06798fa to clear a test-file conflict with Team-Commonly#3519 (both sides added tests at the end of adapters.opencode.test.mjs; both kept). Earlier heads: 3fcd909, ae2bd1f, 4c8b485. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MDs9DPFVAooJnqCSwrdxVw * test(cli): the opencode worktree fixture is a real worktree, and the .GIT write probes case folding Linux CI (git 2.56) failed two tests that pass on macOS: - The worktree test pointed a .git file at a repo that didn't exist, so git failed before the containment check. It now builds a real linked worktree. With git answering, the core.worktree check fired first and blamed a setting that isn't there, so the credential-containment check now runs before it. Which workspaces are refused is unchanged; only the message is. - The fsmonitor/hooks test wrote through .GIT/config, which doesn't exist on a case-sensitive filesystem. A real probe of the temp dir picks the spelling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MDs9DPFVAooJnqCSwrdxVw --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
@coderabbitai ignore
A confined macOS Seatbelt turn's write grants now hold only for the folders the CLI meant to grant. Public seats also always reap the processes their turn started.
What changes
buildSeatbeltProfilepins the state folder on every seat, and the writable scratch workspace on public seats. A turn is refused unless the folder isn't a link and its realpath is its parent's realpath plus its own name. The error names the folder.pinWorkspaceon public trust. pi, opencode, goose and qwen pin always, because they build a Seatbelt profile only for public seats. dsh refuses public trust, so it's unchanged.COMMONLY_KEEP_PROCESS, so every process the turn marked is reaped. The reap log names any pid that asked to stay. Workspace-trust seats keep the setting (packages/seats/src/turn-processes.js:markTurn({ confined }),honorKeep).docs/cli/README.mdnotes the public-seat exception on theCOMMONLY_KEEP_PROCESSrow.Tests
seatbelt.test.mjs: 31/31.adapters.claude.state-symlinks.test.mjs: 30/30. Covers a folder replaced by a link after prepare, refused with no spawn; a public workspace link refused; a workspace-trust operator link granted at its target.turn-leftovers.test.mjs: 6/6, with real processes.packages/seats: 264/264.adapters.claude.environmenthas the same one bwrap failure as main (environmental).🤖 Generated with Claude Code
https://claude.ai/code/session_01MDs9DPFVAooJnqCSwrdxVw