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
+8 -1
View File
@@ -300,6 +300,7 @@ pub async fn process_exec_tool_call(
sandbox_cwd: &AbsolutePathBuf,
windows_sandbox_workspace_roots: &[AbsolutePathBuf],
codex_linux_sandbox_exe: &Option<PathBuf>,
codex_self_exe: &Option<PathBuf>,
use_legacy_landlock: bool,
stdout_stream: Option<StdoutStream>,
) -> Result<ExecToolCallOutput> {
@@ -309,6 +310,7 @@ pub async fn process_exec_tool_call(
sandbox_cwd,
windows_sandbox_workspace_roots,
codex_linux_sandbox_exe,
codex_self_exe,
use_legacy_landlock,
)?;
@@ -324,6 +326,7 @@ pub fn build_exec_request(
sandbox_cwd: &AbsolutePathBuf,
windows_sandbox_workspace_roots: &[AbsolutePathBuf],
codex_linux_sandbox_exe: &Option<PathBuf>,
codex_self_exe: &Option<PathBuf>,
use_legacy_landlock: bool,
) -> Result<ExecRequest> {
let ExecParams {
@@ -390,7 +393,11 @@ pub fn build_exec_request(
environment_id: network_environment_id.as_deref(),
network: network.as_ref(),
sandbox_policy_cwd: &sandbox_policy_cwd_uri,
codex_linux_sandbox_exe: codex_linux_sandbox_exe.as_deref(),
sandbox_exe: if cfg!(windows) {
codex_self_exe.as_deref()
} else {
codex_linux_sandbox_exe.as_deref()
},
use_legacy_landlock,
windows_sandbox_level,
windows_sandbox_private_desktop,