Allow network policy to enable transparent TCP capture (#61851)

## What changed

- Add `transparent_tcp` to network configuration and managed requirements, defaulting to off. When enabled, route outbound TCP from managed Linux sandbox commands through the managed SOCKS5 proxy without requiring an executor startup flag.
- Propagate the setting through local and remote execution, require an enabled SOCKS5 proxy, and check the executor's `networkProxyTransparentTcp` capability before remote launches.
- Refresh the live proxy when switching between permission profiles with different network settings.

## Testing

Add coverage for configuration-driven sandbox capture, rejection of unsupported launch contexts, execution parameter propagation, and live permission profile changes.

GitOrigin-RevId: c4db87056de116f433a128806bef673802f35397
This commit is contained in:
viyatb-oai
2026-11-16 18:19:16 +00:00
committed by copyberry
parent fef47a6769
commit effad7568c
29 changed files with 312 additions and 39 deletions
+12 -5
View File
@@ -307,12 +307,19 @@ async fn run_command_under_sandbox(
config.effective_local_windows_sandbox_type()
};
let transparent_tcp = matches!(
sandbox_type,
SandboxType::Landlock {
transparent_tcp: true
let transparent_tcp = match sandbox_type {
SandboxType::Landlock { transparent_tcp } => {
transparent_tcp
|| config
.permissions
.network
.as_ref()
.is_some_and(codex_core::config::NetworkProxySpec::transparent_tcp)
}
);
#[cfg(target_os = "macos")]
SandboxType::Seatbelt => false,
SandboxType::Windows => false,
};
let sandbox = match permission_profile.enforcement() {
SandboxEnforcement::Disabled | SandboxEnforcement::External if transparent_tcp => {
anyhow::bail!("--transparent-tcp requires a managed Linux sandbox");