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
+6 -1
View File
@@ -551,6 +551,7 @@ fn format_network_constraints(network: &NetworkConstraints) -> String {
enabled,
http_port,
socks_port,
transparent_tcp,
allow_upstream_proxy,
dangerously_allow_non_loopback_proxy,
dangerously_allow_all_unix_sockets,
@@ -571,6 +572,9 @@ fn format_network_constraints(network: &NetworkConstraints) -> String {
if let Some(socks_port) = socks_port {
parts.push(format!("socks_port={socks_port}"));
}
if let Some(transparent_tcp) = transparent_tcp {
parts.push(format!("transparent_tcp={transparent_tcp}"));
}
if let Some(allow_upstream_proxy) = allow_upstream_proxy {
parts.push(format!("allow_upstream_proxy={allow_upstream_proxy}"));
}
@@ -903,6 +907,7 @@ interrupt_message = false
network: Some(Sourced::new(
NetworkConstraints {
enabled: Some(true),
transparent_tcp: Some(true),
domains: Some(NetworkDomainPermissionsToml {
entries: BTreeMap::from([(
"example.com".to_string(),
@@ -1053,7 +1058,7 @@ interrupt_message = false
"enforce_residency: us (source: {requirements_source})"
)));
assert!(rendered.contains(&format!(
"network_proxy: enabled=true, domains={{example.com=allow}}, review_domains={{api.example.com}}, header_injections=1 hosts={{api.example.com}} (source: {requirements_source})"
"network_proxy: enabled=true, transparent_tcp=true, domains={{example.com=allow}}, review_domains={{api.example.com}}, header_injections=1 hosts={{api.example.com}} (source: {requirements_source})"
)));
assert!(!rendered.contains("secret-looking-value"));
assert!(
@@ -24,5 +24,5 @@ Requirements:
- guardian_policy_config: configured (source: MDM managed_config.toml (legacy))
- features: guardian_approval=true (source: MDM managed_config.toml (legacy))
- enforce_residency: us (source: MDM managed_config.toml (legacy))
- network_proxy: enabled=true, domains={example.com=allow}, review_domains={api.example.com}, header_injections=1 hosts={api.example.com} (source: MDM managed_config.toml (legacy))
- network_proxy: enabled=true, transparent_tcp=true, domains={example.com=allow}, review_domains={api.example.com}, header_injections=1 hosts={api.example.com} (source: MDM managed_config.toml (legacy))
- permissions.filesystem.deny_read: /home/alice/.gitconfig (source: /etc/codex/requirements.toml)