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

@@ -246,7 +246,7 @@ async fn file_system_sandbox_context_preserves_executor_workspace_permissions()
manager: &manager,
sandbox_cwd: &sandbox_policy_cwd,
workspace_roots: std::slice::from_ref(&sandbox_policy_cwd),
codex_linux_sandbox_exe: None,
sandbox_exe: None,
use_legacy_landlock: true,
windows_sandbox_level: WindowsSandboxLevel::RestrictedToken,
windows_sandbox_private_desktop: true,
@@ -315,7 +315,7 @@ async fn file_system_sandbox_context_respects_sandbox_request() {
manager: &manager,
sandbox_cwd: &sandbox_policy_cwd,
workspace_roots: std::slice::from_ref(&sandbox_policy_cwd),
codex_linux_sandbox_exe: None,
sandbox_exe: None,
use_legacy_landlock: false,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
windows_sandbox_private_desktop: false,
@@ -124,7 +124,7 @@ async fn explicit_escalation_prepares_exec_without_managed_network() -> anyhow::
manager: &manager,
sandbox_cwd: &sandbox_policy_cwd,
workspace_roots: std::slice::from_ref(&sandbox_policy_cwd),
codex_linux_sandbox_exe: None,
sandbox_exe: None,
use_legacy_landlock: false,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
windows_sandbox_private_desktop: false,
@@ -789,7 +789,7 @@ impl CoreShellCommandExecutor {
environment_id: self.network_environment_id.as_deref(),
network: self.network.as_ref(),
sandbox_policy_cwd: &sandbox_policy_cwd,
codex_linux_sandbox_exe: self.codex_linux_sandbox_exe.as_deref(),
sandbox_exe: self.codex_linux_sandbox_exe.as_deref(),
use_legacy_landlock: self.use_legacy_landlock,
windows_sandbox_level: self.windows_sandbox_level,
windows_sandbox_private_desktop: false,