Repository navigation
fix(#8626)!: pin the CLI binaries and their node on the trusted PATH - #8633
Conversation
The claude, codex, pi and OpenCode launches found their CLI with a bare `command -v` on the launch PATH. A sandbox image can put a directory the agent user owns first on PATH, so the launch could start a CLI the agent planted there. pi's CLI and codex's npm launcher start with `#!/usr/bin/env node`, so their node was looked up on whatever PATH the launch shell had after .env was read. Since #8591 the loader's python3 follows a stricter rule, and the CLI pins now follow it too: - envDataBinaryPin generalises the python3 lookup. It takes the first name on FULLSEND_TRUSTED_PATH, resolves it with the pinned readlink, walks the resolved path for agent-writable or agent-owned ancestors, and pins the resolved path read-only. With none it exits 127 with "fullsend: <cli> not found in a PATH directory the agent cannot write". As root it takes the first match. - envDataTrustedPin records FULLSEND_TRUSTED_PATH and a new read-only FULLSEND_READLINK once per launch. binaryPin runs it before the CLI pin, and envDataLoad now pins only python3, so no launch runs a second `readonly` of the same name (which aborts dash). EnvDataLoad and the codex and OpenCode env-read probes, which have no CLI pin, run envDataTrustedPin themselves. - binaryPin reads the pinned CLI's first line with the `read` builtin. For `#!/usr/bin/env node` it pins node by the same rule, and the launch runs `"$NODE" "$CLI"` (cliLaunch); otherwise the node pin is empty and the CLI starts as before. The PATH the CLI and its tools inherit is unchanged. The new FULLSEND_<RUNTIME>_NODE pins are on each launch's .env drop list, like the other pins. Tests run the pins under /bin/sh and dash as a non-root user. An agent-writable CLI or node earlier on PATH is not pinned, a protected symlink into an agent-writable directory is refused, and with no qualifying file the launch exits 127. Replacing the trusted-PATH lookup with `command -v` fails all 24 of those subtests. Existing launch tests mark their stub directories protected through a `test` shell function, as env_data_test.go already does. The codex goldens are regenerated. The runtime docs state the new requirement. Note: `pre-commit run` could not fetch its remote hook repositories in the sandbox (TLS failure). The local hooks (gofmt, go vet, broken-symlinks, docs-links, lychee) and the pre-commit-hooks v6.0.0 hooks were run directly and passed. gitleaks was covered by scan-secrets. BREAKING CHANGE: a custom sandbox image whose claude, codex, pi or opencode CLI, or the node that runs a `#!/usr/bin/env node` CLI, is found only through a PATH directory the sandbox user owns or can write (or through a symlink into one) now fails the launch with exit 127. Install the CLI and node in a directory the sandbox user cannot write. Closes #8626 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🤖 Review · Commit: |
|
🤖 Finished Review · ✅ Success · Started 7:21 PM UTC · Completed 7:40 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $3.39 |
Site previewPreview: https://071e64b0-site.fullsend-ai.workers.dev Commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
/fs-fix-stop |
|
Fix agent disabled for this PR. Remove the |
|
<!-- fullsend:risk-assessment --> DetailsModerate risk change driven by elevated runtime churn and a flagged breaking change for custom images, mitigated by bot authorship, zero protected paths, solid test coverage, and close scope alignment with linked issue #8626. Previous run<!-- fullsend:risk-assessment --> DetailsModerate risk change driven by elevated runtime churn and a flagged breaking change for custom images, mitigated by bot authorship, zero protected paths, solid test coverage, and close scope alignment with linked issue #8626. |
ReviewFindingsLow
Earlier findings
Previous run<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJyZXF1ZXN0LWNoYW5nZXMiLCJmaW5kaW5ncyI6W3sic2V2ZXJpdHkiOiJtZWRpdW0iLCJjYXRlZ29yeSI6ImluamVjdGlvbi12dWxuIiwiZmlsZSI6ImludGVybmFsL3J1bnRpbWUvYmluYXJ5X3Bpbi5nbyIsImlkIjoiZl83MGY1YTUxOWVmZGEzY2YyIiwibGluZSI6NDEsImFjdGlvbmFibGUiOnRydWV9LHsic2V2ZXJpdHkiOiJtZWRpdW0iLCJjYXRlZ29yeSI6InN0YWxlLWRvYyIsImZpbGUiOiJkb2NzL2NvbnRyaWJ1dGluZy9ydW50aW1lLWltcGxlbWVudGF0aW9uLm1kIiwiaWQiOiJmXzIzOGUwYzQ3NDhjZTgwMGEiLCJsaW5lIjoxMzQ5LCJhY3Rpb25hYmxlIjp0cnVlfSx7InNldmVyaXR5IjoibG93IiwiY2F0ZWdvcnkiOiJkb2Mtc3R5bGUiLCJmaWxlIjoiZG9jcy9ydW50aW1lcy9jbGF1ZGUubWQiLCJpZCI6ImZfZjcwZGY0ZDg3M2YzMTAxZiIsImxpbmUiOjI1OCwiYWN0aW9uYWJsZSI6dHJ1ZX1dfQ== --> ReviewFindingsMedium
Low
Labels: Go changes to the sandbox launch pinning (CLI and node trusted-PATH hardening). Next steps:
|
…other env shebangs The Agent tool started each child as the manifest's piBin. pi's CLI is a `#!/usr/bin/env node` script, so env looked node up on the PATH the parent inherited after .env. The launch now exports the pi and node it pinned before .env (FULLSEND_PI_CHILD_BIN, FULLSEND_PI_CHILD_NODE, both on the loader's drop list), and fullsend-agent.js starts children with them, starting none when either is missing or not absolute. nodeShebangPin pinned node only for an exact `#!/usr/bin/env node` line; any other line that starts the CLI through env (`#! /usr/bin/env node`, `env -S node`, a trailing space or CR, another program) ran the CLI with env resolving its interpreter on the post-.env PATH. Those now stop the launch with exit 127. Docs: the trusted-PATH paragraph names the CLI pin as its recorder, the readlink failure mode is described as it now shows up, and claude.md's edited paragraph is rewrapped. Assisted-by: Claude (fix), Codex (review) Signed-off-by: Wayne Sun <gsun@redhat.com>
|
🤖 Finished Review · ✅ Success · Started 7:47 PM UTC · Completed 7:59 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $3.35 |
Superseded by updated review
There was a problem hiding this comment.
Note: The following review comments could not be posted on the diff (GitHub returned 422) and are included here instead:
docs/contributing/runtime-implementation.md(file-level): Line 1013 ·
[low] stale-doc
The Agent tool contract bullet still says 'the manifest names the binary children run'. After this PR, children start through the pinned pi and node exported as FULLSEND_PI_CHILD_BIN and FULLSEND_PI_CHILD_NODE, and fullsend-agent.js no longer reads piBin. The manifest table at line 986 already says so. The rest of the rationale (extension list, tool allowlists, usage file) still holds.
Suggested fix: Drop 'the binary children run' from the list at line 1013, or point to FULLSEND_PI_CHILD_BIN / FULLSEND_PI_CHILD_NODE as the source of the child binary.
waynesun09
left a comment
There was a problem hiding this comment.
Validated in the sandbox image as the sandbox user with a node and each CLI planted first on PATH: claude, codex, pi and opencode start from root-owned paths, pi and codex through /usr/bin/node, and pi sub-agents through the same pinned pair. Go suite passes under dash, JS suite passes.
Retroactive record of the decision implemented in PR fullsend-ai#8605 (merged 2026-10-20), extended by fullsend-ai#8589 (pi) and fullsend-ai#8633 (CLI binary pinning). Hook scripts resolve their interpreter and PATH only from directories the agent cannot write. Restructured per review feedback: Decision states the rules a safe hook setup must follow (trusted location, hooks see only trusted locations, one resolver, protected to the point of use, no hook no tool call, every runtime, no untrusted fallback, nothing protectable means fail closed), with a per-runtime conformance table. Factual corrections: the shared resolver is hookPreflightInterpreter, the Claude PATH is baked into hooks.json at Bootstrap (not exported at launch), Codex hook children use FULLSEND_TRUSTED_PATH (not FULLSEND_CODEX_PATH), and pi is included (same treatment in fullsend-ai#8589, pinned python3 not Node). Signed-off-by: James Tanner <jtanner@redhat.com>
Renumber the ADR 0150 -> 0152 (0146-0151 are claimed by open PRs fullsend-ai#8679, fullsend-ai#8694, fullsend-ai#8698, fullsend-ai#8702; fullsend-ai#8702 was filed first for 0150). Per waynesun09's reviews (first round 14:56, second round 18:29): - restructure the Decision as rules 1-10 with the conformance table separated out (moved to docs/contributing/runtime-implementation.md so it can track the implementation as the code changes, linked from Consequences) - add the Options section back per the ADR template - add rules 9 (executables, not just directories) and 10 (scope) - gaps tracked in issues only: fullsend-ai#8763 and fullsend-ai#8764 linked bare, no implementation-state prose in the ADR - fold the root-launch case into rule 8 as an explicit scope precondition (accurate wording: the PATH still drops relative, empty, and missing entries as root; it cannot exclude agent-writable directories) instead of a contradictory Consequences 'limit' - cite the pre-fullsend-ai#8605 Codex behavior at the correct SHA (bbe0ab2^1 = 191d723), not unqualified line numbers - state the OpenCode exclusion in rule 6 and the conformance table (no ADR 0090 hook wiring until unbound-force#515) - fix the fullsend-ai#8589 chronology (merged earlier the same day as fullsend-ai#8605, not an extension after it) - fix the Options wording on hash verification (detects a substitution only at the next check; the ADR 0094 preflight detects at check time, not 'after the fact') - reference PR fullsend-ai#8261 explicitly as a PR - fix the architecture.md sentence to state the decision for all runtimes, not Codex only - factual corrections from the first round: the shared resolver is hookPreflightInterpreter; the boundary value is FULLSEND_TRUSTED_PATH; the pre-fullsend-ai#8605 gap was image-PATH agent-writable dirs; pi included (same treatment in fullsend-ai#8589, pinned python3 not Node) - update the conformance table Codex row to the post-fullsend-ai#8633 mechanism (envDataTrustedPin within codexBinaryPin) with the bbe0ab2 state noted Per the dual-model review round (GLM 5.3 + DeepSeek V4.1 Flash): - breaking change names the runtimes (pi has no version preflight) - forge scope before Consequences, full forge list Signed-off-by: James Tanner <jtanner@redhat.com>
Retroactive record of the decision implemented in PR fullsend-ai#8605 (merged 2026-10-20, merge commit bbe0ab2), with PR fullsend-ai#8589 (pi, merged earlier the same day) and extended by PR fullsend-ai#8633 (CLI binary pinning, issue fullsend-ai#8626): hook interpreters and hook PATH resolve only from directories the agent cannot write; hook settings are runner-held; startup is fail-closed on all runtimes carrying sandbox tool hooks. Decision stated as rules 1-10 with a per-runtime conformance table in docs/contributing/runtime-implementation.md (linked from Consequences so it tracks the implementation as code changes). Gaps against the rules are tracked in issues fullsend-ai#8763 and fullsend-ai#8764, both filed by the reviewer. The root-launch case is folded into rule 8 as an explicit scope precondition. OpenCode is excluded (no ADR 0090 hook wiring until unbound-force#515). Cross-references updated in the same PR per docs/contributing/adrs.md: ADR 0090 and ADR 0100 implementation notes, architecture.md runtime contract bullet, and the tool-call risk assessment problem doc (which previously stated pi hooks stay writable between iterations). Signed-off-by: James Tanner <jtanner@redhat.com>
Retroactive record of the decision implemented in PR fullsend-ai#8605 (merged 2026-10-20, merge commit bbe0ab2), with PR fullsend-ai#8589 (pi, merged earlier the same day) and extended by PR fullsend-ai#8633 (CLI binary pinning, issue fullsend-ai#8626): hook interpreters and hook PATH resolve only from directories the agent cannot write; hook settings are runner-held; startup is fail-closed on all runtimes carrying sandbox tool hooks. Decision stated as rules 1-10 with a per-runtime conformance table in docs/contributing/runtime-implementation.md (linked from Consequences so it tracks the implementation as code changes). Gaps against the rules are tracked in issues fullsend-ai#8763 and fullsend-ai#8764, both filed by the reviewer. The root-launch case is folded into rule 8 as an explicit scope precondition. OpenCode is excluded (no ADR 0090 hook wiring until unbound-force#515). Cross-references updated in the same PR per docs/contributing/adrs.md: ADR 0090 and ADR 0100 implementation notes, architecture.md runtime contract bullet, and the tool-call risk assessment problem doc (which previously stated pi hooks stay writable between iterations). Signed-off-by: James Tanner <jtanner@redhat.com>
Retroactive record of the decision implemented in PR fullsend-ai#8605 (merged 2026-10-20, merge commit bbe0ab2), with PR fullsend-ai#8589 (pi, merged earlier the same day) and extended by PR fullsend-ai#8633 (CLI binary pinning, issue fullsend-ai#8626): hook interpreters and hook PATH resolve only from directories the agent cannot write; hook settings are runner-held; startup is fail-closed on all runtimes carrying sandbox tool hooks. Decision stated as rules 1-10 with a per-runtime conformance table in docs/contributing/runtime-implementation.md (linked from Consequences so it tracks the implementation as code changes). Gaps against the rules are tracked in issues fullsend-ai#8763 and fullsend-ai#8764, both filed by the reviewer. The root-launch case is folded into rule 8 as an explicit scope precondition. OpenCode is excluded (no ADR 0090 hook wiring until unbound-force#515). Cross-references updated in the same PR per docs/contributing/adrs.md: ADR 0090 and ADR 0100 implementation notes, architecture.md runtime contract bullet, and the tool-call risk assessment problem doc (which previously stated pi hooks stay writable between iterations). Signed-off-by: James Tanner <jtanner@redhat.com>
Retroactive record of the decision implemented in PR fullsend-ai#8605 (merged 2026-10-20, merge commit bbe0ab2), with PR fullsend-ai#8589 (pi, merged earlier the same day) and extended by PR fullsend-ai#8633 (CLI binary pinning, issue fullsend-ai#8626): hook interpreters and hook PATH resolve only from directories the agent cannot write; hook settings are runner-held; startup is fail-closed on all runtimes carrying sandbox tool hooks. Decision stated as rules 1-10 with a per-runtime conformance table in docs/contributing/runtime-implementation.md (linked from Consequences so it tracks the implementation as code changes). Gaps against the rules are tracked in issues fullsend-ai#8763 and fullsend-ai#8764, both filed by the reviewer. The root-launch case is folded into rule 8 as an explicit scope precondition. OpenCode is excluded (no ADR 0090 hook wiring until unbound-force#515). Cross-references updated in the same PR per docs/contributing/adrs.md: ADR 0090 and ADR 0100 implementation notes, architecture.md runtime contract bullet, and the tool-call risk assessment problem doc (which previously stated pi hooks stay writable between iterations). Signed-off-by: James Tanner <tanner.jc@gmail.com>
Retroactive record of the decision implemented in PR fullsend-ai#8605 (merged 2026-10-20, merge commit bbe0ab2), with PR fullsend-ai#8589 (pi, merged earlier the same day) and extended by PR fullsend-ai#8633 (CLI binary pinning, issue fullsend-ai#8626): hook interpreters and hook PATH resolve only from directories the agent cannot write; hook settings are runner-held; startup is fail-closed on all runtimes carrying sandbox tool hooks. Decision stated as rules 1-10 with a per-runtime conformance table in docs/contributing/runtime-implementation.md (linked from Consequences so it tracks the implementation as code changes). Gaps against the rules are tracked in issues fullsend-ai#8763 and fullsend-ai#8764, both filed by the reviewer. The root-launch case is folded into rule 8 as an explicit scope precondition. OpenCode is excluded (no ADR 0090 hook wiring until unbound-force#515). Cross-references updated in the same PR per docs/contributing/adrs.md: ADR 0090 and ADR 0100 implementation notes, architecture.md runtime contract bullet, and the tool-call risk assessment problem doc (which previously stated pi hooks stay writable between iterations). Signed-off-by: James Tanner <tanner.jc@gmail.com>
Retroactive record of the decision implemented in PR fullsend-ai#8605 (merged 2026-10-20, merge commit bbe0ab2), with PR fullsend-ai#8589 (pi, merged earlier the same day) and extended by PR fullsend-ai#8633 (CLI binary pinning, issue fullsend-ai#8626): hook interpreters and hook PATH resolve only from directories the agent cannot write; hook settings are runner-held; startup is fail-closed on all runtimes carrying sandbox tool hooks. Decision stated as rules 1-10 with a per-runtime conformance table in docs/contributing/runtime-implementation.md (linked from Consequences so it tracks the implementation as code changes). Gaps against the rules are tracked in issues fullsend-ai#8763 and fullsend-ai#8764, both filed by the reviewer. The root-launch case is folded into rule 8 as an explicit scope precondition. OpenCode is excluded (no ADR 0090 hook wiring until unbound-force#515). Cross-references updated in the same PR per docs/contributing/adrs.md: ADR 0090 and ADR 0100 implementation notes, architecture.md runtime contract bullet, and the tool-call risk assessment problem doc (which previously stated pi hooks stay writable between iterations). Signed-off-by: James Tanner <tanner.jc@gmail.com>
Retroactive record of the decision implemented in PR fullsend-ai#8605 (merged 2026-10-20, merge commit bbe0ab2), with PR fullsend-ai#8589 (pi, merged earlier the same day) and extended by PR fullsend-ai#8633 (CLI binary pinning, issue fullsend-ai#8626): hook interpreters and hook PATH resolve only from directories the agent cannot write; hook settings are runner-held; startup is fail-closed on all runtimes carrying sandbox tool hooks. Decision stated as rules 1-10 with a per-runtime conformance table in docs/contributing/runtime-implementation.md (linked from Consequences so it tracks the implementation as code changes). Gaps against the rules are tracked in issues fullsend-ai#8763 and fullsend-ai#8764, both filed by the reviewer. The root-launch case is folded into rule 8 as an explicit scope precondition. OpenCode is excluded (no ADR 0090 hook wiring until unbound-force#515). Cross-references updated in the same PR per docs/contributing/adrs.md: ADR 0090 and ADR 0100 implementation notes, architecture.md runtime contract bullet, and the tool-call risk assessment problem doc (which previously stated pi hooks stay writable between iterations). Signed-off-by: James Tanner <tanner.jc@gmail.com>
Summary
The claude, codex, pi and OpenCode launches now pin their CLI by the same rule the loader's
python3has followed since #8591. The CLI must come fromFULLSEND_TRUSTED_PATH, and neither its resolved file nor any directory above it may be writable or owned by the agent user. pi's CLI and codex's npm launcher are#!/usr/bin/env nodescripts, so the launch now starts them through anodepinned by the same rule. Before,envlookednodeup on the PATH left after.envwas read.Breaking change: a custom sandbox image whose CLI, or whose
nodefor a node-script CLI, is found only through an agent-writablePATHdirectory, or through a symlink into one, now fails the launch with exit 127.Related Issue
Follows #8575 and #8591; sequenced after #8605 (merged).
Changes
internal/runtime/env_data.goenvDataBinaryPingeneralises the python3 lookup to any executable name: trusted-PATH search,"$FULLSEND_READLINK" -fwithPATH="$FULLSEND_TRUSTED_PATH", a writable-ancestor walk on the resolved path, the first match as root, and exit 127 withfullsend: <name> not found in a PATH directory the agent cannot write.envDataTrustedPinrecordsFULLSEND_TRUSTED_PATHand a new read-onlyFULLSEND_READLINKonce per launch.FULLSEND_READLINKis added to the shared drop list.envDataLoadnow pins only python3, because the launch's CLI pin has already recorded the trusted PATH and a secondreadonlyaborts dash.EnvDataLoad, the codex harness-env probe and the OpenCode trusted-env probe have no CLI pin, so they runenvDataTrustedPinfirst.internal/runtime/binary_pin.gobinaryPin(varName, nodeVar, binary)= trusted pin + CLI pin +nodeShebangPin.nodeShebangPinreads the pinned CLI's first line with thereadbuiltin. On an exact#!/usr/bin/env nodeit pinsnodeby the same rule; otherwise the node pin is empty.cliLaunchemits${NODE:+"$NODE"} "$CLI". ThePATHthe CLI inherits is unchanged.FULLSEND_<RUNTIME>_NODEpin to its.envdrop names. OpenCode's ownopenCodeBinaryPinnow usesbinaryPin.go test ./internal/runtime/ -run TestCodexGolden -update).docs/runtimes/{claude,codex,pi,opencode}.mdstate that the CLI, andnodefor node-script CLIs, must sit in aPATHdirectory the sandbox user cannot write. The pin descriptions indocs/contributing/runtime-implementation.mdanddocs/guides/dev/cli-internals.mdare updated to match.Testing
binary_pin_test.go, run under/bin/shand dash as a non-root user, for all four CLIs:PATHis not pinned, and the protected one is pinned as its resolved path and launched;nodeearlier onPATH, or one put first by a later PATH change, never runs. The protectednodestarts the CLI, and with only an agent-writablenodethe launch exits 127;command -vfails all 24 subtests of the three lookup tests.t.TempDir()mark those directories protected through atestshell function (protectedDirsShell), the techniqueenv_data_test.goalready uses.TestBuildRunCommand_ClaudeMissingExits127no longer depends on the host's/usr/bin; it failed onmainin this sandbox because a realclaudeis installed there.go test ./internal/runtime/passes. Patch coverage is 100% for every changed function./sandbox/.venv/binis skipped, claude and opencode resolve to ELF binaries with no node, and codex and pi resolve to their node scripts with/usr/bin/node.make lint:pre-commit runcould not fetch its remote hook repositories here (TLS failure). The local hooks (gofmt, go vet, broken symlinks, docs links, lychee) and thepre-commit-hooksv6.0.0 hooks were run directly and passed; gitleaks was covered byscan-secrets.mainin this sandbox (network and port tests), so they are unrelated:internal/cliTestStartFetchService_*andTestPostScriptEnv_*,internal/fetchandinternal/security.Notes for reviewers
Agenttool's child binary (piBin) is still resolved at Bootstrap withcommand -v pi(pi_bootstrap.go). It is not one of the launch pins the issue lists; it may deserve a follow-up.codex --versionand the others) still runs the bare CLI name at Bootstrap, before any agent iteration.Checklist
!for a breaking change and aBREAKING CHANGE:trailer in the commit🤖 Generated with Claude Code
Closes #8626
Post-script verification
agent/8626-pin-cli-trusted-path)bbe0ab242efec0f433ae6b744f0ba9c16293988c..HEAD)