Repository navigation
fix(containment): keep Linux metadata-only parents empty and read-only - #157
Conversation
## Problem A refusal beneath a metadata-only directory removes that directory's read-only mount. Under the private /tmp filesystem, the workload can then create sibling files without a write grant. ## Solution Keep the metadata-only mount. Prepare each refused descendant's mountpoint once inside its fresh filesystem, then remount the parent read-only before continuing. Keep the existing refusal mounts and authorized-descendant behavior. ## Tests The regression a_refusal_beneath_a_metadata_only_directory_establishes failed with the original implementation when a sibling write succeeded. It now checks both parent levels, refused trees and files, repeated file refusals with write protection, writable /tmp scratch, and unchanged surrounding files. A separate red run caught duplicate preparation before target deduplication. The planner test a_refusal_keeps_its_metadata_only_ancestor_read_only passes. Final Linux ARM64 results: 334 containment unit tests and 107 integration tests passed without skips. All test targets built with all features. Linux clippy passed with the repository's documented allowances. cargo fmt --all passed. macOS just check passed formatting and workspace clippy, then failed two box_project startup waits. The full workspace suite did not finish. Additional macOS deterministic checks and hosted review remain pending. No cloud target or release qualification is claimed.
|
Assessment: Comment (approve-leaning) Well-scoped, well-reasoned fix for the #145 regression. The planner correctly stops treating a refused descendant as a reason to drop the metadata-only parent, and the setup phase prepares refusal mountpoints inside the still-writable parent before remounting it read-only. Mount ordering (shallow-first), the "covered refusal" skip, and the duplicate-denial dedup all line up so the approach holds together, and the strengthened real-Linux test exercises the key paths (parent levels, file/dir/duplicate denials, usable Review notes
Nice job pinning each behavioral claim with a named test and reproducing the duplicate-denial |
|
Assessment: Approve Re-reviewed at What changed and why it's better
Correctness holds: a parent with an authorized descendant is never a fresh empty root (the planner skips it), so no authorized content is dropped; refusals/protections under an empty read-only parent are genuinely redundant; and Testing is thorough: the regression test is parameterized over Nice turnaround — correcting the implementation to keep |
|
Assessment: Approve Re-reviewed at What changed since the last review
Two minor, non-blocking test-quality notes inline:
Good instinct isolating the timing test into its own binary. |
Human readable section
Problem: Denying a private child path could accidentally let a process create files in a parent directory where it had no write permission.
Solution: Keep the metadata-only parent empty and read-only. Metadata-only access lets the process inspect and enter that directory, without exposing child names or contents.
Example: The host has
/tmp/project/box/private/record. The operator grants metadata-only access to/tmp/projectand denies access to/tmp/project/box/private.Before this fix, adding that denial let the process create
/tmp/project/new.txtinside Box's private filesystem. The host's files stayed unchanged.After this fix:
/tmp/project./tmp/project./tmp/project/new.txt./tmp/project/box/private/record.The executed Linux regression test checks these operations and confirms that host files remain unchanged. This example uses simplified paths.
Trade-off: Hidden children appear absent, including denied files. Explicit child grants retain their existing precedence.
Description
This fixes the regression introduced by #145 without exposing denied path names. The planner no longer treats a refusal as an authorized descendant that displaces a metadata-only mount.
After planning all refusals and write protections, it removes only descendant overlays already hidden by a final empty grant. Their redundant parent protections are also omitted. Denials and protections outside that empty grant remain. Fresh filesystems mount read-only immediately; no placeholder creation loop or temporary writable phase is needed.
Related Issues
Follow-up to #145.
Type of Change
Bug fix
Testing
Test repair validation
Updated to
e061220. The main merge includes the explicit Cargo-home read grant from #151. The compiler fixture also declares its linker plugin and/usr/lib64where present, matching #160. Its private-file, malicious-library, and hard-link refusal assertions remain unchanged.The catalog timing check now runs in its own test binary. Its measured operation, assertions, timeouts, and ratio limit of 3 remain unchanged. This removes concurrent policy-staging workloads from that binary. Their interference is a suspected cause of the historical timing failure, not a proved root cause.
chunks_exact_to_as_chunksallowance.Hosted checks are queued for this revision. These affected-suite results do not claim a full local workspace run. Earlier evidence below retains its original revision and scope.
Original local evidence covers
6b202a6, based on7cf6bad.0202a4abecause a metadata-only directory exposed names. It passes after this correction.--all-features.a_refusal_beneath_a_metadata_only_directory_establisheschecks empty enumeration, metadata access, directory entry, denied writes, absent children, and usable unrelated/tmpstorage. It runs both without and with a broader outer read-write grant. Single and repeated file denials overlap write protections. Outside denial/protection controls remain effective, and surrounding files retain their original bytes.Linux tests used ARM64 LinuxKit
7.0.12-linuxkit, Rust1.98.1, UID 65534, and no container capabilities. The disposable Docker runner permitted namespace-related syscalls and unmasked system paths. These tests do not qualify Runtime or Lambda MicroVM deployments.Baseline exceptions: Local macOS workspace tests hit two
box_projectstartup timeouts. The local deterministic harness hita_stream_accepted_during_stop_is_shut_down_and_stop_stays_bounded. All three failures reproduced on unchanged7cf6bad. The hosted Linux Cargo workflow test,CN-W-06, also fails before namespace setup because its fixture grants writes tocargo-homewithout reads: base failure, current PR-head failure.Draft status: Earlier head
0202a4apassed hosted Linux/macOS unit tests, lint, native macOS build/tests, macOS deterministic tests, and code scanning. The automated re-review of6b202a6recommends approval and confirms both original concerns are resolved. This is a bot recommendation, not a formal approving GitHub review. Remaining hosted checks are running.just check, orcargo test --workspace --all-features)cargo fmt --allandcargo clippy --workspace --all-targets --all-features -- -D warningsChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.