mirror of
https://github.com/openai/codex.git
synced 2026-10-30 19:18:49 +00:00
Route Windows sandbox proxy traffic by restricting SID (#34613)
## Why Elevated Windows sandboxes need stable managed-proxy ports while preserving the network policy and environment attribution of each sandboxed process. ## What changed - Keep shared HTTP and SOCKS5 loopback ingress listeners alive across managed-proxy instances. - Add a per-route restricting SID to elevated sandbox tokens and dispatch incoming connections to the matching proxy policy after attributing the client process. - Reject connections without exactly one registered route, remove routes when their proxy handle is dropped, and keep unsandboxed Windows launches off the managed ingress. - Provision the elevated sandbox with the configured proxy ports and local-binding setting, honoring the selected profile and CLI overrides. ## Testing - Add Windows unit tests for TCP ownership attribution, route selection, restricting-token propagation, and setup settings. - Add an end-to-end Windows test covering stable ports, isolated environment policies, HTTP and SOCKS5 routing, and route teardown. GitOrigin-RevId: 783fac6e0f904dc9bb1955b75d4a5895e8bb9690
This commit is contained in:
@@ -903,7 +903,14 @@ async fn managed_network_proxy_decider_survives_full_access_start() -> anyhow::R
|
||||
use tokio::io::AsyncReadExt as _;
|
||||
use tokio::io::AsyncWriteExt as _;
|
||||
|
||||
let mut stream = tokio::net::TcpStream::connect(started_proxy.proxy().http_addr()).await?;
|
||||
let prepared = started_proxy
|
||||
.proxy()
|
||||
.prepare_for_remote_environment(std::collections::HashMap::new(), "test-bridge")?;
|
||||
let proxy_addr = prepared.env["HTTP_PROXY"]
|
||||
.strip_prefix("http://")
|
||||
.expect("HTTP proxy URL")
|
||||
.parse::<std::net::SocketAddr>()?;
|
||||
let mut stream = tokio::net::TcpStream::connect(proxy_addr).await?;
|
||||
stream
|
||||
.write_all(
|
||||
b"GET http://example.com/ HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\n\r\n",
|
||||
|
||||
Reference in New Issue
Block a user