fix(tool-sandbox): grant command interpreter read of its script - #1467
Conversation
PR Review SummarySize
Affected crates
Blast radius — ContainedThis PR touches: source code Updated automatically on each push to this PR. |
There was a problem hiding this comment.
nogent code review
1 medium severity bug found.
Findings (not tied to a changed line):
- 🐛 [LOW · bug]
crates/nono-cli/src/tool-sandbox/platform/macos.rs:2590— There is a platform divergence where shebang script interpreter read support (add_interpreted_script_read) is entirely absent on macOS. This causes shebang script execution to fail withEACCESon macOS under restricted policies even when the agent's outer sandbox has read access. Implement equivalent shebang script read capability handling in macOSbuild_child_caps.
Automated code + security review. CI already covers clippy, rustfmt, tests, cargo-audit and commit-lint.
…r read of its script
ab12a45 to
ae22df6
Compare
|
Thanks — addressed the findings:
|
…er read of its shebang script
There was a problem hiding this comment.
nogent code review
2 medium findings: relative path skip bug and missing macOS platform implementation.
Findings (not tied to a changed line):
- 🏗️ [MEDIUM · design]
crates/nono-cli/src/tool-sandbox/platform/macos.rs:2590— The script read grant and trust bundle delegation is only implemented for Linux. Sibling handling is missing on macOS undercrates/nono-cli/src/tool-sandbox/platform/macos.rs, causing interpreted scripts to still fail withEACCESon macOS.
Automated code + security review. CI already covers clippy, rustfmt, tests, cargo-audit and commit-lint.
|
Fixed both — the coverage check now runs before the file is opened/classified ( |
… read of its script
… read of its script # Conflicts: # crates/nono-cli/src/tool-sandbox/platform/linux.rs
…ript A #!/usr/bin/env <interp> script re-exec's <interp> (e.g. node), which the exec gate launches as its own binary with the script as an argv path, not binary.canonical_path. Its child domain never grants the script, so module runtimes fail to read the script and its dependency tree (EACCES). Grant the child read only when an argv path is a shebang script whose resolved interpreter is the launched binary — excluding ordinary file arguments to non-interpreter commands (e.g. curl /path/file). For a matched script re-grant the covering outer read grant so the dependency tree resolves (bounded by outer_caps: nothing the caller could not already read), plus the session TLS-intercept trust bundle so the interpreter can make the caller's HTTPS calls. Signed-off-by: James Carnegie <me@kipz.org>
Signed-off-by: James Carnegie <me@kipz.org>
c784192 to
3084615
Compare
Linked Issue
Closes #1466
Summary
On Linux, when the tool-sandbox is engaged, a
#!/usr/bin/env <interp>script's interpreter is launched to run the script inside a per-exec child sandbox that grants the interpreter + its runtime baseline but not the script — which is an argv path, not the launched binary — so the interpreter getsEACCESreading its own script (and its module tree), even when the caller's session already grants the script's directory. This grants the child read of argv paths the agent's outer sandbox already permits, re-using the covering outer read grant so dependency trees resolve; bounded byouter_caps, so the child gains nothing the caller lacked. When such a script is matched, it also grants the session TLS-intercept trust bundle (otherwise given only to commands with their own proxy route), so the interpreter can make the caller's HTTPS calls.Agent Disclosure (if applicable)
crates/nono-cli/src/tool-sandbox/platform/linux.rs(build_child_caps+ newadd_interpreted_script_read/_inner); reviewedCLAUDE.mdcoding/security rules and the sibling handling from fix(tool-sandbox): grant env-shebang scripts their re-exec interpreter #1394.outer_caps(path_covered_with_access) so it never widens the child beyond the caller's own read set; argv paths are canonicalized before use.Test Plan
interpreted_script_read_grants_covered_script_and_trust_bundle(Linux): asserts a covered script's enclosing outer read grant + the trust bundle are granted, and that an argv path outsideouter_capsis not granted. Passes (cargo test -p nono-cli, Linux container).nonofor Linux and verified manually: a#!/usr/bin/env nodescript run under a profile with command policies now executes (wasEACCESon the script before); reads outside the caller's grants remain denied.#[cfg(target_os = "linux")]; hostmake ciclippy/fmt/tests pass (one unrelated attestation-signing test is a known parallel-run flake — passes in isolation).Checklist
CHANGELOG.mdif neededAgent Compliance Check (Required for AI/Automated PRs)