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
2026-09-13 06:07:03 +00:00
committed by copyberry
parent dfaf451426
commit c379459bba
37 changed files with 422 additions and 85 deletions
@@ -152,6 +152,9 @@ pub struct EnvironmentCapabilities {
/// Whether shell state can be cached and restored entirely inside the executor.
#[serde(default)]
pub shell_snapshot_v2: bool,
/// Whether requests may explicitly select the MXC Windows sandbox backend.
#[serde(default)]
pub windows_mxc: bool,
}
/// Status returned by an initialized exec-server connection.
@@ -243,6 +246,7 @@ impl EnvironmentInfo {
http_header_env_vars: true,
sandboxed_file_streaming: true,
shell_snapshot_v2: cfg!(unix),
windows_mxc: false,
},
}
}
@@ -358,6 +362,7 @@ pub enum ProcessSandboxType {
MacosSeatbelt,
LinuxSeccomp,
WindowsRestrictedToken,
WindowsMxc,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
@@ -1057,6 +1062,7 @@ mod tests {
http_header_env_vars: false,
sandboxed_file_streaming: false,
shell_snapshot_v2: false,
windows_mxc: false,
}
);
}
@@ -1078,6 +1084,7 @@ mod tests {
"httpHeaderEnvVars": false,
"sandboxedFileStreaming": false,
"shellSnapshotV2": false,
"windowsMxc": false,
},
});
let info: EnvironmentInfo = serde_json::from_value(expected.clone())