Skip to content

Release summary sandbox can read host toolchain directories #2230

Closed

Description

@JacobStephens2

Finding

Spec #2054's Implementation Decisions say the release summary Session runs "inside the fresh-home bwrap sandbox (binding only Harness binary/credentials and an empty temporary directory …)", and Story 14 asks for "no host filesystem read access". The exception that the Spec branch adds to ADR 0013 says the same. In practice, the release summary sandbox also binds the host's toolchain roots read-only (~/.cargo, ~/.rustup, ~/.nvm, plus $CARGO_HOME, $RUSTUP_HOME and $NVM_DIR), and the written-out Factory skills directory too.

Evidence

  • src/release/summary.rs (write) builds its sandbox with sandbox::prepare. It passes skills_dir: &crate::skills::written_out()?.
  • src/sandbox.rs (prepare) always calls toolchains_into(request.home, …), which binds every existing root from toolchains() read-only. conceal_toolchain_credentials blanks only Cargo's credentials and credentials.toml.
  • The Spec review of PR Spec: thirdshift release Command and Pass for scheduled and on-demand releases #2162 proposed this test in tests/release/native.rs. On the Spec branch it fails: the fake Harness can read ~/.nvm/host-only.txt from inside the sandbox.
#[test]
fn release_summary_sandbox_binds_no_host_toolchain_directories() {
    let release = Release::new();
    shipped(&release);
    let nvm = release.root().join("home/.nvm");
    fs::create_dir_all(&nvm).unwrap();
    fs::write(nvm.join("host-only.txt"), "host file").unwrap();
    let binary = release.bin().join("claude");
    fs::remove_file(&binary).unwrap();
    write_executable(&binary, &format!(r#"#!/bin/sh
if [ "$1 $2" = 'auth status' ]; then exit 0; fi
cat >/dev/null
if [ -r '{nvm}/host-only.txt' ]; then summary='Host file readable'; else summary='Sealed summary (#2).'; fi
printf '%s\n' '{{"type":"system","subtype":"init","session_id":"release-summary-test"}}'
printf '{{"type":"result","subtype":"success","is_error":false,"result":"%s"}}\n' "$summary"
"#, nvm = nvm.display()));
    let output = with_input(command(&release, "").arg("--patch").env_remove("NVM_DIR"), "");
    assert!(output.status.success(), "{}", stderr(&output));
    let body = release.pr_body("release-0.1.1");
    assert!(body.contains("Sealed summary (#2)."), "summary Session read a host toolchain file: {body}");
}

cargo test --locked --test release -- release_summary_sandbox_binds_no_host_toolchain_directories panics with summary Session read a host toolchain file.

Raised by

The Spec-axis code review of #2162 (Spec #2054).

Why this needs a decision

This needs a call on how strict the sandbox should be, and on which Harnesses must keep working.

Narrowing the binds is not a safe mechanical fix:

  • harness_into binds only the npm package for Kimi Code (dist/main.mjs) and gets node from the bound ~/.nvm. Dropping the toolchain binds for the release Session would break release summaries on any npm-installed Harness.
  • The Rust toolchains (~/.cargo, ~/.rustup) and the skills directory are not needed by any Harness's tool-less summary. Removing just those leaves ~/.nvm readable.

Cargo registry credentials are already blanked, so no known secret is exposed. The gap is between what the Spec and ADR 0013 promise and what the shared sandbox does.

The Day shift should choose one of these:

  1. Narrow the release sandbox. This could bind only a Harness's own runtime, which would need new per-Harness plumbing in src/sandbox.rs.
  2. Amend the ADR 0013 exception and the manual to say that read-only toolchain roots, with credentials concealed, are bound.
  3. Refuse npm-installed Harnesses for release summaries.

Decision

Option 1, kept narrow so it needs no general per-Harness plumbing. The release summary Session keeps the Spec's promise of no host filesystem read access:

  • The release summary sandbox binds no toolchain roots (~/.cargo, ~/.rustup, ~/.nvm, $CARGO_HOME, $RUSTUP_HOME, $NVM_DIR) and no skills directory. Other Sessions keep today's binds; only the release summary path changes.
  • When the Harness is npm-installed and needs node, bind only the resolved node executable (the canonical path harness_into would otherwise reach through ~/.nvm) read-only, at the path the Harness expects. Nothing else under ~/.nvm is visible.
  • If node can't be resolved, fail the summary Session so the existing fallback (patch plus non-duplicated generated notes) applies. Don't widen the binds.

Tests: the release_summary_sandbox_binds_no_host_toolchain_directories test above passes, plus a test showing an npm-installed fake Harness still writes the summary with only node bound. Keep the ADR 0013 exception and the manual's wording as they are, since the code now matches them.

Activity

  1. added
    needs-triage
    in-progress
    and removed
    needs-triage
    on Nov 14, 2026
  2. JacobStephens2 commented on Nov 14, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Investigation Summary

    Confirmed against main (c0b4f35c) and open PR #2162 (issue-2054, implementing Spec #2054):

    • Base branch vs. PR Spec: thirdshift release Command and Pass for scheduled and on-demand releases #2162: src/release/summary.rs and the ADR 0013 Exception (#653) live on open PR Spec: thirdshift release Command and Pass for scheduled and on-demand releases #2162 and have not landed on main yet (on main, src/harness/summary.rs still runs release summaries unsandboxed). src/sandbox.rs lives on main and is not modified by PR Spec: thirdshift release Command and Pass for scheduled and on-demand releases #2162.
    • Confirmed sandbox mounts: src/release/summary.rs (write) calls sandbox::prepare (src/sandbox.rs:438-574) with skills_dir: &crate::skills::written_out()?. sandbox::prepare unconditionally binds request.skills_dir read-only (src/sandbox.rs:496) and calls toolchains_into (src/sandbox.rs:497, 728-775), which binds every existing directory among $RUSTUP_HOME, ~/.rustup, $CARGO_HOME, ~/.cargo, $NVM_DIR, and ~/.nvm read-only at its host path and prepends discovered cargo/rustc/node/npm/python3/php bin directories to PATH (tool_bin_dirs, src/sandbox.rs:808-839). conceal_toolchain_credentials (src/sandbox.rs:780-801) masks only <root>/credentials and <root>/credentials.toml, leaving any other file under those toolchain roots readable.
    • Additional host-home mounts for context: home_into (src/sandbox.rs:844-933) also binds user-level Harness configs, instructions, and hooks read-only (user_file, such as .claude.json, .claude/settings.json, .claude/hooks, .codex/config.toml, .gemini/settings.json, .grok/settings.json, .config/opencode/opencode.json), while base_argv (src/sandbox.rs:688-723) binds /usr, /bin, /sbin, /lib, /lib64, /etc, /usr/local, and /opt read-only. This matters because agy still permits file reads in summary mode (src/harness/agy.rs:83-86).
    • Why ~/.nvm cannot simply be dropped without a decision: harness_into (src/sandbox.rs:1308-1359) binds only the npm package directory (dist/main.mjs + package.json) for Harness::Kimi (@moonshot-ai/kimi-code) and only the single resolved executable for Claude, Agy, Grok, Muse, and OpenCode. When node is installed via nvm, npm-installed Harnesses rely on toolchains_into binding ~/.nvm / $NVM_DIR and exposing node on PATH.

    Decision Needed from the Day Shift

    Because this touches a trust/security boundary and contradicts the current Spec #2054 / PR #2162 ADR 0013 exception wording, please choose an approach (and whether to fold it into open PR #2162 before merge or fix it in a follow-up PR):

    1. Narrow the release summary sandbox: Make skills_dir and toolchains optional on sandbox::Request so release summaries omit skills_dir, ~/.cargo/$CARGO_HOME, and ~/.rustup/$RUSTUP_HOME (none are needed for tool-less summaries), and bind only the resolved node runtime binary/directory rather than all of ~/.nvm/$NVM_DIR (plus decide whether home_into's user_file mounts should also be omitted or kept for release summaries).
    2. Amend Spec Spec: thirdshift release Command and Pass for scheduled and on-demand releases #2054, ADR 0013 Exception (agy release summaries can still read local files #653), and the manual: Either drop skills_dir and Rust toolchains while documenting the read-only node/nvm bind, or document that the shared sandbox binds read-only toolchain roots with Cargo registry credentials concealed.
    3. Refuse npm-installed Harnesses for release summaries: Drop toolchains_into and skills_dir from release summaries so no host toolchain directory is readable, and refuse (or fall back to patch + GitHub generated notes on) any Harness requiring nvm/node.
  3. added
    bug
    ready-for-human
    ready-for-agent
    and removed
    in-progress
    ready-for-human
    on Nov 14, 2026
  4. added
    in-progress
    and removed
    ready-for-agent
    on Nov 15, 2026
  5. removed
    in-progress
    on Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions