Repository navigation
feat: add Linux filesystem policy operations - #193
Conversation
## Problem The Linux native adapter needs a containment handoff argument. Mixing its interface migration with the adapter obscures review of existing launch behavior. ## Solution Add the approved fourth optional argument to Containment::apply and migrate every backend and caller. Callers pass None. A supplied handoff returns UnsupportedCapability before backend selection. Update the public documentation. Include the dependent review branch in the existing CI pull-request filter. ## Tests Box and containment all-feature suites passed 1,513 tests with six existing ignores. The library callback executable passed, including its callback-created configuration case. an_unavailable_native_handoff_refuses_before_backend_selection checks the refusal and selection order. Build, formatting, diff checks, and strict owned-crate Clippy passed. Independent review found no remaining issues. No baseline test or assertion was removed. Full workspace and native macOS checks were not rerun on this standalone branch. Hosted checks and cloud qualification remain separate.
Co-authored-by: Kevin Orellana <[email protected]>
## Problem The complete Linux native adapter is too large for one focused review. Its low-level mechanisms need independent executable coverage before product activation. ## Solution Stage notification handling, descriptor transfer, kernel identity guards, and capability cleanup behind the private kernel test build. Keep product entry points at their preparation behavior. Preserve existing component assertions and defer the broker-dependent probe test to the operation layer. Add staging bases to the existing continuous integration trigger and document component execution. ## Tests All 15 kernel component tests passed on ARM64 Linux with loader capabilities. Configuration tests passed with the product adapter unavailable. The copied-path test checks truncation at NUL and refusal of unterminated input. The disabled-guard test checks removal of active loader capabilities while retaining other capability bits. Formatting and strict owned all-target Clippy passed. Independent split and test-harness review verified this tree. Hosted checks and formal approval remain pending. This change does not establish cloud qualification.
## Problem Kernel mechanisms alone do not translate workload file requests into policy operations. The complete adapter also needs a reviewable stage before normal product activation. ## Solution Add the file-operation broker and its contained workload tests. Compile the shared launch path only with the private box_native_adapter_tests switch. Normal builds retain the existing unsupported-feature refusal, including the containment facade refusal before backend selection. Keep every moved path, directory, and replacement-race assertion unchanged. Document the test build and retain the public product activation for the final dependent change. ## Tests ARM64 Linux passed 20 kernel and broker units, 42 contained path and directory tests, and 17 replacement-race tests. Normal all-feature builds passed 136 configuration tests and the unavailable-handoff refusal regression. A normal baseline workload exited successfully, while native selection retained its existing platform-unavailable error. Feature-disabled builds, formatting, strict owned Clippy, and workspace Clippy with repository allowances passed. Independent review verified all moved test bodies, private gates, and unchanged public interfaces. Hosted checks and formal approval remain pending. Cloud native qualification and performance are separate work.
|
Assessment: Comment The native broker is carefully built and deny-by-default: it pins the Review Categories
Nice work on the host-vs-Box identity check and the extensive path/directory/race integration suites. |
ferdingler
left a comment
There was a problem hiding this comment.
I found a discrepancy between macOS and Linux with this change. For instance, an operator could allow writes to a destination but forbid moving files into it. Linux currently allows that move, while macOS blocks it because it checks move permission on both ends.
|
There’s also the reverse case: Linux requires destination write permission for a new name, while macOS doesn’t. |
|
One more thing: Is there a reason we classify a directory open as "listing" on Linux but we classify it as "content reading" on macOS? Both use the general |
|
Assessment: Comment (re-review at Since Checked and held
|
|
Assessment: Comment (re-review at This merge only brings in Checked and held
|
|
Assessment: Comment (re-review at
Checked and held
|
|
Assessment: Approve (re-review at
Checked and held
|
|
Assessment: Approve (re-review at Since Checked and held
The conflict resolutions are clean and keep each side's intent. |
Brings the containment fix that permits kill and rt_sigtimedwait for a workload that runs an init such as tini (dc1d8e8). Without it a workload started under tini dies at start. The fix branch sits on upstream 5ed679f (the v0.2.3 release commit), so this merge also brings in the four upstream commits after 941fd27, the base of dogfood/main: - e8b4ced docs(design): add path locations design doc (strands-agents#461) - aa18761 test(shell): pin that `sh FILE` is decided as `shell:exec` on `sh` (strands-agents#472) - 1ccd68a feat: add Linux x86-64 release downloads (strands-agents#475) - 5ed679f feat: add Linux filesystem policy operations (strands-agents#193) No conflicts. Git merged crates/box/{AGENTS.md,Cargo.toml}, crates/box/src/command/run.rs, crates/box/src/record/config/mod.rs, crates/box/src/run/contain/boundary.rs, crates/box/src/run/hosted.rs and docs/user/native-filesystem-policy.md automatically.
Human readable section
Problem: A Linux program can reach the paths granted by its Box configuration without a separate policy check for each file operation. Rules that govern reads, moves, and deletes therefore miss operations made directly by the program, rather than through Strands Shell.
Solution: Connect those direct, or native, file operations to Box's policy engine and shared history. Keep the existing path restrictions as an outer limit. This PR implements the operation checks and launch integration; #188 enables them in ordinary feature-enabled builds.
Example: A policy permits moving a file to an unused name but denies writing at that destination. The move succeeds. If a file already occupies the destination, replacement also needs destination write and delete permission. Denying the move at the destination blocks either case.
Trade-off: Linux activation remains limited to private test builds in this PR. The shared macOS adapter also changes: policies for directory opens must use
enumerate, while regular-file reads keepread_content. A directory rename still requires the sourceread_contentcheck on both platforms.Description
This PR targets
main. The launch and kernel prerequisites, #186 and #191, are merged. #188 remains the separate activation PR.Operation checks and launch integration
box_native_adapter_testscompiler setting, including in ordinary--all-featuresbuilds. Linux x86-64 selection remains refused.Shared notification routing. The containment supervisor answers
statfsfilesystem-information queries locally and forwards selected native operations to Box. Policy and the file-operation broker run in the same trusted Box process. A denied check prevents the operation; a full forwarding buffer pauses forwarding without discarding the pending request.Editable diagram source
Policy decisions and compatibility
read_content; source and destination each need move permission. Replacing an existing destination also requires write and delete permission there. Moving to an unused name does not require destination write permission.enumerate. Allowing listing does not satisfy the sourceread_contentcheck required for a directory rename.These semantics are the approved behavior changes. The PR adds no public Rust signature, configuration key, record version, or policy action. It also shares the selection predicate between configuration and runtime, documents unsafe-call requirements, and preserves the existing path, directory, and replacement-race assertions.
The documentation explains the Linux enforcement design, policy behavior and limits, and native test setup.
Related Issues
#127 tracks the Linux adapter. #186 and #191 are merged prerequisites; #188 activates this implementation. Review and merge #193 into
mainbefore retargeting #188 tomain.Cloud deployment qualification remains in the Linux cloud follow-up. Performance qualification remains separate. Human re-review is still required; the forwarding defect reported in the original review is repaired in this head.
Type of Change
New feature
Testing
November 16 latest-main integration
Merge commit:
b9c63c08701b805397bb6d138471361bab911fd3. Tested source tree:e7ffb4b845855ed7b97d89089fdb8664586d0e25. Included main revision:8c56aa80523884f3729a9bd1593a8efb7a9cbf8d.This second merge incorporates the subsequent macOS file-watching changes from
main. The only manual conflict resolution retains both the existing native-policy selection test and the incoming file-watching record-version test. It does not change native notification routing.Formatting, ordinary strict workspace lint, and strict package lint with the private adapter enabled passed. Focused validation on the unchanged tree produced these results:
The full-workspace, deterministic, no-default-feature, and full native kernel integration suites were not rerun on this final tree. Results below for
a455afdapply to the first merge earlier today. That earlier workspace failure remains recorded. These focused passes do not establish release-profile, cloud, or macOS runtime qualification.Earlier November 16 integration:
a455afdMerge commit:
a455afdefabd344efb607c8eaa457a767d296221. Tested source tree:f69685c264e6062cdba960763212bf5cb1aae69a.This update incorporates
mainatcb099d1d70027670fd96dc09a0c0d2be19beb49b. The conflict resolution preserves the caller-supplied Box identity (RunOptions::box_id) and upstream Shell adapter frommain. It retains Linux native setup before runtime creation and registration of selected workloads. Notification routing and the private activation setting remain unchanged.The ordinary build, formatting check, and strict package and whole-workspace Clippy checks passed. Whole-workspace lint used
cargo clippy --workspace --locked --all-targets --all-features -- -D warnings.The completed
cargo test --workspace --locked --all-features --no-fail-fastrun failed: 3,823 tests passed, three failed, and 16 were ignored. These totals sum the printed Rust test summaries, not unique assertions or checks inside the custom library harness. All 16 ignored-test declarations match the mergedmainrevision. The failures were:Each failed test passed an isolated, exact single-test rerun on the unchanged candidate and the same control on
mainatcb099d1. These six passes do not establish the cause or make the original full-workspace run a pass.The deterministic integration gate (
bash test-integ/run.sh --locked) reportedGREENwith full manifest accounting: 131 passed and ten explicitly macOS-only rows skipped, out of 141 rows. It tested the debug, all-features Box executable with SHA256591c89086de7f9d10d03a04f69c56e379bec2af0c70e70e5d893d95756241ea4, bound to the tested tree above. The harness builds itself in release mode; Box ran in debug mode. This is local Linux evidence, not release-profile or cloud qualification.Compilation with the private adapter enabled passed. The two mechanism tests and three forwarding tests passed, with no skips. The ordinary workspace run selected zero tests in each of the four native kernel integration binaries because their required private compiler settings were absent. Neither those zero-test results nor the five focused tests establish a fresh run of the full native kernel integration suites.
The builds without default features passed on both this candidate and
mainatcb099d1. All 69 warnings match exactly, including their titles, source paths, and line and column locations. This comparison found no new warnings.Portable Box identity configuration and storage tests passed. Caller-supplied Box identity end-to-end coverage is macOS-only and still requires hosted CI. The manual software development kit (SDK) tutorial was not run. The original full-workspace failure remains unresolved; this is not a blanket validation pass.
Earlier validation:
892a834and separately named revisionsAll results below belong to the stated earlier revisions. They do not establish a pass for the November 16 integration. References below to the CI-only follow-up, hosted checks, current forwarding step, or earlier lint limits retain their original historical scope.
Follow-up revision:
892a834a83935a1f6a78b75a4f616d8850e85379, tree551b8afb7f5b563364cd42145637c5c713bf7c03. Local validation ran on an ARM64 Linux development host with Rust 1.98.1.This follow-up changes only CI and documentation. The exact new CI command passed all three forwarding tests at
892a834. The earlier operations package checks below ran atb6b286c; the activation results identify their #188 revision separately. No Rust source or dependencies changed in this follow-up.Hosted checks passed in run 43468356105, attempt 2. GitHub built merge revision
43a4d991118c3fea178a8d2451b64f186bf2376a: this PR head merged intomainat70eb3af. The Linux test job and final CI gate passed in attempt 2. Previously successful jobs were retained from attempt 1. The retry ran all three forwarding regressions successfully.Attempt 1 failed when an unchanged test could not start its command-forwarding helper (
Text file busy). The same test and helper source passed atb6b286c, tested against the samemainrevision. On retry, the complete helper suite passed all nine tests. The initial failure remains recorded; its underlying cause is unproved.892a834, local and hosted)b6b286c)--no-deps, and containment formatting passed.0bf1a0cfailed all three bursts of 384 permitted reads. Repaired normal binaries passed all three and a 384-denial case. Every child completed; expected bytes, unchanged files, and process cleanup were checked. Outside-Box, disabled-feature, and 32-operation controls passed.f35e465passed all 85 selected privileged tests, including permanent 384-child regressions. These results exercise the implementation from this PR.f35e465)Text file busy. The same nine-test executable and alias then passed serially. The retry does not make the original invocation pass. See #188 for details.The hosted Linux workspace run retains 20 ignored test entries and two existing execution omissions: the real credential-daemon fixture and the executable-alias read-protection assertion. The alias write assertions ran. These limits match the passing
b6b286ccontrol; they are separate from the three forwarding regressions, which all ran without ignores.The burst runs establish the tested behavior under load, not a performance benchmark. They do not qualify cloud deployment, x86 native interception, or signed macOS interception. Earlier cross-platform and full-package evidence remains in the historical section.
just check, orcargo test --workspace --all-features)cargo fmt --allandcargo clippy --workspace --all-targets --all-features -- -D warningsThe suite checkbox records the full-workspace execution on
a455afd, which failed as detailed above; it does not claim a final-tree full-suite pass. Formatting and strict whole-workspace Clippy passed on the final tree. The matched 69-warning no-default comparison belongs toa455afd; that build was not repeated on the final tree. Earlier hosted checks, scoped lint runs, and six vendored Shell diagnostics retain their historical scope.Commands for the forwarding follow-up and earlier operations checks
The current forwarding step uses this command and requires a three-pass result in its captured log:
The broader operations checks at
b6b286cused:The real-supervisor and burst controls exercise these changes through the activation build, as distinguished in the results table.
The diagram was exported with pinned draw.io 32.4.1 at scale 2 and border 20. A control export matched the committed reference PNG byte for byte. Both diagrams passed layout checks and visual inspection at reviewer width.
Historical validation: November 12 and earlier revisions
These dated results do not establish a current-head pass. Preserve their original scope and limitations.
November 12 main refresh
Head
0567e33b0ebc460274e83dab9516ced7ff240bd4includesmainata2cf46ed6a9ea0a8144101bfdef3f2406390952bthrough an additive merge. The published commit history is preserved. The operations diff against the refreshed main branch preserves the prior feature changes.Validated source tree:
cceadbf1172b9f34a2cf7fff58bb54f7ef88c5bb. Tests ran on an ARM64 Linux development host with Rust 1.98.1.strands-box,strands-box-containment, andstrands-box-policypassed: 2,886 passed, zero failed, and 15 ignored.--no-deps, and formatting checks passed.Whole-dependency strict Clippy reports six existing diagnostics in the vendored Shell package, whose source matches
mainexactly. No lint allowances were added.The separate queue reproduction used the prior activation head
e8824597bc7f084465f900edba1dfc0f30af4c8a: 384 synchronized, permitted file opens terminated Box in all three attempts. The same workload passed outside Box and with native policy disabled; 32-operation allow and deny controls also passed. The forwarding code is unchanged by this refresh, but the 384-operation reproduction was not rerun against these refreshed heads. At this November 12 checkpoint, the defect remained unresolved. The November 13 repair and its before/after controls supersede that status.This refresh does not establish native-interception support on x86, signed macOS interception, or cloud qualification. Cloud qualification belongs to the Linux cloud follow-up. Performance qualification remains separate.
November 11 integration update
Operations commit
56b4aaeintegratesmainata41332d, including its experimental x86 baseline. Its source tree is90a29cb5. Independent composition review checks that the main changes and the native implementation are both preserved. The old combined implementation failed application startup because Linux rejected its second notification listener. The shared-listener implementation passes allowed-read and denied-read coexistence tests while filesystem-information sanitization remains active.c8d48e49.c8d48e49. The policy-semantic suite passed all 12 tests ataa70502f. The only final source change adjusts a configuration unit-test fixture for unsupported architectures; production code is unchanged. Seven notification tests and six supervisor tests passed.EBUSY.c8d48e49, with ten declared macOS-only skips and no failures.The latest Shell/native comparison passed all 66 workload assertions. The tested path-history and move-count rules now agree. One intentional decision difference remains: Linux requires write permission to replace the destination; Shell currently does not. All 66 historical event snapshots still fail against current records, which include request identifiers added on
main; those snapshots were preserved.Independent before/after tests and deliberately restored defects confirm that the new history tests detect both repairs. Native policy denials now leave earlier checks request-only, matching Shell. The two new denial regressions fail before the repair and pass after it. Real rename and open failures retain their error history. An independent reviewer reran all four new tests successfully at
8fd570e3, before the final main merge and architecture restriction. This integration does not claim complete event-history parity.Native x86 testing first exposed a C-object link failure. After that build repair, the new startup regression failed before the architecture restriction and passed after it. All five x86 startup tests and 231 configuration tests now pass, as does all-target strict lint for the changed packages. The disabled-feature control passed.
This does not qualify native interception on x86. macOS signed interception, cloud qualification, and performance testing were not rerun.
Earlier reviewed operations head
Historical head:
4c2957e55b14e094e3aa662c9d58ed81e60b2671.The first directory-policy fixture used a string where the schema requires
Box::FsReadOperation. The corrected typed policies passed. Independent review found that the new macOS test initially depended on the loader SDK guard. The pure decoder now compiles outside that guard; both conditional branches pass without weakening assertions. An ordinary build initially reused stale compiler-check configuration; rerunning the build script produced a clean all-target check. These were validation setup failures, not product fixes.Prior operation evidence
Prior checks below cover the earlier implementation or assembled stack, as labeled. They do not establish fresh coverage of the current fixes.
6ef6c23. Their production implementation remains unchanged.58d0fc2, without new lint allowances. Formatting passed.d0b3933. Its only subsequent change restricts a test helper's visibility.Historical full-stack gates and limits
The workspace log reports 4,520 passing tests, zero failures, and 17 ignores at
b5d4841, before these test and documentation repairs. The script printed its success footer. The remote disconnect lost its process exit status, so that status remains unavailable. Three host-dependent skip messages remain explicit in the review evidence.The deterministic containment run recorded 119 passes, one failure, and nine macOS-only skips across all 129 cases.
CN-L-02failed while comparing canonical and noncanonical home paths in the harness. The identical failure reproduced against freshly builtmainrevisione0af331, using the byte-identical harness sources. This is a baseline harness failure, not an introduced regression. That historical run was RED; it was not a qualification pass.The manual SDK example was not run: its documented setup requires macOS, Homebrew Python, and a Bedrock API key. Fresh execution covered ARM64 Linux. Earlier macOS compilation evidence remains a separate, prior-revision result. Cloud native qualification and performance testing remain deferred.
Earlier independent reviewers applied the repository's
feature-criticchecklist before those commits. Two weak test assertions, missing capture deadlines, missing warning documentation, and missing unsafe-code explanations were repaired. A helper visibility lint introduced during those repairs was also fixed.Authorization and identity-policy investigation was excluded. Full security sign-off, formal human approval, hosted checks, and merge approval remain outstanding. See current Checks and Reviews before merging.
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.