Repository navigation
fix(sdk): reach the AppContainer + DACL tier from the streaming path - #645
Merged
shschaefer merged 1 commit intoJul 14, 2026
Merged
shschaefer merged 1 commit into
shschaefer merged 1 commit into
Conversation
The mxc-sdk streaming path (`spawn_sandbox` -> `mxc_engine::dispatch`) resolved Windows ProcessContainer to only two tiers -- BaseContainer when usable, otherwise AppContainer + BFS -- so a host with neither the BaseContainer API nor `bfscfg.exe` failed closed instead of falling back to AppContainer + DACL (Tier 3). The run-to-completion executor path already had all three tiers via `dispatch_with_fallback`. Extract the tier -> (backend, DACL) mapping into a shared `select_backend_with_fallback`, and add a streaming `spawn_with_fallback` that both surfaces go through, so they can no longer drift. The returned handle owns any `DaclManager` via `DaclGuardedProcess`, whose field order restores host ACEs only after the child tree is torn down, matching the run-to-completion drop order. On a spawn failure after tier selection, carry the selected tier and the tier-selection warnings in `SpawnDispatchError::Spawn` so the engine logs them just like the run-to-completion resolve path (which logs before its separate spawn), keeping diagnostics parity. Resolves microsoft#643 Co-authored-by: Copilot <[email protected]> Copilot-Session: 3005336c-50df-445b-a777-7f140edf929c Signed-off-by: Carlos Alexandro Becker <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a Windows-only behavioral gap between the Rust SDK streaming API (spawn_sandbox) and the run-to-completion executor path (wxc-exec) for ProcessContainer tier fallback. It centralizes tier selection and adds a streaming fallback dispatcher so streaming can reach the AppContainer + DACL (Tier 3) isolation mode when BaseContainer is unusable and BFS (bfscfg.exe) isn’t available, matching existing executor behavior.
Changes:
- Refactors ProcessContainer tier selection into a shared
select_backend_with_fallbackto prevent drift between streaming and run-to-completion paths. - Adds a streaming
spawn_with_fallbackAPI and aDaclGuardedProcesswrapper so the streaming handle owns the DACL guard and restores host ACEs only after the child process tree is torn down. - Updates engine/docs to describe the full three-tier fallback (BaseContainer → AppContainer+BFS → AppContainer+DACL) and improves failure-path diagnostics parity by retaining tier/warnings on spawn failures.
Show a summary per file
| File | Description |
|---|---|
| src/core/mxc-sdk/README.md | Updates SDK documentation to reflect shared three-tier ProcessContainer fallback and DACL-guard ownership in streaming. |
| src/core/mxc_engine/src/dispatch.rs | Switches streaming ProcessContainer dispatch to spawn_with_fallback and logs tier/warnings on both success and spawn-failure paths. |
| src/backends/appcontainer/common/src/dispatcher.rs | Introduces shared backend selection (select_backend_with_fallback), streaming spawn_with_fallback, and DaclGuardedProcess to correctly scope DACL guard lifetime and drop ordering. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Low
shschaefer
approved these changes
Jul 14, 2026
Carlos Alexandro Becker (caarlos0)
marked this pull request as ready for review
July 14, 2026 18:35
Carlos Alexandro Becker (caarlos0)
requested a review
from a team
as a code owner
July 14, 2026 18:35
4 of 8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📖 Description
The
mxc-sdkstreaming path (spawn_sandbox→mxc_engine::dispatch::spawn_process_container) resolved the Windows ProcessContainer backend to only two isolation tiers — BaseContainer when the native OS sandbox API is usable, otherwise AppContainer + BFS (bfscfg.exe). On a host with neither the BaseContainer API norbfscfg.exe, the streaming path failed closed with a "bfscfg.exe is not available" error instead of falling back to AppContainer + DACL (Tier 3). The run-to-completion executor path (wxc-exec) already had all three tiers viadispatch_with_fallback, so the two surfaces disagreed.This PR makes the streaming path use the same three-tier fallback:
select_backend_with_fallbackinappcontainer_common::dispatcher, so the run-to-completion (dispatch_with_fallback) and streaming (spawn_with_fallback) surfaces can no longer drift on tier selection.spawn_with_fallback, whose returned handle owns anyDaclManagervia a newDaclGuardedProcess. Its field order restores host ACEs only after the child tree is torn down (firewall / BFS enforcement first), matching the run-to-completion drop order.tierand tier-selectionwarningsinSpawnDispatchError::Spawnso the engine logs them just like the run-to-completion resolve path (which logs before its separate spawn attempt) — keeping diagnostics parity on the failure path.Docs (
mxc-sdkREADME +mxc_engine::dispatchmodule doc) are updated to describe the shared three-tier fallback.Scope: Windows only. No behavior change to the run-to-completion executor path or to non-Windows backends.
🔗 References
Resolves #643
🔍 Validation
cargo check --target x86_64-pc-windows-msvc -p appcontainer_common -p mxc_engine --tests— clean.cargo clippy --target x86_64-pc-windows-msvc -p appcontainer_common -p mxc_engine --tests -- -D warnings— clean.cargo fmt --all -- --check— clean.cargo test -p mxc_engine(host) — 15 passed / 0 failed.dispatcher.rscover the shared selector for each tier (T1 / T2-no-deny / T2-deny / T3), the streaming Tier-3 fallback when BaseContainer is unusable and BFS is not compiled in (the Rust SDK fails to fall back to AppContainer + DACL #643 regression guard), andDaclGuardedProcessmethod delegation.✅ Checklist
Cargo.lock, thedependency-feed-checkcheck passes (noCargo.lockchange)📋 Issue Type
Microsoft Reviewers: Open in CodeFlow