Repository navigation
feat(windows): move the ProcessContainer backend to MXC 1.x - #90
Conversation
Windows wxc-exec was built from a pre-1.x MXC commit with three AXIS patches, including a hook into a privileged WFP broker service for strict proxy mode. The patches do not apply to MXC 1.x, so Windows stayed on a contract MXC no longer accepts and proxy mode needed an elevated service install. Build wxc-exec from MXC v1.0.1 without patches. AXIS now applies process, memory and CPU limits itself: the executor starts suspended in a kill-on-close Job Object and resumes only after the assignment. Strict proxy uses MXC's runtimeConfig.networkProxy mapping, so the WFP broker, its install script and its release assets are removed. New opt-in policy fields enable Win32k and grant-ancestor enumeration. MXC 1.x has no LPAC token, so process.identity: isolated is rejected. Its proxy mapping requires ingress to be allowed, and blocked bypass attempts are no longer recorded. The isolation contract now states that strict proxy covers outbound traffic, and docs/windows-mxc-1.md records the trade-offs. Fixes #87 Co-authored-by: Cursor <[email protected]>
09ea708 to
b7494ac
Compare
ltsabadz
left a comment
There was a problem hiding this comment.
Posted by Cursor on behalf of @ltsabadz.
Nice work. I tried it on my Windows laptop and it works. Two things need a fix: bypass audit is reported as working when it isn't, and the new ancestor-listing option shows file names inside denied folders. Details are in the inline comments.
What I ran. I built wxc-exec.exe from MXC v1.0.1 and axis from this branch, on Windows 11 26100, as a normal user. fmt, clippy, tier-0 and all Rust tests pass (502). The ProcessContainer and inference e2e suites pass. Strict proxy passes once the QUIC check is removed, because my network blocks UDP 443. Scoped SSH fails here, but the same way on main.
Works as it should. I tried each of these once where it should work and once where it should be blocked:
- The sandbox can write in its workspace, but not to my user folder or
C:\Users\Public. identity: isolatedis refused before anything starts, which is right without LPAC.max_processes,max_memory_mbandchild_processes: denyare enforced.- Block mode cuts the network, and allow mode allows it.
- In strict proxy mode, the allowed host works, another host gets a 403, and direct connections fail.
- The sandbox can't reach a server on the host's
127.0.0.1. - With
windows_win32koff, PowerShell won't start; with it on, it works.
I couldn't test inbound connections from other machines. #87 is fixed by removing the broker, and the release workflows no longer package it.
Problems without a line in the diff:
- An e2e check passes without testing anything. In
test_mxc_processcontainer.ps1:116, thechild_processes: denypolicy also setsidentity: isolated. That's now rejected, so the run fails right away and the test counts it as "child blocked". The feature does work (I checked by hand), but please dropidentity: isolatedfrom that policy. - The old broker service stays installed. Anyone who installed the v0.4.0 broker keeps
AxisWfpBrokerrunning as SYSTEM, and the removal script is gone. A docs note would cover it:sc.exe stop AxisWfpBroker,sc.exe delete AxisWfpBroker, and delete%ProgramData%\axis\wfp-leases. - The speedup is probably mostly the CLI timeout.
axis runtries the daemon first. The old build waited about 2 s for that to fail; the new 250 ms timeout cuts it short. It'd be worth re-measuring with the daemon running. If we drop the daemon as we discussed, those 250 ms go away too. This only affects Windows; on Linux and macOS a missing daemon fails right away. - Small one: the
run_as_usererror (windows/mxc.rs:698) still suggestsidentity: isolated.
Your question about the contract. Just my thoughts:
bypass_evidence: since bypass attempts are blocked but no longer logged, calling it exact feels a bit off. I see that marking it weaker would break existing Windows proxy policies, though, so I'm not sure which is better.strict_proxy: outbound-only seems reasonable. My only worry is that inbound now depends on the host firewall. Maybe AXIS should check the firewall instead of assuming it blocks inbound traffic.
Review of the MXC 1.x backend found that Windows reported bypass evidence as supported although blocked bypass attempts are no longer recorded, and that several launch paths assumed the safe case. - audit.bypass_evidence is WeakerOnly on Windows ProcessContainer. The new network.bypass_audit setting (best_effort by default) launches with a warning; hard_requirement refuses. It accepts only that requirement, and an accepted weaker plan still checks host dependencies. Linux backends are unaffected. - windows_enumerate_ancestors refuses a policy whose denied paths sit below a listed ancestor, and both opt-in Windows fields are reported at launch and by `axis policy validate`. - The executor config is written below the axisd token directory, which no sandbox grant may cover; an unresolvable grant counts as covering. - The resource Job Object is unnamed, and the unused job constructors (one of which allowed breakaway) are removed. - Arguments that cmd.exe would interpret are refused for .cmd/.bat commands, and relative PATH entries are skipped. - The process e2e no longer passes on a refused launch, the strict proxy e2e checks the first sandbox started and probes host loopback, axisd and another sandbox's proxy. - The 250 ms CLI connect timeout moves to its own change. The launch numbers are re-measured without it: MXC 1.x adds about 200 ms per launch. The docs also say how to remove the v0.4.0 broker.
|
Thanks a lot for testing this on real hardware, Luka, and for the thorough review. Everything is addressed in 27e4afb:
Tested on 27e4afb (on main 547b8ca):
|
ltsabadz
left a comment
There was a problem hiding this comment.
Thanks, everything from my last review is addressed. I tested it again, this time also following the README by hand as a new Windows user would. Setup wasn't smooth, and the docs are missing a few steps, such as gh auth login. Could we update them too? Apart from that, some commands didn't run as documented and only worked with a workaround. Details below.
What worked. I installed this branch on my Windows laptop with the signed MXC v1.0.1 wxc-exec.exe, and had Cursor run the checks through a script. Filesystem limits, block mode, strict proxy (allowed host 200, other host 403, with the new warning) and the new refusals all worked.
What doesn't work. When I type the same commands in a terminal, none of them start. I'm not sure whether that's something in my setup or a bug, but plain axis run commands don't work for me:
-
axis runfrom a terminal is refused. If stdin is a terminal, the CLI asks for an interactive console, and the Windows backend rejects that before launch ("interactive ConPTY is unsupported"). The script runs only worked because they piped input intoaxis.- Workaround:
"" | axis run … - Possible fix: on Windows, run with plain pipes instead of refusing when no console is available.
- Workaround:
-
The default policy fails on Windows.
axis run -- cmd.exe /c echo hifails withpolicy path '/usr' must be absolute after expansion. The bundled policies grant Linux paths, and the managed-home check insandbox.rsrejects them before the Windows backend gets to skip them (windows/mxc.rs:1077).- Workaround: pass a policy with only Windows paths.
- Possible fix: skip Unix-only paths in that check on Windows too, or ship a Windows default policy.
Neither of these seems to come from this PR, but together they mean the README's Windows steps don't work as written for me. Could they go in here, or in a small follow-up before the next release?
Docs. The Windows part would be easier to follow with:
- a Windows Quick Start command (
cmd.exe /c echo …;python3is often just the Store placeholder); - the
gh auth loginstep repeated next to the Windows installer; - a note that certificate errors on the network can break the installer's
ghverification; - a note that the daemon commands don't work on Windows yet;
- the
.cmdworkaround (cmd.exe /c script.cmd).
The architecture tree still says third_party/mxc/ holds patches (line 359).
Release. install.ps1 installs the latest release, so people get v0.4.0 until a new one is cut. It would be good to release once the fixes above are in.
Following the README on Windows failed at the first command. Both causes predate the MXC 1.x move, since #16. - From a terminal, the CLI asks for an interactive launch and the Windows backend refused it because BaseContainer cannot create a pseudoconsole. It now runs with the terminal's own handles and no pseudoconsole. No policy field requires a PTY, and BaseContainer denies the sandbox writing to the terminal's input buffer. - Bundled policies grant Unix paths such as /usr. The Windows backend skips them under best_effort, but the managed-home and axisd token checks ran first and refused the launch. Both now skip them as well. The README gets a Windows quick start, the installer's gh login and certificate caveats, the two opt-in fields, the bypass warning, the terminal and .cmd notes, and that daemon commands do not work on Windows yet.
|
Thanks Luka, following the README by hand was exactly what was missing. Both blockers are fixed in 3c0a1d3, here as you suggested, since they only bite on Windows and you're testing this branch anyway. They date back to #16, not this PR.
Tested on 3c0a1d3, Windows 11 26100 with MXC v1.0.1: from a new console window and with piped input, the default policy runs; unit tests 241/241 and 60/60; the processcontainer, strict proxy (without QUIC), inference and scoped SSH e2e suites pass. Linux: 992 tests, clippy, tier 0 and the workflow verifier pass. |
ltsabadz
left a comment
There was a problem hiding this comment.
Re-tested on Windows, now everything worked for me. Looks good!
Motivation
wxc-exec.exewas built from pre-1.x MXC commit1736b48with three AXIS patches. They do not apply to the MXC 1.xsrc/mxc-sdklayout, so Windows was stuck on a contract MXC no longer accepts while Linux moved to v1.0.0 (chore(mxc): move the Linux executor to MXC v1.0.0 #53).runtimeConfig.networkProxy), Win32k control (ui) and ancestor enumeration (processContainer.filesystem.enumeratePaths).Technical Details
Design record:
docs/windows-mxc-1.md(problem, options, decision, accepted trade-offs, evidence).Most of the diff is deletion: the WFP broker and its install script (about 1,750 lines) and the three MXC patches. The behavior changes are in
crates/axis-sandbox/src/windows/mxc.rs,crates/axis-sandbox/src/windows/job_object.rs,crates/axis-core/src/mxc_config.rs, and the planner and policy changes fornetwork.bypass_auditincrates/axis-core/src/capability.rsandpolicy.rs.wxc-execfrom pre-1.x MXC1736b48plus 3 AXIS patches0.6.0-alpha1.0.0wxc-execsuspended in a kill-on-close Job ObjectruntimeConfig.networkProxy, no serviceidentity: isolatedrejectedaudit.bypass_evidenceis weaker, proxy launches warn,network.bypass_audit: hard_requirementrefusesprocess.windows_win32k,filesystem.windows_enumerate_ancestorswxc-exec.exefrom MXC v1.0.1 (fda29ac) without patches in CI, nightly, release andscripts/setup_windows_mxc.ps1. v1.0.1 rather than v1.0.0 because it fixes BaseContainer loopback access to host services on PSEC 1.0 hosts, which the proxy mapping depends on.third_party/mxc/patches/and.gitattributesare removed.1.0.0ProcessContainer contract withleastPrivilege: false, directional network rules, andruntimeConfig.networkProxyfor strict proxy.wxc-exec.exeis created withCREATE_SUSPENDED, assigned to a kill-on-close Job Object sizedmax_processes + 1(the executor takes one slot), then resumed.build_mxc_process_configno longer exempts Windows: resource limits are rejected unless the caller states that AXIS enforces them.axis-wfp-broker.exe,windows/wfp.rs,scripts/install_windows_wfp_broker.ps1, thewindows.axis_wfp_brokerhost dependency, theaxisWfpconfig section, the release and nightly archive entries, and thewindowscrate features only the broker used.network.bypass_audit(best_effortby default, orhard_requirement) decides whether a proxy launch on a backend that blocks but cannot record bypass attempts warns or refuses. It accepts onlyaudit.bypass_evidence; Linux backends record bypass attempts and behave the same under both settings. Two opt-in Windows fields:process.windows_win32kis needed by USER32-linked tools such as PowerShell and Git for Windows.filesystem.windows_enumerate_ancestorslets Node'srealpathwalk grant ancestors and exposes names and sizes, not contents. Both default to off, are ignored on other platforms, and are reported at launch and byaxis policy validate.windows_enumerate_ancestorsrefuses a policy whose denied paths sit below a listed ancestor.%LOCALAPPDATA%\axis\mxc-config). Every sandbox launch is refused when a grant covers that directory, so no sandbox, including a concurrent one, can edit the config beforewxc-execreads it. A grant that cannot be canonicalized counts as covering it.PATHbefore the hostPATH, skipping relative entries. Arguments thatcmd.exewould interpret are refused when the command is a.cmdor.batfile.axis runfrom a terminal was refused because BaseContainer cannot create a pseudoconsole. It now runs with the terminal's own handles and no pseudoconsole. No policy field requires a PTY./usr. The backend skips them underbest_effort, but the managed-home and axisd token checks insandbox.rsrefused them first. Both now skip Unix-only paths on Windows;hard_requirementstill refuses them in the backend.axis runno longer trying axisd first, which removes that wait entirely, is fix(cli): run sandboxes without contacting axisd #108.process.isolated_identityisUnsupported(no LPAC).network.strict_proxydepends only on the MXC executor and ProcessContainer.audit.bypass_evidenceisWeakerOnly. The planner can now accept a single weaker requirement, and an accepted weaker plan still requires every host dependency.scripts/verify_workflow_structure.pypins the newMXC_WINDOWS_REF, the patch-free build step and the archive requirements. The release (7e2d0434…) and nightly (f487fee6…)buildjob digests change because the build job no longer applies patches or packages the broker. They were recomputed with the verifier'scanonical_job_digestafter rebasing ontomainwith chore(mxc): move the Linux executor to MXC v1.0.0 #53 and ci(macos): move runners off the retired macos-14 image #99.test_mxc_strict_proxy.ps1no longer needs elevation or the broker; its gate is renamed toAXIS_RUN_WINDOWS_STRICT_PROXY_E2E. It now checks that the first concurrent sandbox started, and that host loopback services, a running axisd and another sandbox's AXIS proxy are unreachable.test_mxc_processcontainer.ps1'schild_processes: denycase no longer setsidentity: isolated, and checks that the probe ran.gh auth loginand certificate notes next to the Windows installer, the two opt-in fields, the proxy bypass warning, terminal and.cmdnotes, daemon commands not working on Windows yet, and thethird_party/mxctree entry. Also DEVELOPMENT.md, setup, dependency, default-decision, test-tier and capability-matrix docs are updated. The isolation contract describesnetwork.bypass_auditand the two opt-in Windows fields;docs/windows-mxc-1.mdadds how to remove the v0.4.0 broker service.Security impact: Windows isolation is weaker than v0.4.0 in three documented ways, and the privileged broker is removed. A terminal launch shares the terminal with the sandboxed command, as on Linux; BaseContainer denies it writing to the terminal's input buffer (checked on Windows 11 26100).
processContainer.leastPrivilege) without DACL mutation after the SBOX removal microsoft/mxc#1496; MXC maintainers confirmed LPAC with BaseContainer is unsupported in v1, and processcontainer: sandboxed process can read persistent user environment variables from HKCU\Environment microsoft/mxc#1670 tracks theHKCU\Environmentread). The child keeps the caller's user SID inside the container. Grants stay exact and user files outside them are denied, but system locations and the user's registry hive (includingHKCU\Environment) are readable.process.identity: isolatednow rejects before launch instead of mapping to an LPAC token.ingress.default: allowwith the proxy mapping, which addsprivateNetworkClientServer. Egress is still limited to the AXIS proxy, but whether private-network peers can connect to a sandbox listener depends on the host firewall.audit.bypass_evidenceis nowWeakerOnly: proxy launches warn by default, andnetwork.bypass_audit: hard_requirementrefuses them. Collecting Windows Filtering Platform audit events would require changing the host audit policy.Contract decisions (from review):
network.strict_proxystays exact and the isolation contract scopes strict proxy to outbound traffic; a host firewall check is a follow-up.audit.bypass_evidenceisWeakerOnlywith thenetwork.bypass_auditsetting above, so existing Windows proxy, inference and scoped SSH policies keep running and report the missing audit trail.Test Plan
cargo fmt --all -- --check,cargo clippy --locked --all-targets -- -D warnings,cargo test --locked --no-fail-fast,bash scripts/test_security_tier0.sh,python3 scripts/verify_workflow_structure.py ., andpython3 -m unittest discover -s scripts.cargo xwin:clippy --locked --all-targets --target x86_64-pc-windows-msvc -- -D warnings, plus theaxis-coreandaxis-sandboxunit tests run on a Windows host.wxc-exec.exerelease binary (same commit as the pin):test_mxc_processcontainer.ps1,test_mxc_strict_proxy.ps1,test_mxc_inference.ps1andtest_mxc_scoped_ssh.ps1;Test Result
547b8ca,mainwith chore(mxc): move the Linux executor to MXC v1.0.0 #53):python3 -m unittest discover -s scripts: 185 tests OK (3 skipped).cargo xwinandcargo xwin clippy --workspace --all-targets -D warningsis clean.axis-core241/241,axis-sandbox59/59.policy_fixturesreads repository files through a path fixed at build time, so it only runs where it was built (it passes on Linux).wxc-exec.exe, the binary CI's pin builds):test_mxc_processcontainer.ps1,test_mxc_strict_proxy.ps1,test_mxc_inference.ps1andtest_mxc_scoped_ssh.ps1, with these host-specific adjustments:test_mxc_strict_proxy.ps1ran without its QUIC baseline and probe, because the test network also blocks outbound UDP 443 for the host itself. axisd was not running, so its port probe was skipped; the host loopback listener and the other sandbox's proxy probes ran and were blocked.test_mxc_scoped_ssh.ps1ran with a compiledssh-keyscanstub instead of the script'sssh-keyscan.cmd. On this host, endpoint protection kills anycmd.exechild (exit status0xE0000027) of a process whose arguments are an IP address and a port, which is how the CONNECT step invokesaxis-ssh-proxy.exe. A standalone program with no AXIS code reproduces this.cargo xwinand supplied through arustcwrapper onPATH.axis run -- cmd.exe /c "echo hi> out.txt"with the default policy exits 0 and writes the file; on 27e4afb it exited 125. Piped input with the default policy also works now. Unit tests 241/241 and 60/60, and the four e2e suites pass again on this head.network.bypass_audit: hard_requirementrefuses it with the reason; a.cmdargument containing&is refused before launch;axis policy validateshows the bypass audit setting and enabled Windows fields. Launching a.cmdfile directly fails inside BaseContainer with "Access is denied" before and after this PR;cmd.exe /c script.cmdworks.C:\Users,ProgramDataandC:\Users\Public, are denied.max_processesandmax_memory_mbare enforced.axis --socket 0.0.0.0:9 run -- cmd.exe /c exit 0, 20 runs after 2 warm-up runs, median / p90.--socket 0.0.0.0:9makes the axisd connect fail at once for both builds; with the default address Windows retries the refused loopback connect for about two seconds (2371 ms against 2498 ms median in block mode), which is what made the earlier numbers in this PR look faster.MXC 1.x adds about 200 ms per launch. About 70 ms is the executor's own start (
wxc-exec.exe --version: 152 ms against 80 ms); where the rest goes is a follow-up./tmp/axis/sandboxesfor sandbox state when neitherXDG_DATA_HOMEnorHOMEis set (also onmain), so daemon-mode launches fail there.wxc-exec.exefrom source with--no-default-features, while the local runs used the signed release binary from the same commit.0.6.0-alpha. They have no launch path, and the design record tracks them as a follow-up.