mirror of
https://github.com/openai/codex.git
synced 2026-11-14 21:40:39 +00:00
## Why Allowing a hostname must not bypass deny or review rules on its resolved IP addresses. Forwarding DNS resolution to an upstream proxy also requires checking whether those address restrictions can still be enforced. ## What changed - Add `TcpUpstreamProxy` and `set_tcp_upstream_proxy` to require a configured HTTP `CONNECT` next hop for opaque SOCKS TCP traffic. Wait for a successful response before forwarding payloads and preserve bytes read past the response headers. - Enforce resolved IP deny and review rules at direct connection time, carry destination-scoped authorization through HTTP, SOCKS, and MITM forwarding, and report blocked resolutions as policy denials. - Recognize equivalent numeric IP spellings for restrictive rules. Permit remote TCP DNS only when local binding is allowed and no deny or review pattern can restrict IP addresses; reject upstream proxy loops. - Restrict Linux proxy bridges to managed proxy environment keys and supplied loopback ports. Bound concurrent bridge workers and release them after connection failures while allowing queued responses to drain. - Add test-only Linux DNS name mapping and SOCKS relay helpers with stable synthetic addresses and validation before opening upstream connections. ## Testing Add regression coverage for CONNECT refusal and buffered tunnel data, resolved-address policy denials, approval handling across policy refreshes, equivalent IP literals, DNS mapping stability, rejected relay requests, and bridge cleanup after resets. GitOrigin-RevId: bdd6e16de3373d0eb39995f689dad0230680b99e
53 lines
1.3 KiB
Rust
53 lines
1.3 KiB
Rust
//! Linux sandbox helper entry point.
|
|
//!
|
|
//! On Linux, `codex-linux-sandbox` applies:
|
|
//! - in-process restrictions (`no_new_privs` + seccomp), and
|
|
//! - bubblewrap for filesystem isolation.
|
|
#[cfg(target_os = "linux")]
|
|
mod bazel_bwrap;
|
|
#[cfg(target_os = "linux")]
|
|
mod bundled_bwrap;
|
|
#[cfg(target_os = "linux")]
|
|
mod bwrap;
|
|
#[cfg(target_os = "linux")]
|
|
mod daemon_mounts;
|
|
#[cfg(target_os = "linux")]
|
|
mod exec_util;
|
|
#[cfg(target_os = "linux")]
|
|
mod fd_mount;
|
|
#[cfg(target_os = "linux")]
|
|
mod launcher;
|
|
#[cfg(target_os = "linux")]
|
|
mod linux_run_main;
|
|
#[cfg(all(target_os = "linux", test))]
|
|
mod managed_tcp;
|
|
#[cfg(all(target_os = "linux", test))]
|
|
mod managed_tcp_dns;
|
|
#[cfg(target_os = "linux")]
|
|
mod proxy_lifecycle;
|
|
#[cfg(target_os = "linux")]
|
|
mod proxy_routing;
|
|
#[cfg(target_os = "linux")]
|
|
mod seccomp;
|
|
#[cfg(target_os = "linux")]
|
|
mod wslg;
|
|
|
|
#[cfg(target_os = "linux")]
|
|
pub use bundled_bwrap::find_bundled_bwrap_for_exe;
|
|
#[cfg(target_os = "linux")]
|
|
pub use bwrap::expand_unreadable_globs;
|
|
|
|
/// Exit status returned when bundled bubblewrap fails digest verification.
|
|
#[cfg(target_os = "linux")]
|
|
pub const BUNDLED_BWRAP_DIGEST_VERIFICATION_FAILURE_EXIT_CODE: i32 = 8;
|
|
|
|
#[cfg(target_os = "linux")]
|
|
pub fn run_main() -> ! {
|
|
linux_run_main::run_main();
|
|
}
|
|
|
|
#[cfg(not(target_os = "linux"))]
|
|
pub fn run_main() -> ! {
|
|
panic!("codex-linux-sandbox is only supported on Linux");
|
|
}
|