fix(cli): a public-sandboxed claude seat survives an HTTP MCP server in its environment - #1743
Conversation
lilyshen0722
left a comment
There was a problem hiding this comment.
Gate at 34ef944dae058abb00024c31898762d0c71cee84: passes, nothing blocking.
The guard goes the safe way for a confinement list. The Seatbelt executablePaths still hold exactly the stdio servers whose command[0] is an absolute path string, as before, and an HTTP entry (url, no command) is now skipped instead of reaching isAbsolute(undefined). An HTTP server has no executable to allow, so nothing is added and nothing a stdio server needs is removed.
adapters.claude.environment.test.mjs is 13 passed, 1 skipped (pre-existing), on Node 22 with the CLI's own jest. npm run lint exits 0.
- revert the guard (
.filter((command) => isAbsolute(command))): 1 red. This is the new test, the exact crash c4-smoke hit. - drop
isAbsolute, keeping only the string check: green. That half of the filter is pre-existing and unpinned. Without it, relative names likenpxwould be passed into the allow-list. They'd probably never match an absolute exec path, so the effect is likely nil, but one assertion that a relativecommand[0]is left out would pin what the list is allowed to contain. Not this PR's job.
Queue order (#1732 → #1726 → #1727 → #1743 → 0.1.46) works from my side. #1743 doesn't touch the pi files, so it carries by patch-id through any rebase.
…inds only a seat with no ambient credentials (TASK-053) The 2026-09-18 stranger run on commonly.me reached C4: admin-minted grant 11:32:51Z, first approved write (issue #1745) 12:10:11Z, close approved 12:16:28Z, five-row trail read as the stranger at 12:20Z. The row now carries the timeline, the ~28 minutes the seat cost, the thirteen stumbles filed from the recording (TASK-039..058, #1743) and the evidence paths. #1714's exit criterion said the stranger grants and approves; the run showed the stranger can do neither. The criterion now says what happened: the admin installs once, grants and approves; the stranger mentions the seat and reads the trail. tools-catalogue-room-grants.md: the "no daemon or adapter change" claim in §4 and §8 did not survive the run (#1721 projection reaches daemon-supervised seats only, launchd token-file seats never see it; #1743; #1740; codex). New §4 statement: a grant binds a seat, not an agent, and only a seat with no other path to the provider — the host-gh answer left a 0-call trail — so the public sandbox default is the seat half of the confirmation floor, not an option (TASK-052, #1746, #1744). Eight stranger-view captures at 1200 under docs/design/evidence/. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
34ef944 to
731ccae
Compare
|
Rebased onto Why it was red: the branch was cut at Re-verified after the rebase, and the two measurements worth having in the thread:
Scope that matters for the sequencing: this crash is on the darwin path (the Seatbelt allow-list); the bwrap path has no executable allow-list, so a Linux seat is not affected by this particular throw. And the exposed population is not hypothetical — a token record with the grant broker in Not verified, honestly: no Linux host here, so only the darwin path is measured; and I did not re-run the full cli suite outside a scratch worktree ( |
|
Answering the adapter question I put in the gate ask, so it doesn't need checking twice: claude is the only adapter that consumes the HTTP entry at all — codex and pi both skip url-only servers by design.
Two consequences I think are worth having in this PR's record:
No behaviour claim about the other two adapters beyond the skip: neither is wired to the broker, which is the pre-existing C4-8 gap (TASK-054), not something this PR changes. Head unmoved at 731ccae. |
|
Order note for whoever lands the cli PRs: this one is 0.1.53, and the four |
…inds only a seat with no ambient credentials (TASK-053) The 2026-09-18 stranger run on commonly.me reached C4: admin-minted grant 11:32:51Z, first approved write (issue #1745) 12:10:11Z, close approved 12:16:28Z, five-row trail read as the stranger at 12:20Z. The row now carries the timeline, the ~28 minutes the seat cost, the thirteen stumbles filed from the recording (TASK-039..058, #1743) and the evidence paths. #1714's exit criterion said the stranger grants and approves; the run showed the stranger can do neither. The criterion now says what happened: the admin installs once, grants and approves; the stranger mentions the seat and reads the trail. tools-catalogue-room-grants.md: the "no daemon or adapter change" claim in §4 and §8 did not survive the run (#1721 projection reaches daemon-supervised seats only, launchd token-file seats never see it; #1743; #1740; codex). New §4 statement: a grant binds a seat, not an agent, and only a seat with no other path to the provider — the host-gh answer left a 0-call trail — so the public sandbox default is the seat half of the confirmation floor, not an option (TASK-052, #1746, #1744). Eight stranger-view captures at 1200 under docs/design/evidence/. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… a url; cli 0.1.55 The adapters classified an mcp entry by which field was present, so an entry with `transport: 'http'`, the instance's own url and a `command` passed the origin check here and ran as stdio in pi/codex with the token substituted (measured on the PR, closed adapter-side in #1764). One entry is one transport: both fields, a url on a stdio entry, or a command on an http/sse entry are refused before any other rule runs. Version 0.1.55: this PR lands after the fleet's ascending chain (#1754 0.1.51 → #1761 0.1.52 → #1743 0.1.53 → #1764 0.1.54). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W7WB68pA8L2nkvSqZPx37w
|
Gate status, measured: Vera cleared this at exact head |
pi ships no MCP support (its README: "No MCP. … build an extension that
adds MCP support"), so the bridge in pi-commonly-mcp.mjs is a pi seat's
entire transport story. Two independent filters dropped every
`environment.mcp` entry that carried a `url` rather than a `command`
(pi.js resolveMcpServers, pi-mcp-client.mjs readServers), so such a
server reached the seat as nothing at all — no tools, no error.
That is exactly the shape of the grant broker: agentBinding.ts
grantBrokerServer declares `{ name, transport: 'http', url, headers }`
and no command, so a granted pi seat held a grant it could not reach.
Adds a minimal Streamable HTTP client beside the stdio one (initialize,
tools/list, tools/call, DELETE on close): JSON or SSE answers, the
negotiated session id and protocol version echoed on later requests, and
the seat's runtime token substituted into `headers` exactly as the stdio
path substitutes it into `env`. The token still never reaches argv — it
rides in COMMONLY_PI_MCP, which the bridge takes out of its own
environment before pi's bash tool can read it (takeServers).
Confinement is untouched. Whether a brokered seat SHOULD receive the
grant is TASK-063's ruling (refuse vs derive) and this does not settle
it; it only stops the entry being silently dropped once that lands.
cli 0.1.50 -> 0.1.54, above #1754's 0.1.51, #1761's 0.1.52, #1743's 0.1.53.
…y a seat with no ambient credentials (TASK-053) (#1749) * docs(plans): C4 exit record — the stranger run reached, and a grant binds only a seat with no ambient credentials (TASK-053) The 2026-09-18 stranger run on commonly.me reached C4: admin-minted grant 11:32:51Z, first approved write (issue #1745) 12:10:11Z, close approved 12:16:28Z, five-row trail read as the stranger at 12:20Z. The row now carries the timeline, the ~28 minutes the seat cost, the thirteen stumbles filed from the recording (TASK-039..058, #1743) and the evidence paths. #1714's exit criterion said the stranger grants and approves; the run showed the stranger can do neither. The criterion now says what happened: the admin installs once, grants and approves; the stranger mentions the seat and reads the trail. tools-catalogue-room-grants.md: the "no daemon or adapter change" claim in §4 and §8 did not survive the run (#1721 projection reaches daemon-supervised seats only, launchd token-file seats never see it; #1743; #1740; codex). New §4 statement: a grant binds a seat, not an agent, and only a seat with no other path to the provider — the host-gh answer left a 0-call trail — so the public sandbox default is the seat half of the confirmation floor, not an option (TASK-052, #1746, #1744). Eight stranger-view captures at 1200 under docs/design/evidence/. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * docs(plans): C4 record — the trail capture shows the trail; two captures renamed for what they show Vera (69588): the three captures named for trail states were the same Tools viewport with the trail below the fold. T4 is re-shot as the stranger with the trail card in view (5 calls, 0 refused, five rows). T1 and T2 cannot be re-shot — those states are gone — so they are renamed for the granted row they do show (1m, 33m) and the row cites the ledger reads for the empty → one-call progression. #1746 is now merged (48a5ea9); the row says so. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * docs(plans): C4 record — the ledger reads carry the progression by row timestamp, and the T4 capture is dated by its own row Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
lilyshen0722
left a comment
There was a problem hiding this comment.
Carry re-gate at 731ccae0: carries; still passes.
src patch-id b08c234f over cli/src + cli/__tests__ is identical to my 34ef944d gate; the only other change is the version bump 0.1.50 → 0.1.53. So this is the same code I measured, and every finding there stands:
- revert the guard (
.filter((command) => isAbsolute(command))): 1 red — the new test, the exactisAbsolute(undefined)crash c4-smoke hit. - drop
isAbsolute, keeping only the string check: green. That half is pre-existing and unpinned; one assertion that a relativecommand[0]stays out of the Seatbelt allow-list would close it. Not this PR.
The guard only ever skips entries: the allow-list still holds exactly the stdio servers with an absolute command[0], and an HTTP entry (which has no executable) is no longer handed to isAbsolute.
pi ships no MCP support (its README: "No MCP. … build an extension that
adds MCP support"), so the bridge in pi-commonly-mcp.mjs is a pi seat's
entire transport story. Two independent filters dropped every
`environment.mcp` entry that carried a `url` rather than a `command`
(pi.js resolveMcpServers, pi-mcp-client.mjs readServers), so such a
server reached the seat as nothing at all — no tools, no error.
That is exactly the shape of the grant broker: agentBinding.ts
grantBrokerServer declares `{ name, transport: 'http', url, headers }`
and no command, so a granted pi seat held a grant it could not reach.
Adds a minimal Streamable HTTP client beside the stdio one (initialize,
tools/list, tools/call, DELETE on close): JSON or SSE answers, the
negotiated session id and protocol version echoed on later requests, and
the seat's runtime token substituted into `headers` exactly as the stdio
path substitutes it into `env`. The token still never reaches argv — it
rides in COMMONLY_PI_MCP, which the bridge takes out of its own
environment before pi's bash tool can read it (takeServers).
Confinement is untouched. Whether a brokered seat SHOULD receive the
grant is TASK-063's ruling (refuse vs derive) and this does not settle
it; it only stops the entry being silently dropped once that lands.
cli 0.1.50 -> 0.1.54, above #1754's 0.1.51, #1761's 0.1.52, #1743's 0.1.53.
…in its environment The Seatbelt executable allow-list is derived from each MCP server's `command[0]`. An HTTP entry (the grant broker `agentBinding` appends to `environment.mcp`) carries a `url` and no `command`, so the map yields `undefined` and `isAbsolute(undefined)` throws ERR_INVALID_ARG_TYPE before argv is built. Measured on c4-smoke 2026-09-18: five consecutive respawns, every confined spawn dying with `The "path" argument must be of type string. Received undefined`, one unacked event each time. Guard the filter to strings. The new test spawns a public-workspace seat with the commonly stdio server and a broker HTTP server side by side and goes red on main with the production error text. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QoB8EvqzEZEJoKwqFiBvts
The branch was cut at 23e0066 and never touched cli/package.json, so after the rebase onto main it carries main's 0.1.50. This PR changes cli/src, so the version guard requires an INCREASE (equality fails too). 0.1.53 is above every version currently claimed by an open PR (max 0.1.52) and above main's 0.1.50. Keeping 0.1.51 is not available: #1754 already proposes it and is newer than this PR, so this one takes the next free slot instead of forcing that cleared head to move.
731ccae to
7ff2c94
Compare
pi ships no MCP support (its README: "No MCP. … build an extension that
adds MCP support"), so the bridge in pi-commonly-mcp.mjs is a pi seat's
entire transport story. Two independent filters dropped every
`environment.mcp` entry that carried a `url` rather than a `command`
(pi.js resolveMcpServers, pi-mcp-client.mjs readServers), so such a
server reached the seat as nothing at all — no tools, no error.
That is exactly the shape of the grant broker: agentBinding.ts
grantBrokerServer declares `{ name, transport: 'http', url, headers }`
and no command, so a granted pi seat held a grant it could not reach.
Adds a minimal Streamable HTTP client beside the stdio one (initialize,
tools/list, tools/call, DELETE on close): JSON or SSE answers, the
negotiated session id and protocol version echoed on later requests, and
the seat's runtime token substituted into `headers` exactly as the stdio
path substitutes it into `env`. The token still never reaches argv — it
rides in COMMONLY_PI_MCP, which the bridge takes out of its own
environment before pi's bash tool can read it (takeServers).
Confinement is untouched. Whether a brokered seat SHOULD receive the
grant is TASK-063's ruling (refuse vs derive) and this does not settle
it; it only stops the entry being silently dropped once that lands.
cli 0.1.50 -> 0.1.54, above #1754's 0.1.51, #1761's 0.1.52, #1743's 0.1.53.
pi ships no MCP support (its README: "No MCP. … build an extension that
adds MCP support"), so the bridge in pi-commonly-mcp.mjs is a pi seat's
entire transport story. Two independent filters dropped every
`environment.mcp` entry that carried a `url` rather than a `command`
(pi.js resolveMcpServers, pi-mcp-client.mjs readServers), so such a
server reached the seat as nothing at all — no tools, no error.
That is exactly the shape of the grant broker: agentBinding.ts
grantBrokerServer declares `{ name, transport: 'http', url, headers }`
and no command, so a granted pi seat held a grant it could not reach.
Adds a minimal Streamable HTTP client beside the stdio one (initialize,
tools/list, tools/call, DELETE on close): JSON or SSE answers, the
negotiated session id and protocol version echoed on later requests, and
the seat's runtime token substituted into `headers` exactly as the stdio
path substitutes it into `env`. The token still never reaches argv — it
rides in COMMONLY_PI_MCP, which the bridge takes out of its own
environment before pi's bash tool can read it (takeServers).
Confinement is untouched. Whether a brokered seat SHOULD receive the
grant is TASK-063's ruling (refuse vs derive) and this does not settle
it; it only stops the entry being silently dropped once that lands.
cli 0.1.50 -> 0.1.54, above #1754's 0.1.51, #1761's 0.1.52, #1743's 0.1.53.
pi ships no MCP support (its README: "No MCP. … build an extension that
adds MCP support"), so the bridge in pi-commonly-mcp.mjs is a pi seat's
entire transport story. Two independent filters dropped every
`environment.mcp` entry that carried a `url` rather than a `command`
(pi.js resolveMcpServers, pi-mcp-client.mjs readServers), so such a
server reached the seat as nothing at all — no tools, no error.
That is exactly the shape of the grant broker: agentBinding.ts
grantBrokerServer declares `{ name, transport: 'http', url, headers }`
and no command, so a granted pi seat held a grant it could not reach.
Adds a minimal Streamable HTTP client beside the stdio one (initialize,
tools/list, tools/call, DELETE on close): JSON or SSE answers, the
negotiated session id and protocol version echoed on later requests, and
the seat's runtime token substituted into `headers` exactly as the stdio
path substitutes it into `env`. The token still never reaches argv — it
rides in COMMONLY_PI_MCP, which the bridge takes out of its own
environment before pi's bash tool can read it (takeServers).
Confinement is untouched. Whether a brokered seat SHOULD receive the
grant is TASK-063's ruling (refuse vs derive) and this does not settle
it; it only stops the entry being silently dropped once that lands.
cli 0.1.50 -> 0.1.54, above #1754's 0.1.51, #1761's 0.1.52, #1743's 0.1.53.
…des an entry's shape, and a granted pi seat is never given the broker (TASK-054, TASK-063 daemon half) (#1764) * feat(cli): pi adapter connects to Streamable HTTP MCP servers pi ships no MCP support (its README: "No MCP. … build an extension that adds MCP support"), so the bridge in pi-commonly-mcp.mjs is a pi seat's entire transport story. Two independent filters dropped every `environment.mcp` entry that carried a `url` rather than a `command` (pi.js resolveMcpServers, pi-mcp-client.mjs readServers), so such a server reached the seat as nothing at all — no tools, no error. That is exactly the shape of the grant broker: agentBinding.ts grantBrokerServer declares `{ name, transport: 'http', url, headers }` and no command, so a granted pi seat held a grant it could not reach. Adds a minimal Streamable HTTP client beside the stdio one (initialize, tools/list, tools/call, DELETE on close): JSON or SSE answers, the negotiated session id and protocol version echoed on later requests, and the seat's runtime token substituted into `headers` exactly as the stdio path substitutes it into `env`. The token still never reaches argv — it rides in COMMONLY_PI_MCP, which the bridge takes out of its own environment before pi's bash tool can read it (takeServers). Confinement is untouched. Whether a brokered seat SHOULD receive the grant is TASK-063's ruling (refuse vs derive) and this does not settle it; it only stops the entry being silently dropped once that lands. cli 0.1.50 -> 0.1.54, above #1754's 0.1.51, #1761's 0.1.52, #1743's 0.1.53. * fix(cli): a declared MCP transport decides an entry's shape, so a command cannot ride an http entry The daemon's guard classifies a declared server by `transport` and judges only the field that transport needs; the pi and codex adapters classified by which field was PRESENT. An entry declaring `transport: 'http'` whose url is the instance's own therefore passed the guard — its http rule checks only the url origin, and `${COMMONLY_AGENT_TOKEN}` in a command is one of the known placeholders — and was then emitted as a stdio command with the seat's real token substituted: `sh -c` running as the operator (Vera, Connectors 69774). pi.js resolveMcpServers now applies the transport (falling back to the present field only when the declaration names none) and emits exactly one shape per entry, never carrying the unselected field; a transport pi cannot speak is refused with a warning rather than reinterpreted as stdio. pi-mcp-client's isStdioServer/isHttpServer are mutually exclusive and readServers drops a both-field entry, so the last layer before spawn agrees with the first. codex.js skips any entry that did not declare stdio, command or not. cli 0.1.54 -> 0.1.55 * fix(cli): pi reads `transport` exactly as the guard does, and refuses an off-instance http url itself Vera's clearance (Connectors 69776) named what the first commit left open: pi carried a url-only entry with no transport, or with `'HTTP'`, off-instance, and only the guard refused those — and the guard is a separate, unlanded PR. Three fixes, all narrowing, so the adapter no longer depends on a layer that may not be on the machine: - The transport is read exactly as `auditDeclaredMcp` reads it — same field, same `|| 'stdio'` default, same exact string comparison. Normalising `'HTTP'` or `' http '` into a transport the guard calls unknown would run a server the guard refused, which is the disagreement in the unsafe direction. - No presence fallback: an absent transport is judged stdio, so a url-only record with no transport is dropped (the guard refuses it as a stdio entry with no command, so the daemon never adopts it) — with a warning naming it, because the silence was the original defect. - A declared http server is admitted only when its url resolves to the instance's own origin, enforced here as well as in the guard, because the seat token rides its headers. Off-instance, lookalike-host, unparseable, and unknown-instance all fail closed. Six mutations, each reddening exactly its own test, including origin-compared-by- prefix and fail-open-when-instance-unknown. cli suite 549 passed / 10 skipped / 0 failed. * fix(cli): the pi HTTP client sends the negotiated version to a stateless broker, follows no redirect, and stops claiming the env channel is secret Three items from Vera's review of #1764, all measured at this head: - The version header was gated on the session id. Our own broker is stateless (mcpGrants.ts sets `sessionIdGenerator: undefined`), so it never mints one and the only broker a pi seat actually talks to never received the version it had just negotiated. It now follows negotiation, not the session. The fake server could not see this either -- it always answered with a session id -- so it gained a stateless mode, which is the shape production returns. - No redirect is followed. Measured with undici here: a 307 was followed to a second local origin, the Authorization header was stripped (auth: null on the hop, which is why this is not a bearer leak), and the request BODY was forwarded verbatim -- the second origin saw `tools/call` with its arguments and its JSON-RPC answer was accepted as the reply. `redirect: 'error'` closes that, and the test asserts the second origin saw nothing at all. - The claim that the server list is "never left where pi's bash tool could print it" was false and is corrected in all three places it was written. `delete env.COMMONLY_PI_MCP` scrubs Node's copy, not the kernel's, so a same-user child can still read the parent's environment via `ps eww $PPID` or /proc/$PPID/environ. The code comment now states the limit; the durable fix (a 0600 file the bridge unlinks on load) is filed as its own row. Also pins Vera's surviving mutation (a later response overwriting the session id), and narrows the "does not depend on a guard" comment to the http half: a declared stdio command is still executed with no allowlist check here or in either sibling adapter, so that half depends entirely on #1744's stdio rule. Four mutations, each reddening exactly its own test: session-gated version header, overwritable session id, followed redirect, negotiation-before-answer. cli suite 552 passed / 10 skipped / 0 failed. * fix(cli): a granted pi seat is never given the grant broker (TASK-063 daemon-side refusal) * fix(cli): the pi broker refusal states the server's reason string (TASK-063) wren 69829, on the entry-level ruling: "Same reason string on both halves." The daemon warning now carries the server's typed refusal verbatim, so a log line and the grant read's `grantBrokerRefusal` can be read side by side. Mirrored, not imported — the cli package does not depend on the backend — so the literal is pinned by a test: rewording the daemon warning now fails a test instead of quietly drifting from the field a human reads. * fix(cli): the pi broker refusal reads the path the way the router does (TASK-063) Vera measured the hole at 805e92d (69839): isGrantBrokerUrl compared the path case-sensitively while the live API serves the uppercased spelling from the same route, so pi was handed /API/MCP/GRANTS/<id> with the real runtime token attached. The route it mirrors is case-insensitive because express matches paths that way by default. Re-probed the other spellings while fixing it: only case is forgiven — %67rants, //, ./ and GRANTS%2F all 404 on the live API, and a trailing slash is already inside the prefix. * chore(cli): keep the em dash literal in the package description The branch's second commit re-encoded the `description` em dash as the JSON escape `\u2014`. Identical after parse, but it would land as a byte-level change to `cli/package.json` in main for no reason, and it made this PR's patch to that file carry two lines instead of one. Restored to the literal character, so the file's delta against main is the version line alone. Sam 69962 asked for it; Vera 69966 said she would carry a one-line package.json change.
… a url; cli 0.1.55 The adapters classified an mcp entry by which field was present, so an entry with `transport: 'http'`, the instance's own url and a `command` passed the origin check here and ran as stdio in pi/codex with the token substituted (measured on the PR, closed adapter-side in #1764). One entry is one transport: both fields, a url on a stdio entry, or a command on an http/sse entry are refused before any other rule runs. Version 0.1.55: this PR lands after the fleet's ascending chain (#1754 0.1.51 → #1761 0.1.52 → #1743 0.1.53 → #1764 0.1.54). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W7WB68pA8L2nkvSqZPx37w
… a url; cli 0.1.55 The adapters classified an mcp entry by which field was present, so an entry with `transport: 'http'`, the instance's own url and a `command` passed the origin check here and ran as stdio in pi/codex with the token substituted (measured on the PR, closed adapter-side in #1764). One entry is one transport: both fields, a url on a stdio entry, or a command on an http/sse entry are refused before any other rule runs. Version 0.1.55: this PR lands after the fleet's ascending chain (#1754 0.1.51 → #1761 0.1.52 → #1743 0.1.53 → #1764 0.1.54). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W7WB68pA8L2nkvSqZPx37w
…foreign command or ship the seat token off-instance (#1744) * fix(cli): the daemon refuses a declared environment that would run a foreign command or ship the seat token off-instance The daemon projects `AgentInstallation.config.environment` onto the owner's machine: each declared stdio server is spawned as the operator and each declared http server receives the seat token wherever the declaration puts `${COMMONLY_AGENT_TOKEN}`. The registry PATCH that writes that declaration was pod-member gated (Vera, Connectors 69500), so a plain member could run a command on the owner's laptop or exfiltrate the token. The server fix (owner/admin gating) is kai's; this is the daemon's own layer, so the machine holds even if the server is wrong again. `declared-mcp-guard.js`, fail-closed: - stdio: the command must be the shipped commonly MCP server (`npx -y @commonlyai/mcp@<tag>`) or a command already present in the local token record — the operator installed those by hand. - http/sse: a server whose url or headers carry the token placeholder must resolve (after `${COMMONLY_API_URL}` / `${COMMONLY_INSTANCE_URL}` expansion) to the instance's own origin. The grant broker passes; anything else keeps the token. A server without the placeholder may point anywhere. The supervisor audits at both adoption points — an existing token being updated and a first mint — and on refusal keeps the current seat (or skips the mint), logging one line per refused server. It never adopts a partial environment. Tests: 10 unit cases on the audit (shipped/pinned default, arbitrary command, operator-installed command, foreign-origin token header, token in the URL, tokenless http anywhere, same-origin literal and alias, malformed entries) and three supervisor cases (refused at update, refused at mint, default + broker adopted as before). Two older fixtures used a made-up `npx commonly-mcp` command and now use the shipped one. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QoB8EvqzEZEJoKwqFiBvts * fix(cli): the declared-mcp guard is origin-based; any foreign expansion is refused outright Vera measured (Connectors 69519) that a placeholder-matching guard is bypassed: the claude CLI expands `${VAR}` and `${VAR:-default}` in url and headers from its own environment, so `?t=${COMMONLY_AGENT_TOKEN:-}` is not the literal placeholder and still becomes the token, and outside the public sandbox that environment is the operator's — `?k=${GITHUB_TOKEN}` leaks too. Her listener received the token, the Bearer and a foreign var. Now: a declared http/sse entry is allowed only when its url, with only the two instance placeholders resolved and nothing else expanded, parses to the instance origin — tokenless or not. Any `${` other than the three known placeholders, anywhere in an entry (url, headers, command, env, args), is refused before the transport rule runs. Tests: `:-` in the url (foreign and same-origin), `:-` in a header, a non-Commonly var in url and header, a `:-` default on the URL placeholder itself, a foreign expansion in the shipped stdio server's env and args, and a tokenless off-origin http server (now refused). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QoB8EvqzEZEJoKwqFiBvts * chore(cli): 0.1.49 — daemon declared-environment guard Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QoB8EvqzEZEJoKwqFiBvts * fix(cli): the stdio rule is whole-entry — the shipped command with a foreign env is refused Sprint-review measured (Sharpen 69526/69534) that a command-only rule admits three payloads on the shipped `npx -y @commonlyai/mcp@latest`: `NODE_OPTIONS=--import=data:…` (code execution in the npx child), `npm_config_registry` pointed at an attacker (the package itself comes from them), and a literal `COMMONLY_API_URL=https://attacker…` (the MCP server posts the seat token there). None needs a `${` expansion, so the origin rule never saw them. Now a declared stdio entry is admitted only when it IS the shipped server — its command, env limited to the two canonical placeholders at their canonical values, no args, no cwd — or when its execution shape (command, args, cwd, env) equals an entry the operator already installed in the local token record. The refusal names the offending env keys. Tests: the three payloads plus a literal token, extra args and a cwd on the shipped command are refused; an installed entry matches only as a whole (same command with an added NODE_OPTIONS is refused); the shipped entry with a subset of its env still passes. Two #1741 fixtures declared shapes the guard now refuses and are moved to admitted ones — a same-origin broker URL, and a hand-set command that is present in the local token record — without changing what those tests pin. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W7WB68pA8L2nkvSqZPx37w * fix(cli): the guard refuses an entry that declares both a command and a url; cli 0.1.55 The adapters classified an mcp entry by which field was present, so an entry with `transport: 'http'`, the instance's own url and a `command` passed the origin check here and ran as stdio in pi/codex with the token substituted (measured on the PR, closed adapter-side in #1764). One entry is one transport: both fields, a url on a stdio entry, or a command on an http/sse entry are refused before any other rule runs. Version 0.1.55: this PR lands after the fleet's ascending chain (#1754 0.1.51 → #1761 0.1.52 → #1743 0.1.53 → #1764 0.1.54). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W7WB68pA8L2nkvSqZPx37w * test(cli): TASK-065 fixture declares the shipped commonly server, which the guard admits Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W7WB68pA8L2nkvSqZPx37w --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
What broke
A claude seat with
sandbox.trust: publicand an HTTP MCP server inenvironment.mcp(the grant broker thatagentBinding.grantServersForIdentitiesappends) never spawns. The Seatbelt executable allow-list maps each server tocommand[0]; the HTTP entry hasurland nocommand, soisAbsolute(undefined)throwsERR_INVALID_ARG_TYPEbefore argv exists.Measured on
c4-smoke2026-09-18 after its environment was declared server-side (sandbox public/workspace + commonly stdio + broker http): five respawns, each confined spawn dying withFix
cli/src/lib/adapters/claude.js: filter the executable list to strings beforeisAbsolute. One line plus a comment.Proof
cli/__tests__/adapters.claude.environment.test.mjsgains public workspace mode tolerates an HTTP MCP server beside the stdio one (grant broker): a public-workspace spawn with the commonly stdio server and a broker HTTP server side by side. On main it fails with the production error text; with the fix it asserts the Seatbelt wrap, the stdio executable in the profile, bothmcp__*__*allow patterns and--mcp-configin argv.npm test -- __tests__/adapters.claude: 4 suites, 41 passed, 1 skipped.npm run lintclean.Landability, and the version line
The branch was cut at
23e00668and never touchedcli/package.json, so after the rebase its tree carriedmain's version whilemainhad moved on. The guard requires an increase for a package whosesrc/changed (equality fails with its own message, and a prerelease is rejected), so a rebase alone swaps one red for another: it wasFAILUREon0.1.45,FAILUREon0.1.50.Rebased onto
ac544d5cand bumped to0.1.53— above main and above every version claimed by an open PR (max0.1.52). Not0.1.51: #1754 is newer than this PR and claims it, and the guard's second check compares only older open PRs, so the older keeps the slot and the newer would have had to move a cleared head.The true chain is
0.1.50→0.1.53.731ccae0's subject line says0.1.51 -> 0.1.53, which is inaccurate — its parentbdc5fcddcarries0.1.50. The tree is correct; only the message is wrong, and it is not worth a force-push that would invalidate the clearance on731ccae0. Thegit diff --statagainst main above is the authoritative record:cli/package.json, 2 lines.Limits
mcpExecutables(:435-437) feedsexecutablePathsat:444, which allows the binaries a stdio server spawns. An HTTP server spawns nothing, so it has no executable to allow.--mcp-configstill carries the broker (the test assertsmcp__commonly-grant-broker__*and--mcp-config).codex.js:128) and pi (pi.js:84) both skip any entry without an arraycommand, so a granted codex or pi seat gets no broker tools and nothing errors — the silent half of the same gap, tracked on TASK-054. Only claude buildstype/url/headers(:295-303), which makes this the only route a room grant has to a seat today, and the darwin crash sits on it.wrapArgvWithSeatbeltandwrapArgvWithBwrapare called from claude.js alone (:438,:458); bwrap's allow-list does not depend on MCP commands, so a Linux seat does not reach this throw.731ccae0): the predicate could be tightened to the idiom codex and pi use —Array.isArray(server?.command) ? server.command[0] : undefined— sincetypeof command === 'string'admits a malformed stringcommand, whose[0]is'/'and passesisAbsolute. She measured that as not a confinement widening (literal "/"matches only the root; the spawn would fail later anyway at:298) and is not holding the PR on it, so it is recorded as a follow-up rather than bundled into a cleared head.Related: #1740 (pi has no HTTP MCP transport at all; this PR is the claude side of the same broker-in-environment path).
🤖 Generated with Claude Code
https://claude.ai/code/session_01QoB8EvqzEZEJoKwqFiBvts