mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Enforce environment network policies for remote execution (#39980)
## Why `EnvironmentConfig.network_policy` could describe attachment-owned traffic restrictions, but core rejected every configured policy because execution did not enforce it. ## What changed - Resolve each remote environment's network policy for the selected command and apply it to the execution-scoped proxy. - Compose owner rules with controller constraints and saved network decisions while preserving inherited domain and Unix-socket denials. - Keep strict allowlists non-expandable, allow reviewable policies to use network approvals, and reject sandbox escalation that would bypass an owner policy. - Reject policies for local execution, disabled managed enforcement, or a disabled controller proxy. ## Testing Added coverage for policy composition, scoped remote proxy behavior, approval and denial flows, offline execution, and unsupported environment authority. GitOrigin-RevId: d9331f616df24de6cd13ed68196f0ff7b0ca4dd9
This commit is contained in:
1 parent
8edb95f274
commit
f580dd886f
13 files changed
+723
-63
No files matched your search
@@ -223,9 +223,14 @@ impl<'a> ToolRuntime<UnifiedExecRequest, UnifiedExecAttempt> for UnifiedExecRunt
|
||||
&file_system_sandbox_policy,
|
||||
);
|
||||
let network =
|
||||
managed_network_for_sandbox_permissions(req.network.as_ref(), sandbox_permissions)?;
|
||||
managed_network_for_sandbox_permissions(req.network.as_ref(), sandbox_permissions)
|
||||
.cloned();
|
||||
// No-proxy fast path; owners still need a spec for execution-only proxies.
|
||||
if network.is_none() && req.turn_environment.config().network_policy.is_none() {
|
||||
return None;
|
||||
}
|
||||
Some(NetworkApprovalSpec {
|
||||
network: Some(network.clone()),
|
||||
network,
|
||||
tool_name: ctx.tool_name.clone(),
|
||||
trigger: GuardianNetworkAccessTrigger {
|
||||
call_id: ctx.call_id.clone(),
|
||||
@@ -240,6 +245,7 @@ impl<'a> ToolRuntime<UnifiedExecRequest, UnifiedExecAttempt> for UnifiedExecRunt
|
||||
command: req.hook_command.clone(),
|
||||
environment_id: req.turn_environment.selection.environment_id.clone(),
|
||||
permission_profile: req.turn_environment.permission_profile().clone(),
|
||||
network_policy: req.turn_environment.config().network_policy.clone(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user