mirror of
https://github.com/openai/codex.git
synced 2026-11-27 15:30:27 +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:
1 parent
dfd2d8133c
commit
999a715089
40 files changed
+2792
-191
No files matched your search
@@ -532,6 +532,19 @@ fn wrap_windows_sandbox_exec_request_for_direct_spawn(
|
||||
|
||||
let inner_command = std::mem::take(&mut request.command);
|
||||
let proxy_enforced = request.network.is_some();
|
||||
let network_proxy_restricting_sid = request
|
||||
.network
|
||||
.as_ref()
|
||||
.map(|network| {
|
||||
network
|
||||
.network_proxy_restricting_sid(request.network_environment_id.as_deref())
|
||||
.ok_or_else(|| {
|
||||
SandboxTransformError::WindowsSandboxPreparation(
|
||||
"managed Windows proxy route is missing its restricting SID".to_string(),
|
||||
)
|
||||
})
|
||||
})
|
||||
.transpose()?;
|
||||
let use_elevated =
|
||||
windows_sandbox_uses_elevated_backend(request.windows_sandbox_level, proxy_enforced);
|
||||
let overrides = if use_elevated {
|
||||
@@ -576,6 +589,7 @@ fn wrap_windows_sandbox_exec_request_for_direct_spawn(
|
||||
request.windows_sandbox_level,
|
||||
request.windows_sandbox_private_desktop,
|
||||
proxy_enforced,
|
||||
network_proxy_restricting_sid.as_deref(),
|
||||
proxy_settings_mode,
|
||||
read_roots_override,
|
||||
read_roots_include_platform_defaults,
|
||||
|
||||
Reference in new issue
Block a user