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:
viyatb-oai
2026-11-18 06:22:36 +00:00
committed by copyberry
parent a734a13ad7
commit a4495dd5c9
22 changed files with 495 additions and 372 deletions
+15
View File
@@ -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 {
+1
View File
@@ -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;