Repository navigation
feat(containment): match macOS tool execution on Linux - #131
Conversation
## Problem Linux tools cannot execute programs or load libraries that they write into their granted directories. The unchanged baseline fails CN-X-04 at both operations. ## Solution Apply the existing broad-execution setting to Linux tools and stdio servers. Permit code execution through their readable and writable file and directory grants. Keep agent execution restrictions, automatic temporary mounts, denied paths, and protected files unchanged. Disclose the permission at startup without adding configuration fields. ## Tests CN-X-04 passes on Linux and macOS and fails on the unchanged Linux baseline. The new Linux kernel test covers written helpers, denied paths, protected files, temporary files, and agent denials. The plan test covers file grants, directory grants, metadata entries, and device mounts. The boundary test covers leaf-only wiring and disclosure. Containment suites report 359 Linux and 277 macOS passes, with one and two existing fixture skips. Linux Box units report 583 passes with one installed-alias lookup skip. Harness units report 89 passes. Formatting and workspace Clippy pass with the existing CI allowances. Full workspace and full deterministic suites were not run. Amazon Linux's deterministic harness still lacks an agent library grant before this case starts.
|
Assessment: Comment (one blocking question to confirm before merge) The mechanism is clean and well-tested: the change ports the existing Review themes
Nicely scoped change with strong denial coverage on both platforms. |
|
/strands review |
|
Assessment: Approve Re-reviewed at Thread resolution
One open item is a maintainer action, not a code defect: reconciling the "macOS-only" wording in the root and |
Human readable section
Problem: Linux tools can create programs and libraries in permitted directories, but Box prevents them from running or loading those files.
Solution: Apply the existing macOS behavior to Linux: let tools run helpers and load libraries from paths permitted by their
box.tomlconfiguration.Trade-off: A tool can now execute code that it creates or changes in a writable directory. The agent keeps its existing execution restrictions.
Description
The existing
broad_execsetting implements this behavior for declared tools and servers that communicate through standard input and output.Box discloses the permission at startup. It adds no configuration fields or automatic access to host directories.
Private temporary mounts, denied paths, and protected files remain non-executable.
The requester explicitly approved extending macOS tool execution permissions to Linux before implementation.
The tool execution decision records the rationale and cost.
Library packs and broader compiler qualification remain separate work.
Automated Git and Cargo fixture changes remain a separate follow-up; this PR retains their original quarantine entries.
Additional helper trials at this PR revision are summarized in Testing below.
The root and Box crate
AGENTS.mddescriptions still need a maintainer update from macOS-only behavior.Codex prepared and tested this change. An independent agent performed an adversarial review and found no confirmed defects.
Related Issues
No issue closes through this PR.
Type of Change
New feature
Testing
CI passed on both platforms. Local
just checkfailed two unchanged startup tests; the exact bare Clippy command also failed on existing warnings.The checked items use the passing workspace CI run and the Clippy recipe required by
CONTRIBUTING.md. Local failures remain documented below.CN-X-04, the tool execution and library-loading test, passes on ARM64 Debian and native macOS.It creates previously absent outputs, verifies that the tool runs and loads them, and verifies that the agent cannot.
The same test fails both operations on unchanged Linux baseline
913f5367f57424b3bda65dc4a05278a5664f635d.The new Linux kernel test also checks readable helpers, denied subtrees, protected files, ungranted programs, and private temporary output.
Successful host controls confirm that the test programs work before containment.
Existing validation refuses missing grant roots; new outputs inherit their permitted parent directory's mount permissions.
7f6baebjust checkThe macOS CI retry passed without source changes. The CI workflow completed successfully.
The first attempt failed the unchanged catalog timing test: ratio 3.13 against a 3.0 limit.
Additional helper trials (October 21)
Git and Cargo passed on ARM64 Debian 12 and Amazon Linux 2023 containers using the unchanged product build at
7f6baeb.The Git fixture patch and standalone probes are outside this PR.
Git initialized a repository, staged a file, committed through a real pre-commit hook, and read the log.
Host checks confirmed that the commit existed.
The Debian run used the restored Git fixture; Amazon Linux used a separate probe with explicit library grants.
Git required its helper directory and the hook interpreter in the tool grants.
Cargo 1.98.1 compiled an offline crate, linked through GCC, executed its build script, and ran the generated output.
It used explicit Rust toolchain, library, and compiler grants, plus a dedicated directory containing linker-helper aliases.
Amazon Linux also required
/usr/libexec/gcc/aarch64-amazon-linux/11.Cargo selected the installed Cargo and Rust binaries directly; these trials did not exercise Rustup toolchain selection.
A whole
/usr/bingrant and symlink file grants remained refused.Both workflows passed read-only write, ungranted-program, protected-configuration, direct-agent execution, and missing-tool denial checks.
Cargo also refused an undeclared copy beside its permitted output.
On unchanged baseline
913f536, Git ignored the non-executable hook, and Cargo could not execute Rust (Permission denied, OS error 13).These privileged containers shared LinuxKit kernel
7.0.12; their results do not establish native Linux or cloud qualification.The separate Git fixture patch passed 90 harness unit tests.
Its full manifest remained RED: 107 passes, one setup error, and 21 skips.
Two test targets failed during unchanged host-tracing setup, before containment.
The Cargo fixture remains quarantined, and the standalone Cargo trial did not rerun the full suite.
These additional results do not replace the CI results or remove the validation limits below.
Commands and validation limits
Commands included
cargo test -p strands-box-containment --all-features, the Box boundary test filter, andcargo test --manifest-path test-integ/Cargo.toml cn_x_04 -- --nocapture.The Linux Box unit binary ran as a non-root user with an init process and controlled environment.
Workspace Clippy used the allowances in
.github/workflows/rust-test-lint.yml; the bare command below reports warnings in unchanged code.Local
just checkpassed formatting and configured Clippy, then failed two unchangedbox_projecttests after 60-second startup timeouts:a_policy_edited_during_a_run_governs_the_next_run_and_not_the_running_oneanda_run_on_a_running_box_is_refused_before_it_touches_an_alias.An isolated rerun reproduced the first timeout.
A process sample showed Box blocked writing stderr while the test waited for startup without draining its captured output.
The run stopped at this suite; later suites did not run locally.
cargo fmt --allpassed without source changes.The exact bare Clippy command failed on seven existing lint findings: six in vendored shell code and one in unchanged trampoline code.
These lints are covered by the repository's existing allowances.
CONTRIBUTING.md explicitly requires
just clippyfor those allowances.The Amazon Linux deterministic harness failed before the parity case because its agent lacked the
libpcre2-8.so.0grant.The Linux kernel test passed in that environment.
The Linux library-denial assertion depends on glibc error text, so its portability is limited to the current test environments.
cargo test --workspace --all-features); the current commit passed on both platforms.cargo fmt --alland the repository-supported Clippy recipe (just clippy); both passed with the required lint allowances.Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.