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

@@ -315,6 +315,7 @@ impl CommandExecRequestProcessor {
&sandbox_cwd,
windows_sandbox_workspace_roots.as_slice(),
&codex_linux_sandbox_exe,
&self.arg0_paths.codex_self_exe,
use_legacy_landlock,
)
.map_err(|err| internal_error(format!("exec failed: {err}")))?;
@@ -4907,7 +4907,7 @@ impl ThreadRequestProcessor {
serde_json::json!("unelevated"),
);
}
WindowsSandboxLevel::Disabled => {}
WindowsSandboxLevel::Disabled | WindowsSandboxLevel::Mxc => {}
}
}
let request_overrides = if cli_overrides.is_empty() {
@@ -222,7 +222,9 @@ fn determine_windows_sandbox_readiness_from_state(
) -> WindowsSandboxReadinessResponse {
let status = match windows_sandbox_level {
WindowsSandboxLevel::Disabled => WindowsSandboxReadiness::NotConfigured,
WindowsSandboxLevel::RestrictedToken => WindowsSandboxReadiness::Ready,
WindowsSandboxLevel::RestrictedToken | WindowsSandboxLevel::Mxc => {
WindowsSandboxReadiness::Ready
}
WindowsSandboxLevel::Elevated => {
if sandbox_setup_is_complete {
WindowsSandboxReadiness::Ready