Repository navigation
fix: reject Linux write grants without explicit read access - #129
Conversation
## Problem Linux writable mounts also permit reads. A write-only configuration therefore grants more access than its author requested. Local-server grants also need startup approval before the agent can run. ## Solution Require explicit covering read access for every Linux write grant. Preserve read-only access and macOS write-only access. Disclose effective access for agent, tool, and local-server grants. Reuse startup-approved local-server paths and refuse changed identities. Document the Linux limitation and explicit read-write alternatives. Additional write-only enforcement is deferred. ## Tests linux_rejects_write_only_before_any_process_runs proves startup refusal across 15 configurations. explicit_read_write_succeeds_for_every_process_and_scope covers 12 configurations on each platform. read_only_preserves_contents_for_every_process covers three roles. macos_write_only_preserves_content_read_refusal covers three roles. a_local_server_refuses_a_grant_replaced_after_startup_approval proves changed paths cannot replace approved grants. Final Linux execution passed 30 cases; all 585 Linux library tests passed in a Debian 12 ARM64 container. Final macOS execution passed 18 cases and all 27 hosted tests passed. Before the local-server approval fix, all 597 macOS library tests passed. Package all-feature builds, formatting, and Clippy passed. Clippy still reports existing shell warnings and the existing tool_spawner argument-count warning. The full workspace warning-as-error gate and cloud deployment qualification were not run.
|
Issue (Important): This change moves a documented premise but leaves the decision entry that records it stale.
After this PR, Linux no longer "holds" write-only and no longer discloses it as "readable too" — it refuses the configuration at startup. Suggestion: Rewrite that |
|
Assessment: Comment (approve-leaning) A deliberate, fail-closed fix for a real contract gap: on Linux a writable bind is also readable, so Review notes
Nice, security-first change with strong end-to-end coverage proving the refusal fires before any process runs. |
|
Assessment: Approve Re-reviewed Follow-up verification
Thorough follow-up — the added sibling/overlap tests make the "write does not imply read, and neither expands beyond its grant" property explicit on both platforms. |
|
The earlier decision-entry finding is outdated after The earlier assessment repeats that finding and the lighter local-server disclosure finding. Both are superseded by the fixes in The separate CodeQL cache-poisoning annotation remains open. The workflow limits cache saves to pushes to |
|
Assessment: Approve Re-reviewed What this corrects and verifies
Nice correction — disclosing filesystem reach eagerly while deferring command resolution is the right split. |
|
Assessment: Request Changes Re-reviewed Details
The containment checkout cleanup is a nice simplification — just the one blocking item to resolve. |
|
I read this assessment and addressed the blocking claim in the inline thread: #129 (comment). The claim uses outdated syntax information. Current GitHub documentation supports the job-level cache key, and the exact manual workflow passed validation, checkout, and cache setup. Its build is in progress. The read-only cache limit remains because The The inline thread is resolved with documentation and the running workflow as evidence. No code change is needed for this assessment. |
|
Assessment: Approve Re-reviewed Details
Nice layering — pushing the floor down to the backend closes the gap where only the box config layer validated it. |
|
Assessment: Approve Re-reviewed
No behavior change. The underlying fix remains correct and well-tested. LGTM. |
Human readable section
Problem Statement: Today, we cannot exclusively support write-only grants on filesystem paths in Linux (at least with the kernel mechanism we use, which are process namespaces). Once write is granted in
box.toml, so is read, breaking the contract.Solution: For now, we fail-close (and loudly) if
writeorwrite_filegrants lack explicit covering read access on Linux. The long-term solution will be using a Landlock-based filesystem containment which allows for write-only pathing.Description
Linux writable mounts also permit reads. This change rejects writes without explicit content-read coverage before any agent, tool, or local server runs. Every write requires a read grant for the same file or an enclosing directory tree. Directory-entry reads cannot satisfy this requirement.
Containment owns the shared rule through
validate_grants. Box calls it at startup and retains authored-entry errors. The Linux namespace backend also checks direct and decoded configurations before mount planning. Containment is internal (publish = false), but its callers now receive the same refusal. Credential grants retain exact read pairing, consent, and store restrictions, plus the shared content-coverage check. The operator approved the new validator and typed refusal before implementation.Startup disclosure identifies effective access, including overlapping grants. Local servers retain approved paths and refuse replacements before launch. Server command resolution remains lazy. macOS retains write-only access.
This is a Linux platform limitation. Adding read permission remains an explicit operator decision. Landlock implementation is deferred. The configuration guide and existing design decision record the limitation and alternatives.
Related Issues
Related to #44.
Type of Change
Bug fix and documentation update. Unsupported Linux write-only configurations fail before execution.
Testing
The containment follow-up changed seven files, with 330 insertions and 17 deletions. Most additions are tests. Local checks used the source delivered in
b6634bb.bash test-integ/run.sh)The shared tests cover files, trees, overlapping grants, both grant orders, and every write in a set. They reject directory-entry, metadata, listing, execution, and sibling-prefix substitutes for content reads. Backend and serialized credential tests cover direct callers. The real Linux execution test proves refusal before the target runs.
Linux execution used privileged ARM64 Debian with an unprivileged test user. Docker storage exhaustion required executable temporary storage for test files. Cargo targets remained on disk. These results do not qualify other Linux deployment configurations.
The complete workspace run failed.
bash scripts/test-all.shreported nine failures acrossruntime_mcp_policy_stagingandbox_telemetry. Both full targets passed unchanged on serial retry: 25 MCP tests and 25 telemetry tests, with one existing telemetry ignore. The catalog ratio was 1.92 against a limit of 3.0. No test, timeout, or threshold changed.Main revision
a861691failed three of the same MCP tests: failure cleanup, the 256-page limit, and catalog performance. Main telemetry passed twice. The failure mechanisms were not all identical. The other candidate failures did not reproduce in this sample. These results establish intermittent behavior, not a repaired test defect. The original full workspace result remains red.Clippy reports existing warnings in unchanged mount, argument, tool-spawner, and vendored shell code. No warning originates in changed source. A fresh-context adversarial review found no material implementation defect. The review checked the scope, backend enforcement, credential restrictions, and mutation evidence.
just check, orcargo test --workspace --all-features)cargo fmt --allandcargo clippy --workspace --all-targets --all-features -- -D warningsThe exact checklist commands above are not claimed. The executed workspace script, package checks, retries, and limitations are stated separately. Fresh remote continuous integration and human review remain pending for this revision.
The earlier workflow change in
30b8a7cretains checkout ofgithub.shaand read-only cache access for the manual Full Tests caller. The scoped manual validation run passed. Previous green workflow results cover the previous head, not this follow-up. The human containment review thread remains open for reviewer confirmation.The follow-up in
ab359eeadds only two comments requested by automated review. It explains credential-only validation and the file/tree inputs to access disclosure. Executable code is identical tob6634bb. Formatting, whitespace checks, and independent review passed; broad test suites were not repeated.Checklist
The personal understanding attestation remains for the human contributor. The agent review is described under Testing.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.