Merge commit 'cdbbc6f300007a64d075966e69638f35e269b0c8' into HEAD

This commit is contained in:
Winston Howes
2026-05-26 16:31:36 -07:00
10 changed files with 169 additions and 95 deletions
+2 -2
View File
@@ -37,8 +37,8 @@ mode = "full" # default when unset; use "limited" for read-only mode
# CA cert/key are managed internally under $CODEX_HOME/proxy/ (ca.pem + ca.key).
# When MITM is active, spawned commands receive CA bundle env vars pointing at
# $CODEX_HOME/proxy/ca-bundle.pem so common HTTPS clients trust the managed CA.
# Linux bubblewrap sandboxes also overlay that bundle onto common system CA
# bundle paths inside the sandbox namespace.
# Linux bubblewrap sandboxes also append the managed CA cert to common system
# CA bundle paths inside the sandbox namespace.
# If false, local/private networking is rejected. Explicit allowlisting of local IP literals
# (or `localhost`) is required to permit them.
+4
View File
@@ -125,6 +125,10 @@ fn managed_ca_paths() -> Result<(PathBuf, PathBuf)> {
))
}
pub(crate) fn managed_ca_cert_path() -> Result<PathBuf> {
managed_ca_paths().map(|(cert_path, _)| cert_path)
}
pub(crate) fn managed_ca_trust_bundle_path(env: &HashMap<String, String>) -> Result<PathBuf> {
let (cert_path, _) = managed_ca_paths()?;
let trust_bundle_path = cert_path
+14 -8
View File
@@ -301,20 +301,26 @@ struct NetworkProxyRuntimeSettings {
allow_local_binding: bool,
allow_unix_sockets: Arc<[String]>,
dangerously_allow_all_unix_sockets: bool,
mitm_ca_cert_path: Option<PathBuf>,
mitm_ca_trust_bundle_path: Option<PathBuf>,
}
impl NetworkProxyRuntimeSettings {
fn from_config(config: &config::NetworkProxyConfig) -> Result<Self> {
let mitm_ca_trust_bundle_path = config
.network
.mitm
.then(|| crate::certs::managed_ca_trust_bundle_path(&std::env::vars().collect()))
.transpose()?;
let (mitm_ca_cert_path, mitm_ca_trust_bundle_path) = if config.network.mitm {
let env = std::env::vars().collect();
(
Some(crate::certs::managed_ca_cert_path()?),
Some(crate::certs::managed_ca_trust_bundle_path(&env)?),
)
} else {
(None, None)
};
Ok(Self {
allow_local_binding: config.network.allow_local_binding,
allow_unix_sockets: config.network.allow_unix_sockets().into(),
dangerously_allow_all_unix_sockets: config.network.dangerously_allow_all_unix_sockets,
mitm_ca_cert_path,
mitm_ca_trust_bundle_path,
})
}
@@ -614,9 +620,9 @@ impl NetworkProxy {
self.runtime_settings().dangerously_allow_all_unix_sockets
}
/// Returns the managed CA bundle child sandboxes should trust while MITM is active.
pub fn mitm_ca_trust_bundle_path(&self) -> Option<PathBuf> {
self.runtime_settings().mitm_ca_trust_bundle_path
/// Returns the managed CA cert child sandboxes should add to native trust paths.
pub fn mitm_ca_cert_path(&self) -> Option<PathBuf> {
self.runtime_settings().mitm_ca_cert_path
}
pub fn apply_to_env(&self, env: &mut HashMap<String, String>) {