removing network proxy for yolo (#17742)

**Summary**
- prevent managed requirements.toml network settings from leaking into
DangerFullAccess / yolo turns by gating managed proxy attachment on
sandbox mode
- keep guardian/sandboxed modes on the managed proxy path, while making
true yolo bypass the proxy entirely, including /shell full-access
commands
This commit is contained in:
Won Park
2026-04-15 17:02:42 -07:00
committed by GitHub
Unverified
parent c2bdb7812c
commit e2dbe7dfc3
5 changed files with 392 additions and 7 deletions
+23 -5
View File
@@ -1338,6 +1338,10 @@ impl Session {
}
}
fn managed_network_proxy_active_for_sandbox_policy(sandbox_policy: &SandboxPolicy) -> bool {
!matches!(sandbox_policy, SandboxPolicy::DangerFullAccess)
}
/// Builds the `x-codex-beta-features` header value for this session.
///
/// `ModelClient` is session-scoped and intentionally does not depend on the full `Config`, so
@@ -2004,10 +2008,15 @@ impl Session {
.await;
session_configuration.thread_name = thread_name.clone();
let state = SessionState::new(session_configuration.clone());
let managed_network_requirements_configured = config
.config_layer_stack
.requirements_toml()
.network
.is_some();
let managed_network_requirements_enabled = config.managed_network_requirements_enabled();
let network_approval = Arc::new(NetworkApprovalService::default());
// The managed proxy can call back into core for allowlist-miss decisions.
let network_policy_decider_session = if managed_network_requirements_enabled {
let network_policy_decider_session = if managed_network_requirements_configured {
config
.permissions
.network
@@ -2016,7 +2025,7 @@ impl Session {
} else {
None
};
let blocked_request_observer = if managed_network_requirements_enabled {
let blocked_request_observer = if managed_network_requirements_configured {
config
.permissions
.network
@@ -2043,7 +2052,7 @@ impl Session {
config.permissions.sandbox_policy.get(),
network_policy_decider.as_ref().map(Arc::clone),
blocked_request_observer.as_ref().map(Arc::clone),
managed_network_requirements_enabled,
managed_network_requirements_configured,
network_proxy_audit_metadata,
)
.instrument(info_span!(
@@ -2200,7 +2209,11 @@ impl Session {
history_log_id,
history_entry_count,
initial_messages,
network_proxy: session_network_proxy,
network_proxy: session_network_proxy.filter(|_| {
Self::managed_network_proxy_active_for_sandbox_policy(
session_configuration.sandbox_policy.get(),
)
}),
rollout_path,
}),
})
@@ -2734,7 +2747,12 @@ impl Session {
self.services
.network_proxy
.as_ref()
.map(StartedNetworkProxy::proxy),
.and_then(|started_proxy| {
Self::managed_network_proxy_active_for_sandbox_policy(
session_configuration.sandbox_policy.get(),
)
.then(|| started_proxy.proxy())
}),
self.services.environment.clone(),
sub_id,
Arc::clone(&self.js_repl),