Repository navigation
fix(containment): pin Linux refusal mount targets - #159
Conversation
## Problem Linux refusal setup resolves mutable pathnames before the root pivot. A replaced component can redirect a mount or create a mountpoint on the host. ## Solution Open each target component without following symbolic links. Create missing mountpoints only outside planned host binds. Mount through the retained descriptor and require a new mount identity at the intended path. Apply the same target handling to fresh filesystems and empty-file refusals. Keep the grant-source Bind arm and public interfaces unchanged. ## Tests The final Linux ARM64 library binary passed 346 tests as a configured non-root user. All 12 refusal tests passed, including 128 concurrent replacement trials. The trials produced 64 denied established views and 64 startup refusals. They observed no outside mounts, outside writes, or changes to original authority bytes. Ancestor, leaf, missing-directory, permitted-sibling, and child-panic cases passed. The path-target mutation failed the late-replacement regressions. Formatting, the default-disabled build, and containment Clippy passed. Clippy used the repository allowance for chunks_exact_to_as_chunks. The broader workspace run stopped with Docker during compilation. Deterministic, macOS, hosted, and cloud qualification remain incomplete.
|
Assessment: Comment The two-step approach — pin each target component with Review notes
Nice work pinning the target by descriptor and verifying placement rather than trusting the path — the layered fd-then-reverify design is the right call here. |
|
Re-reviewed at The production fix is unchanged and still looks sound. My two earlier readability suggestions (the |
|
Re-reviewed at Broker fix — looks correct. The bug is that Notes
Assessment stays Comment. Nice, targeted fix with a regression test that pins down the exact partial-read timing. |
|
Updated the validation evidence for the unchanged head The Linux and macOS workspace jobs passed. Both include passing results for the partial-message and reused-program-ID regressions. Linux retains 18 containment-test exclusions; the local non-root 361-test run covers those tests. Existing ignored tests remain. The deterministic suites also passed: Linux reported 120 passes and nine platform-specific skips; macOS reported 121 passes and eight platform-specific skips. Both reported zero failures. The hosted lint job passed. CONTRIBUTING requires the The previous pending-check text was stale. I replaced it with these receipts and retained the documented local limitations. I am requesting another automated review against this updated evidence. This update does not claim formal approval or close the remaining review threads. |
|
Re-checked at I confirmed the check-runs on this exact head via the API: all 20 are green (plus one benign No new code to review. The two remaining open inline threads (the Assessment stays Comment; from my side there are no blocking items. The remaining caveats are the ones you've already documented in the description (local full-workspace run incomplete; no Runtime/Lambda/release qualification; finite replacement trials), plus the usual maintainer sign-off and #157 coordination. |
|
The #157 compatibility check is complete for the two current PR heads. Their combined code passed the full containment test suite on Linux.
I combined these heads in an isolated checkout, including their existing main ancestry. The merge needed no conflict resolution. Reversing the merge order produced the same tree.
The command was: cargo test --locked -p strands-box-containment --all-features -- --test-threads=1 --nocaptureEnvironment: Amazon Linux 2023, AArch64, kernel The initial build used Please reassess the outstanding #157 coordination note using these results. This verifies the containment interaction at the listed heads. It does not claim a combined full-workspace run, deployment qualification, or maintainer approval. Neither PR was pushed or merged. |
|
Re-checked at That addresses the last coordination note I'd been tracking: merging #157 ( From my side there are now no blocking items and no open coordination concerns. The remaining caveats are the ones you've already documented (no combined full-workspace run, no Runtime/Lambda/release qualification, finite replacement trials) plus maintainer sign-off — all outside what I can clear in review. Assessment stays Comment. |
Human readable section
Problem: Suppose Box allows access to
/workbut denies/work/project/private. On Linux, Box blocks access by mounting a cover over the denied path. If another host process replacesprojectorprivatewith a symbolic link during startup, Box can follow that link. The cover can then land at the wrong location.Solution: Box opens the target directory or file and keeps a reference to it while mounting the cover. It then checks that the cover is at the intended path. If that check fails, Box stops startup.
Trade-off: If a denied directory is missing inside a shared host directory, Box now stops startup. Previously, setup could create that directory on the host.
Description
Fresh filesystem mounts and empty-file refusals resolve each target component with
openatandO_NOFOLLOW. Missing components are created only outside planned host binds.This intentionally covers every
Freshmount: the staging root,/proc,/tmp, empty grants, and directory refusals. All use the same mount setup code and must verify where the mount landed. Setup requires the inherited/procto remain readable until Box switches into the completed filesystem view. If descriptor information or the mount table cannot be read, startup fails.Mounting uses the retained descriptor. The subsequent check reopens the intended spelling without following links and verifies a new mount identifier at that exact path. Empty-file refusals remount the verified mount read-only through its descriptor.
The tests cover ancestor and leaf replacement before assembly, replacement after the target opens, replacement with real directories, absent denied directories, and concurrent exchanges. Successful views must deny protected access while preserving sibling writes. Tests compare outside-tree contents and the original file's bytes after the child exits.
The test harness uses the existing namespace prerequisite probe and reports explicit skips when the host refuses those prerequisites. Child panics exit with failure.
The grant-source Bind arm, dependency admission, configuration schema, and public interfaces are unchanged. The combined code with #157 passed 532 containment tests on Linux at heads
c1c0300ande061220. Both merge orders produced the same tree without conflicts. See the combined validation results.Broker message reads also retain partial bytes when another call finishes. Previously, handling that completion discarded the read buffer, which could hang or close the connection. A regression sends one prefix byte and waits until the server consumes it. It then completes another call before sending the remaining bytes. Protocol fields, size limits, and timeout settings are unchanged.
AI assistance: Codex prepared the implementation, tests, and this description at the contributor's request.
Related Issues
No public issue linked. This PR does not include the private report or its artifacts.
Type of Change
Bug fix
Testing
Current head:
c1c03008b630a22342ff7000b6ef7f21a82c799b, including main atf0dc6f4. The merge keeps both loader-admission and refusal tests. Local Linux execution used Amazon Linux 2023 userspace on AArch64, kernel7.0.12-linuxkit, and Rust 1.98.1 in a dedicated privileged Docker container.cargo fmt --all -- --checkandgit diff --checkjust clippyrecipec1c0300. The job excludes 18 containment tests; the local 361-test run above includes them.c1c0300, including the partial-message and reused-program-ID regressions.just clippy.The two local broker failures are
a_protocol_error_reaps_the_open_mcp_process_groupandbroker_shutdown_joins_a_live_mcp_exchange_and_reaps_its_process_group. Both fail before and after this change in the local container. Earlier integrated test attempts exhausted the shared Docker disk; those attempts are excluded from the passing count above.Earlier refusal validation recorded 128 concurrent replacements: 64 established views with denial intact and 64 startup refusals. No outside mounts or writes occurred. A negative control using pathname mount targets failed the late-replacement regressions. The no-default-features containment build completed with existing dead-code warnings.
At prior head
afd0439, the hosted Linux ARM deterministic suite passed: 120 cases, zero failures, and nine platform-specific skips. Hosted macOS deterministic tests and Linux unit tests also passed. The macOS unit job failed the reused-program-ID test; the broker fix and regression above address interrupted frame reads. The current-head results above supersede that earlier failed macOS run.The Cargo fixture read-grant correction is now also present in main. The earlier full local
scripts/test-all.shrun stopped during workspace compilation. These results do not establish Runtime, Lambda, or release qualification. Finite replacement trials do not prove every possible schedule or host mutation after startup.just check, orcargo test --workspace --all-features)c1c0300. macOS ran the workspace with all features and no test-name filter. Linux used its documented exclusions. Existing ignored tests remain. The earlier local workspace run was incomplete.cargo fmt --allandcargo clippy --workspace --all-targets --all-features -- -D warningsjust clippybecause the vendored shell needs lint allowances. The recipe applies-D warningsplus allowances fortoo_many_arguments,only_used_in_recursion,await_holding_refcell_ref,explicit_auto_deref,chunks_exact_to_as_chunks,dead_code, andnon_snake_case. This unchecked box records that the literal command without allowances was not used. The required repository lint check passed.Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.