Centralize sandbox network and shell credential setup (#62050)

## Why

A missing executor proxy launch config can still require managed networking. Only an explicitly disabled executor proxy should suppress that enforcement.

## What changed

- Prepare executor proxy launch settings and enforcement together, preserving the distinction between missing and disabled proxy configurations.
- Bundle sandbox enforcement, the live proxy, and the environment ID in `SandboxNetwork`, retaining the proxy through shell snapshot setup.
- Share shell-startup credential classification and application through `ShellStartupCredentials`, including protected `zsh` snapshots, supported `bash -c` commands, and unmasked fallback handling.

## Testing

Extend the exec-server sandbox preparation test to verify that an explicitly disabled proxy omits both the proxy launch config and managed-network enforcement.

GitOrigin-RevId: e2f3b543680c9184b6557b81de02a61f0a977e32
This commit is contained in:
viyatb-oai
2026-11-17 13:52:56 +00:00
committed by copyberry
parent 49d657aad0
commit 05ae1b0fdd
16 changed files with 237 additions and 124 deletions
+6 -3
View File
@@ -28,6 +28,7 @@ use codex_protocol::models::SandboxEnforcement;
use codex_protocol::permissions::NetworkSandboxPolicy;
use codex_sandboxing::SandboxCommand;
use codex_sandboxing::SandboxManager;
use codex_sandboxing::SandboxNetwork;
use codex_sandboxing::SandboxSelection;
use codex_sandboxing::SandboxTransformRequest;
use codex_sandboxing::SandboxType as SandboxBackend;
@@ -438,9 +439,11 @@ async fn run_command_under_sandbox(
workspace_roots: workspace_roots.as_deref(),
runtime_readable_paths: None,
selection: SandboxSelection::Explicit(sandbox),
enforce_managed_network: network.is_some(),
network: network.as_ref(),
environment_id: None,
network: SandboxNetwork::new(
network.is_some(),
network.as_ref(),
/*environment_id*/ None,
),
sandbox_policy_cwd: &cwd,
sandbox_exe: sandbox_exe.as_deref(),
use_legacy_landlock,