mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +00:00
Keep sandbox preparation with the command through launch (#62205)
## What changed - Keep the prepared `SandboxExecRequest` intact in core and let `command/exec` borrow the prepared command for streaming. Windows restricted-token commands continue through the dedicated sandbox launcher. - Move runtime read-path selection for exec-server commands and filesystem helpers into `SandboxManager`. It derives the paths from the executor's binaries and, for managed process launches, finds the generated proxy CA bundle in the command environment. GitOrigin-RevId: 8c9d278496d84589bc4a7b7d0ed08cb1b8e6ba21
This commit is contained in:
@@ -3,6 +3,7 @@ use anyhow::Context as _;
|
||||
use anyhow::Result;
|
||||
use anyhow::anyhow;
|
||||
use base64::Engine as _;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use codex_utils_home_dir::find_codex_home;
|
||||
use rama_net::tls::ApplicationProtocol;
|
||||
use rama_tls_rustls::dep::pki_types::CertificateDer;
|
||||
@@ -604,6 +605,20 @@ fn is_generated_managed_ca_artifact_path(path: &Path, proxy_dir: &Path, prefix:
|
||||
format!("{:x}", Sha256::digest(trust_bundle)) == expected_hash
|
||||
}
|
||||
|
||||
/// Find a generated CA in the environment prepared for a managed route on this host.
|
||||
pub fn managed_mitm_ca_from_env(env: &HashMap<String, String>) -> Option<AbsolutePathBuf> {
|
||||
CUSTOM_CA_ENV_KEYS
|
||||
.into_iter()
|
||||
.chain(CHILD_ONLY_CA_ENV_KEYS)
|
||||
.filter_map(|key| env.get(key))
|
||||
.find_map(|path| {
|
||||
if !is_managed_mitm_ca_trust_bundle_path(path) {
|
||||
return None;
|
||||
}
|
||||
AbsolutePathBuf::from_absolute_path(path).ok()
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns whether `path` points at a current Codex-generated MITM CA bundle.
|
||||
pub fn is_managed_mitm_ca_trust_bundle_path(path: &str) -> bool {
|
||||
let Ok(proxy_dir) = managed_ca_dir() else {
|
||||
|
||||
@@ -46,6 +46,7 @@ pub use aws_sigv4::ProxySecretSource;
|
||||
pub use certs::CHILD_ONLY_CA_ENV_KEYS;
|
||||
pub use certs::CUSTOM_CA_ENV_KEYS;
|
||||
pub use certs::is_managed_mitm_ca_trust_bundle_path;
|
||||
pub use certs::managed_mitm_ca_from_env;
|
||||
pub use codex_utils_path_uri::Platform;
|
||||
pub use config::NetworkDomainPermission;
|
||||
pub use config::NetworkDomainPermissionEntry;
|
||||
|
||||
Reference in New Issue
Block a user