mirror of
https://github.com/openai/codex.git
synced 2026-11-05 20:10:33 +00:00
## Why Remote executions need managed-network proxy listeners in the executor so their loopback proxy addresses are reachable by the launched process. ## What changed - Add a capability-gated exec-server protocol field for executor-local proxy launch configuration, including network policy, audit metadata, and execution attribution. - Start the proxy while preparing a remote process, replace inherited proxy environment variables with its local addresses, and derive the sandbox context from its listeners. - Keep the proxy alive until inherited output streams close, then shut it down. - Reject unsupported remote settings such as MITM and credential injection. ## Testing - Cover configuration round trips and rejection of unsupported settings. - Verify executor-local startup, blocked-domain enforcement, protocol compatibility, and proxy lifetime through process closure. GitOrigin-RevId: c984f54e3e600aa9ebcbf8cf4574046e2c199d11
41 lines
1.1 KiB
Rust
41 lines
1.1 KiB
Rust
use super::*;
|
|
|
|
pub(super) struct ExecutionScope {
|
|
pub(super) environment_id: String,
|
|
pub(super) execution_id: String,
|
|
pub(super) attribution_token: String,
|
|
state: Arc<NetworkProxyState>,
|
|
}
|
|
|
|
impl Drop for ExecutionScope {
|
|
fn drop(&mut self) {
|
|
self.state.unregister_execution(&self.attribution_token);
|
|
}
|
|
}
|
|
|
|
impl NetworkProxy {
|
|
/// Returns a proxy that attributes trusted bridge connections to one execution.
|
|
pub fn for_execution(
|
|
&self,
|
|
environment_id: &str,
|
|
execution_id: &str,
|
|
attribution_token: String,
|
|
) -> Result<Self> {
|
|
anyhow::ensure!(
|
|
self.execution_scope.is_none(),
|
|
"cannot scope an execution-scoped network proxy"
|
|
);
|
|
self.state
|
|
.register_execution(&attribution_token, environment_id, execution_id);
|
|
|
|
let mut proxy = self.clone();
|
|
proxy.execution_scope = Some(Arc::new(ExecutionScope {
|
|
environment_id: environment_id.to_string(),
|
|
execution_id: execution_id.to_string(),
|
|
attribution_token,
|
|
state: Arc::clone(&self.state),
|
|
}));
|
|
Ok(proxy)
|
|
}
|
|
}
|