Repository navigation
feat(box): choose native file checks for each workload - #113
kevin-orellana merged 11 commits into
Conversation
…acOS ## Problem Direct filesystem calls inside contained workloads bypass Dogwood policy. Filesystem reach grants cannot apply history-based rules to these calls. ## Solution This adds global, explicit native filesystem policy selection on macOS. Selected open, create, unlink, rename, and truncate requests use the existing policy engine and durable history. Containment remains a separate restriction. Enable the Cargo feature `native-filesystem-policy`, then set: ```toml [experimental-features] native-filesystem-policy = true ``` The feature requires macOS 27, its SDK, and a signed executable with Apple's Endpoint Security entitlement. Standard release artifacts exclude it. Missing support refuses startup before workload launch or record changes. The trusted launcher waits until Box registers the workload's process identity. Trusted bootstrap reads stay outside workload policy. Descendants remain tracked across forks and executable changes. Shutdown terminates tracked descendants and bounds callback draining. Disabled records retain version 21. Enabled records require version 22. Older binaries reject unsupported records. Disable the feature using a compatible build before returning to a version-21 binary. This is the core part of strands-agents#107. Per-workload selection and real-agent workloads are separate dependent drafts. The unrelated socket shutdown test fix remains outside these three feature changes. The adapter, trusted launch path, startup refusal, lifecycle cleanup, and signed tests stay together because they establish one enforcement boundary. Splitting these pieces would expose an incomplete safety contract. Limits remain explicit: already-open descriptors and mapped memory are not checked on every read or write. Kernel denials expose an operating-system error; structured details appear in Box diagnostics. This adds no asynchronous history writes or durability option. ## Tests Fresh macOS 27 validation passed: 13 signed integration tests, 16 adapter tests, 133 configuration tests, 11 native unit tests, three startup tests, one launcher handshake test, and 11 policy path tests. The receipt verifier's three tests passed. `trusted_launcher_reads_are_not_workload_requests` fails against the old defective signed binary and passes against this build. `direct_open_truncate_and_grandchild_obey_dogwood` covers direct and descendant denial. `native_history_changes_the_next_decision_without_a_cached_allow` covers history-sensitive decisions. Formatting and clippy passed for the changed Rust packages and standalone signed test package. Clippy used the repository's established allowances. The checked-in receipt records this candidate's full signed suite and source hashes. Continuous integration checks receipt freshness; it does not run Apple's signed enforcement tests. The full workspace suite was not rerun for this split. Earlier strands-agents#107 testing found an intermittent catalog-scaling timing failure. This PR does not claim that the full suite is green. Linux and older macOS runtime tests were not rerun locally.
## Problem A global native filesystem setting cannot select agent, tool, and local Model Context Protocol (MCP) server workloads independently. ## Solution This adds optional `native-filesystem-policy` settings to `[agent]`, `[tool.<name>]`, and local `[mcp.<name>]` entries. An absent setting inherits the global default. It does not inherit the agent override. Explicit enablement requires the global experimental gate. Remote MCP entries reject the local-process setting. Box registers the selected mode before the workload starts. Descendants inherit that mode. Tools use their own table's setting. Disabled workloads retain containment and shutdown tracking. Their native file calls bypass Dogwood evaluation and history recording; Shell and network checks remain active. Explicit process overrides require record version 23. Configurations without overrides retain the core feature's version 21 or 22 behavior. Remove overrides with a compatible binary before returning to a binary that cannot read version 23. Depends on the core branch `keorel/native-filesystem-core`. This draft targets `main` under repository rules, so its full diff initially includes the core changes. Review this branch's final commit for selection-only changes. Merge core first, update this branch from main, resolve overlaps, and refresh signed evidence. The agent-workload test draft is independent of this draft. This is the selection part of strands-agents#107. It adds no history durability option. Disabled native operations leave a history gap, so policies cannot rely on observing them. ## Tests Fresh macOS 27 validation passed: all 18 signed integration tests, adapter tests, the full `record::config::` filter, native unit tests, startup tests, launcher handshake test, policy path tests, and receipt verifier tests. `independent_agent_and_tool_modes_survive_concurrent_forks_and_exec` covers mode separation. `local_mcp_selection_is_independent_of_the_agent` covers local servers. The disabled-agent and disabled-tool bootstrap tests cover restrictive startup policies. `process_policy_overrides_require_the_global_gate_and_a_new_record` pins the configuration and record contract. The trusted-launcher regression also passes with the stronger assertion. Formatting and clippy passed for changed Rust packages and the standalone signed test package, using repository lint allowances. The signed receipt covers this branch's exact candidate source. The full workspace suite and live model workloads were not rerun for this split. Earlier strands-agents#107 testing found an intermittent catalog-scaling timing failure. Continuous integration checks manual signed receipt freshness; it does not execute signed native enforcement.
|
Replaced for review by stacked draft PR #1. Its base is the core branch for #112, so Files changed excludes core changes. Closing this PR preserves its discussion and test history. The source branch is unchanged. #112 remains open upstream. After core merges, submit this branch upstream for merge. |
|
Assessment: Request Changes Technically this is a careful, fail-closed implementation with strong tests and thorough design docs. The blocking concern is governance, not correctness: the PR extends Review themes
Design strengths worth keeping: the record version 22/23 bump that stops older binaries resuming without the selected enforcement, the dev/ino re-verification against TOCTOU, and the "unsigned/unavailable build refuses before workload start" behavior are all solid. |
…ystem-workload-selection
|
Follow-up to the review summary: Fernando's approval remains in the review history. The current changes merge shared core fixes and use the same workload setting in the new shared launch function. Setting precedence is unchanged. The configuration descriptions now list all five process fields. The The old combined-diff size comment is outdated. This PR targets the synchronized core branch and excludes core's implementation. After #112 merges, update from The saved-version error text remains unchanged. It can name version 21 even when the binary also supports 22 and 23. Unsupported versions are still rejected. We deferred that minor wording change. The updated signed build passed 21 native integration tests plus the bridge target. CI now runs for this staging base. |
The base branch was changed.
Description
Core #112 is merged. This PR now targets
main.The branch includes the squashed core commit. Its files are identical to the approved revision
a906ae2.The signed test receipt still matches. CI is rerunning, and GitHub requires renewed approval after this update.
The global switch applies the same default to the agent, tools, and local servers.
This PR lets you choose native file checks separately for each one. The feature is available in experimental mode.
View this PR's changes without the core diff.
Add
native-filesystem-policyto an existing agent, tool, or local Model Context Protocol (MCP) server table:This example shows only the new settings. Keep each table's required command and other settings.
Configuration approval
Fernando approved the workload-settings change in his review.
The shared launcher now reads the same workload setting inside the launch function. Setting precedence and saved-record behavior remain unchanged.
The configuration descriptions now list the fifth process field. The top-level key and version 22 belong to #112. Explicit workload overrides require version 23 here.
FAQ
What happens when I omit a setting?
That workload inherits the global setting. Tools and local servers do not inherit the agent's override.
Setting any workload to
truerequires the global experimental setting to betrue.What remains when I disable native checks for a tool?
Its sandbox restrictions still apply. Box still tracks it for shutdown.
Shell and network policy checks remain active.
Its direct file operations skip Dogwood checks and history recording. Later rules cannot rely on seeing those operations.
Does disabling checks remove all overhead?
No. The operating system can still deliver events, and Box still prepares and tracks the process.
This setting skips native policy checks.
Can a child change its setting by executing another program?
No. Children inherit their parent's setting.
When Box starts a declared tool, it uses that tool's table.
Directly executing a program inside the agent does not select the matching tool table.
Does this apply to remote MCP servers?
No. Box does not launch their processes. Remote server entries reject this setting.
Does disabling checks erase policy history?
No. Existing history remains on disk.
Disabled native operations add no new history, so that period contains a gap.
When do changes apply, and can I downgrade?
Changes apply on the next Box run.
Any explicit workload override, including
false, requires stored configuration version 23.To return to version 21, remove the overrides and set the global feature to
false.Run once with the compatible binary before starting the older binary. Policy history remains intact.
What merges first?
Core #112 is merged. This PR targets
main.Agent tests #114 can merge independently of this PR.
Related Issues
Split from #107.
Type of Change
New feature, available in experimental mode.
Testing
The branch includes current
mainand its macOS signing metadata. The signed build and receipt were refreshed after that merge.On October 16, the updated signed build passed 21 native integration tests plus one bridge test target on macOS 27.0.1.
The receipt matches the current production code and relevant test sources.
Commands, results, and remaining limits
cargo test --manifest-path test-native-filesystem/Cargo.toml --locked -- --test-threads=1, withSTRANDS_BOX_SIGNED_TEST_BINARYset: 22 passed.-D warnings.The full workspace test suite and live model runs were not repeated. Earlier testing found an intermittent catalog-scaling timing failure.
Core's kernel-failure validation limits remain in #117. Linux compilation requires CI.
CI now runs against the staging base. Signed runs remain manual, with source freshness checked in CI.
cargo fmt --allandcargo clippy --workspace --all-targets --all-features -- -D warningsFormatting passed. The exact workspace Clippy command ran and failed on existing warnings, including
chunks_exact_to_as_chunksin containment and vendored Shell warnings.The containment failure also reproduces at base commit
bd85785. The flagged Shell source is unchanged from that base.The checkbox remains unchecked. Changed Box packages pass with the repository CI workflow's existing lint allowances.
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.