mirror of
https://github.com/openai/codex.git
synced 2026-12-04 00:51:02 +00:00
## Why Private IP destinations always bypassed inherited upstream proxies, preventing their use for private networks reachable through an upstream VPN proxy. ## What changed - Add `codex exec-server --proxy-private-ips-via-upstream`, also configurable with `CODEX_EXEC_SERVER_PROXY_PRIVATE_IPS_VIA_UPSTREAM=true`. The setting defaults to disabled. - Allow permitted RFC 1918, carrier-grade NAT, and IPv6 unique-local destinations to use an applicable upstream proxy. Loopback and link-local destinations retain direct routing, and destination access policy still applies. - Keep connections direct when no valid upstream proxy applies or `allow_upstream_proxy=false`. Errors after selecting an upstream proxy do not trigger a direct retry. - Rename `ExecServerRuntimePaths` to `ExecServerRuntimeOptions` and carry the routing setting from executor startup into the managed network proxy. ## Testing Add routing coverage for private address ranges, special-use addresses, and public targets with the option enabled and disabled. Verify that HTTP and CONNECT requests still enforce destination allowlists and denylists, and update the CLI help snapshot. GitOrigin-RevId: b7c9cc7da0e0f545694a6521b74c9b36b7b92769
79 lines
2.2 KiB
Rust
79 lines
2.2 KiB
Rust
use crate::process_telemetry::ProcessTelemetry;
|
|
use codex_exec_server_protocol::JSONRPCErrorError;
|
|
|
|
use crate::ExecServerRuntimeOptions;
|
|
use crate::local_process::LocalProcess;
|
|
use crate::protocol::ExecParams;
|
|
use crate::protocol::ExecResponse;
|
|
use crate::protocol::ReadParams;
|
|
use crate::protocol::ReadResponse;
|
|
use crate::protocol::SignalParams;
|
|
use crate::protocol::SignalResponse;
|
|
use crate::protocol::TerminateParams;
|
|
use crate::protocol::TerminateResponse;
|
|
use crate::protocol::WriteParams;
|
|
use crate::protocol::WriteResponse;
|
|
use crate::rpc::RpcNotificationSender;
|
|
use crate::telemetry::ExecServerTelemetry;
|
|
|
|
#[derive(Clone)]
|
|
pub(crate) struct ProcessHandler {
|
|
process: LocalProcess,
|
|
}
|
|
|
|
impl ProcessHandler {
|
|
pub(crate) fn new(
|
|
notifications: RpcNotificationSender,
|
|
telemetry: ExecServerTelemetry,
|
|
runtime_paths: ExecServerRuntimeOptions,
|
|
) -> Self {
|
|
Self {
|
|
process: LocalProcess::new(notifications, telemetry, runtime_paths),
|
|
}
|
|
}
|
|
|
|
pub(crate) async fn shutdown(&self) {
|
|
self.process.shutdown().await;
|
|
}
|
|
|
|
pub(crate) fn set_notification_sender(&self, notifications: Option<RpcNotificationSender>) {
|
|
self.process.set_notification_sender(notifications);
|
|
}
|
|
|
|
pub(crate) async fn exec(
|
|
&self,
|
|
params: ExecParams,
|
|
telemetry: ProcessTelemetry,
|
|
) -> Result<ExecResponse, JSONRPCErrorError> {
|
|
self.process.exec(params, telemetry).await
|
|
}
|
|
|
|
pub(crate) async fn exec_read(
|
|
&self,
|
|
params: ReadParams,
|
|
) -> Result<ReadResponse, JSONRPCErrorError> {
|
|
self.process.exec_read(params).await
|
|
}
|
|
|
|
pub(crate) async fn exec_write(
|
|
&self,
|
|
params: WriteParams,
|
|
) -> Result<WriteResponse, JSONRPCErrorError> {
|
|
self.process.exec_write(params).await
|
|
}
|
|
|
|
pub(crate) async fn signal(
|
|
&self,
|
|
params: SignalParams,
|
|
) -> Result<SignalResponse, JSONRPCErrorError> {
|
|
self.process.signal_process(params).await
|
|
}
|
|
|
|
pub(crate) async fn terminate(
|
|
&self,
|
|
params: TerminateParams,
|
|
) -> Result<TerminateResponse, JSONRPCErrorError> {
|
|
self.process.terminate_process(params).await
|
|
}
|
|
}
|