Repository navigation
fix(containment): retain Linux bind mount targets - #254
Conversation
## Problem Linux mount setup can follow a changed path after source validation. The saved baseline fails nested_directory_targets_do_not_create_outside_after_source_pinning and nested_file_targets_do_not_mount_outside_after_source_pinning. ## Solution Retain mount targets through preparation, attachment, and placement checks. Refuse missing targets below exposed host trees, as checked by missing_nested_targets_are_not_recreated. Resolve permitted aliases inside the staged root. The test absolute_file_alias_remains_writable_inside_the_view checks this behavior. Preserve canonical permissions and dependent mount ordering, as checked by a_read_only_directory_alias_preserves_the_canonical_write_grant and an_alias_bind_does_not_replace_nested_metadata_mounts. No public interface or policy authority changes. ## Tests The focused nested_grants suite passed 30 tests across 39 fixture cases. Its uncaptured output contains no explicit skips. The workspace suite passed with EXPERIMENTAL_LINUX_SUPPORT=TRUE; 17 tests were ignored. Containment builds passed with all features and without default features. Formatting and workspace Clippy passed with the repository's justfile allowances. The build without default features emitted 66 warnings, without a baseline comparison. The separate deterministic suite was GREEN: 124 passed, zero failures or errors, and nine declared macOS-only skips. It used debug product binaries. No scripted examples remain. The live SDK tutorial was not run. Saved baseline logs show the reported failures, but the original test body is absent from the saved baseline patch. Fresh baseline and protection-removal checks were not completed. Recursive remounts still resolve pathnames. The tests do not cover every race after mount-placement verification or every outside metadata field. Native validation covers Linux AArch64 only. Hosted checks remain separate.
|
Assessment: Request Changes The descriptor-retaining walk closes the two reported nested-target cases. One result changes for a configuration that used to run: a write protection under a skipped writable alias now refuses startup (see the inline comment). The remaining flag-remount window fails open, and the PR already holds a descriptor that would close it. Review details
Checked and held:
The test hooks around source pin, target open, and mount make the race claims checkable. |
|
Assessment: Comment (re-review of Both findings from the previous review are fixed:
One new gap remains, in the inline comment: alias-spelled protections accept any link redirect. Checked and held at this head
|
|
Assessment: Approve (re-review of The protection-redirect finding from
Checked and held at this head
Human approval and the hosted checks are still required. I could not run the namespace tests on this runner. |
Human readable section
Problem: Linux mount setup can use a changed path after validating a filesystem grant. A nested target can then reach an unintended location.
nested_directory_targets_do_not_create_outside_after_source_pinningandnested_file_targets_do_not_mount_outside_after_source_pinningcover the reported directory and file cases.Solution: Retain open references while preparing and attaching bind mounts. Refuse missing targets inside exposed host trees. Resolve permitted aliases inside the staged filesystem. Apply permissions through the retained mount, then check its flags and placement.
Trade-off: Setup refuses when a nested target disappears or the final placement check cannot confirm the same mount.
missing_nested_targets_are_not_recreatedand theremount_flagstests pin these refusals. Legitimate nested grants remain usable, as checked bylegitimate_nested_directory_and_file_grants_remain_usable.Description
The repair extends the existing mount-target mechanism behind the current filesystem grant contract. It changes no public interface or policy authority.
Enclosing mounts precede descendants, and canonical source mounts precede aliases that depend on them. An alias reuses its canonical mount when object identity and access flags match.
a_read_only_directory_alias_preserves_the_canonical_write_grantchecks permission preservation.an_alias_bind_does_not_replace_nested_metadata_mountschecks mount ordering.Alias traversal remains bounded and follows normal filesystem ordering inside the staged root.
directory_alias_resolves_a_link_before_its_parent_componentchecks link resolution before a parent component.absolute_file_alias_remains_writable_inside_the_viewchecks absolute aliases.an_authored_alias_replaced_with_a_loop_refuses_startupchecks refusal.Write-protected files also use permitted aliases.
a_protected_file_under_an_earlier_writable_directory_alias_remains_read_onlyand its later-alias counterpart cover both orders. Additionalprotection_aliascases cover a linked read tree, a file alias, missing targets, loops, and replaced object identity. Protection targets are never created.A protection alias must stay at the verified location of the writable grant that produced it, plus the protected file's canonical relative path. Recording the actual grant location preserves an alias within a separately bound read tree. A check against only the authored target or canonical source would reject that supported composition.
an_independent_writable_directory_alias_keeps_its_protection_and_sibling_writechecks a separate alias bind. The relative and absolute descendant-redirect tests require the new location refusal before mounting protection.Permission remounts retain the newly attached mount reference. A separate pathname identifies descendant mounts for recursive permission changes. Final checks verify the retained mount's flags, identity, and placement. Eight
remount_flagstests cover file and directory grants across four write/execute combinations, each with unchanged and replaced-ancestor controls.a_submount_under_a_read_only_grant_is_also_read_onlychecks a retained top reference with a real nested mount.Codex assisted with implementation, tests, documentation, and review.
Related Issues
Related: #159, #160.
Type of Change
Bug fix
Testing
Review status: All three hosted findings have follow-up corrections. Final independent adversarial review found no remaining concrete source defect. Local validation passed for
a3b14f59b0ed036f2c1ce7f1efd05a96f5bf274b. The renewed hosted assessment reports "Approve" with no new findings on this head. The required hosted check and all applicable test jobs passed. This pull request is ready for human review. Formal human approval remains required.Local validation ran on native Amazon Linux 2023, AArch64, with Rust and Cargo 1.98.1. The frozen six-file source manifest matches
a3b14f59b0ed036f2c1ce7f1efd05a96f5bf274b, whose parent is73ce032a5cb569a4b399ad130bcf44da788a5aca.just check, orcargo test --workspace --all-features)cargo fmt --alland the workspace Clippy command prescribed byjust clippy, including its documented allowances.CONTRIBUTING requires the lint allowances in
justfile. The exact workspace recipe passed. A previous separate run without allowances failed on six existing vendored Shell diagnostics.EXPERIMENTAL_LINUX_SUPPORT=TRUE cargo test --workspace --all-featurestoo_many_arguments,only_used_in_recursion,await_holding_refcell_ref,explicit_auto_deref,chunks_exact_to_as_chunks,dead_code,non_snake_case.cargo build -p strands-box -p strands-box-containment --all-features: exit 0.bash test-integ/run.sh: GREEN; 124 passed; zero failures or errors; nine declared macOS-only skips. Debug product binaries and release test harness.e4ca8b8diagnostics by code, message, and primary source file. Zero added or removed warnings. No baseline test or workload ran.Evidence limits:
unknown. The local driver records the source manifest and selected product hash. Hosted checkout logs identify mergebaccc7cc08a880a39772a17cb596bd7bc25640be, combining maine4ca8b8with this head. Hosted logs confirm the release product path; the macOS artifact retains no product hash or binary bytes.Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.