Wire the Windows MXC sandbox into command execution (#45176)

## What changed

- Add explicit MXC backend selection and carry its identity through exec-server process reporting and sandbox violation classification.
- Launch MXC through the Codex executable with the effective permission profile and command environment.
- Reject exec-server MXC requests when native MXC is unavailable or when they request a TTY, an `arg0` override, or managed networking. Reject private desktop isolation during MXC preparation.
- Allow an explicitly empty child environment and avoid exposing request payload values in launcher decode errors.

## Testing

Add coverage for sandbox selection and unsupported-request rejection, plus Windows RPC tests for stdin writes and temporary-directory permissions derived from the command environment. Native MXC tests skip when MXC is unavailable.

GitOrigin-RevId: 3626ff0f9ad7f9b812ce09b68c31ea9a5a9c72b1
This commit is contained in:
iceweasel-oai authored and copyberry committed 2026-09-13 06:07:03 +00:00
1 parent dfaf451426
commit c379459bba
37 files changed
+422 -85

No files matched your search

+2 -3
View File
@@ -7,9 +7,8 @@ dispatcher, edits host ACLs, creates sandbox users, runs setup, or requests
elevation. The existing Codex Windows sandboxes remain separate backends.
Windows executors record `codex.windows_mxc.available` once per process with an
`available=true|false` tag. This measures capability independently of selection.
The exec-server handshake also exposes `windows_mxc_available`; older or
unsupported Windows executors reject MXC requests before execution.
`available=true|false` tag. This measures runtime availability independently of
selection. Unsupported Windows executors reject MXC requests before execution.
`is_available()` uses MXC's cached create/close probe, rather than an OS build
number or the SDK's broad `platform_support()` result. The latter also reports
+1 -1
View File
@@ -106,7 +106,7 @@ pub fn run_main() -> ! {
match windows::run() {
Ok(exit_code) => std::process::exit(exit_code),
Err(error) => {
eprintln!("MXC sandbox: {error:#}");
eprintln!("MXC launcher: {error:#}");
std::process::exit(1);
}
}
+5 -5
View File
@@ -43,11 +43,11 @@ pub(super) fn run() -> Result<i32> {
Ok((key, value))
})
.collect::<Result<HashMap<_, _>>>()?;
let command = crate::transport::decode(&mut env)?;
ensure!(
!env.is_empty(),
"MXC requires an explicit child environment"
);
// Serde errors can quote arbitrary payload values; do not print them to stderr.
let command = crate::transport::decode(&mut env)
.map_err(|_| anyhow::anyhow!("invalid MXC launcher request"))?;
// The transport itself proves this is an explicit child environment; it
// may intentionally contain no variables once launcher state is removed.
let mask = unsafe { GetLogicalDrives() };
ensure!(
mask != 0,