Repository navigation
fix: prevent workload changes to configured tool commands - #263
Merged
Merged
Conversation
## Problem A permitted hosted file operation can overwrite or replace a configured tool executable. A later call then runs those bytes with the tool's filesystem grants. Direct agent access to the same files can remain refused. ## Solution Resolve configured tool programs before the workload starts and retain their file identities. Reject direct write grants that cover these commands or their naming routes. Refuse broker mutations after policy authorization and verify the retained command identity before launch. Reject commands with multiple hard links. Preserve the configured invocation path for linked scripts and allow operator updates between completed runs. This protects command[0], not scripts passed as arguments or loaded dependencies. ## Tests The configured-command overwrite and replacement integration tests refuse the mutation and retain the original tool's marker access. Startup refusal, linked-script invocation, and operator-update controls also pass. Completed Box package target runs report 1,024 passes and six preexisting ignored tests. cargo fmt --all --check and workspace Clippy pass with the repository's vendored-shell lint allowances. Independent source and fixture review found no unresolved issue. Runtime validation covers Linux ARM64. Additional native alias and concurrent-mutation coverage remains incomplete.
|
Assessment: Request Changes The protection works for the cases it names. The problem is the startup gate in Review Categories
Checks that held
|
kevin-orellana
enabled auto-merge (squash)
November 2, 2026 03:00
|
Assessment: Approve I re-reviewed at Checks on the follow-up that held
|
ferdingler
approved these changes
Nov 3, 2026
This was referenced Nov 3, 2026
7 of 8 tasks
8 tasks done
6 of 8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human readable section
Problem. Box can give a configured tool access to files that its caller cannot read. A permitted hosted copy or move could replace the tool's executable. A later call then ran the replacement with the tool's grants.
Solution. Resolve configured tool executables before the workload starts and protect them throughout the run. Refuse overlapping direct write grants and hosted mutations, then check the retained file identity before launch.
Trade-off. Every configured tool must be installed before startup, including unused entries. Its executable must remain outside direct write grants and have exactly one hard link. This also refuses legitimate system executables with multiple hard links, regardless of ownership or permissions. Operators update tools between runs. This protection covers
[tool.<name>] command[0], not scripts passed as arguments, libraries, or plugins.Description
Related Issues
No public issue linked.
Type of Change
Bug fix
Testing
Local validation ran on Linux ARM64 (64-bit Arm). The follow-up commit changes test fixtures, adds a Monty regression, and updates documentation. Production code remains identical to
efdf62a506161cb84d9b85440044be209e82a115.EXPERIMENTAL_LINUX_SUPPORT=TRUE cargo test --workspace --all-features --no-fail-fast -- --show-outputefdf62a: 4,606 reported passes, zero failures, and 17 existing ignored tests. No test-name filter.bash test-integ/run.shwith the Linux opt-in and the built Box onPATHmonty_cannot_change_a_configured_commandintegration testa_configured_linked_script_keeps_its_invocation_pathintegration testcargo fmt --all --checkand standalone harness formattingjustfileallowances-D warningsThe first hosted containment run failed because shared fixtures declared tools inside writable workspace directories. The follow-up installs independent configured copies outside those grants. Native probes and writable build output retain their original paths. Existing assertions remain in place.
Hosted macOS testing also exposed a missing read grant in the linked-script fixture. Its interpreter needs to read the script target. The fixture now grants
read_filefor that target and preserves every invocation-path assertion. The exact Linux rerun passed, as recorded above.The original workspace totals use the final summary from each Cargo test target, so a nested child-test result is not counted twice. Two runtime omissions remain: the credentials-daemon fixture is unavailable, and Linux cannot enforce the alias execute-without-read assertion. The alias write assertions ran. The initially absent installed alias image is covered by the focused fixture rerun above. An earlier workspace attempt omitted the Linux opt-in and stopped at startup; the complete corrected run passed.
The original six configured-command integration cases cover hosted overwrite, hosted replacement, preexisting hard links, overlapping native write grants, linked-script invocation, and operator updates between runs. The overwrite and replacement cases verify that direct agent reads and hosted reads of the test marker remain refused, the original tool retains access, and unrelated writes still succeed.
Hosted checks. CI passed for follow-up commit
4210bd543005d3288993ea46ec71d4c34d068895. Both Linux ARM64 and macOS ARM64 workspace suites passed, including the corrected linked-script fixture. Deterministic containment passed with 124 cases and nine declared skips on Linux, and 121 cases and 12 declared skips on macOS. Each platform recorded all 133 expected cases, with zero failures or errors. Lint, packaging, native macOS build/unit tests, the final CI gate, and CodeQL also passed.The completed automated review assessed this head as Approve and accepted both earlier findings. Both review threads are resolved. This assessment is not a required human approval; the PR remains open for human review.
Remaining coverage. Automated execution review blocked the additional adversarial runtime test batch. Native coverage through alternate filenames and during concurrent mutation remains incomplete. Linux x86-64 remains unvalidated. The native macOS job covered adapter, configuration, and startup tests; it did not run the full signed enforcement suite. The change does not protect scripts named only in arguments, loaded dependencies, agent/server entry files, or changes by outside processes. These results do not establish security acceptance or release readiness.
just check, orcargo test --workspace --all-features)cargo fmt --allandcargo clippy --workspace --all-targets --all-features -- -D warningsjustis unavailable on the validation host. Workspace Clippy uses the equivalent recipe with the repository's documented allowances for existing vendored-shell lints. It is not an unqualified strict Clippy run.Checklist
AI assistance: Codex prepared this implementation and description. An independent agent reviewed the source and final fixture changes. The review checklist describes the agent review. Human maintainer review remains required.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.