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
+9 -2
View File
@@ -115,6 +115,12 @@ pub(crate) async fn prepare_exec_request_with_telemetry(
credential_brokers: &RemoteCredentialBrokerCache,
telemetry: &ProcessTelemetry,
) -> Result<PreparedExecRequest, JSONRPCErrorError> {
let transparent_tcp = params.requests_transparent_tcp();
if transparent_tcp && (!cfg!(target_os = "linux") || params.sandbox.is_none()) {
return Err(invalid_params(
"transparent TCP requires a managed Linux sandbox".into(),
));
}
if let Some(sandbox) = params.sandbox.as_ref()
&& sandbox.windows_sandbox_selection == WindowsSandboxSelection::Mxc
{
@@ -187,6 +193,7 @@ pub(crate) async fn prepare_exec_request_with_telemetry(
#[cfg(target_os = "macos")]
let sandbox_manager = sandbox_manager
.with_allowed_symlinked_codex_home(runtime_paths.allowed_symlinked_codex_home.clone());
let enforce_managed_network = params.enforce_managed_network || transparent_tcp;
let (selection, windows_sandbox_level) = sandbox_selection(sandbox_context);
let (program, args) = params
.argv
@@ -240,7 +247,7 @@ pub(crate) async fn prepare_exec_request_with_telemetry(
workspace_roots: Some(&sandbox_context.workspace_roots),
runtime_readable_paths: &runtime_readable_paths,
selection,
enforce_managed_network: params.enforce_managed_network,
enforce_managed_network,
environment_id: None,
network: None,
sandbox_policy_cwd: &sandbox_context.cwd,
@@ -270,7 +277,7 @@ pub(crate) async fn prepare_exec_request_with_telemetry(
.map(|root| native_path(root, "sandbox workspace root"))
.collect::<Result<_, _>>()?;
request.arg0 = params.arg0.clone();
let proxy_enforced = params.enforce_managed_network;
let proxy_enforced = enforce_managed_network;
let filesystem_overrides = WindowsSandboxFilesystemOverrides::resolve(
request.sandbox,
&permissions,