network_proxy managed CA bundle is not exposed to Cargo via CARGO_HTTP_CAINFO

Open 💬 0 comments Opened Jul 12, 2026 by vladkens

What version of Codex CLI is running?

codex-cli 0.144.1

What subscription do you have?

ChatGPT Pro

Which model were you using?

gpt-5.5

What platform is your computer?

Darwin 25.5.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

Ghostty 1.3.1 (TERM=xterm-ghostty), no tmux, no zellij.

Codex doctor report

{
  "schemaVersion": 1,
  "overallStatus": "fail",
  "codexVersion": "0.144.1",
  "relevantChecks": {
    "config.load": {
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "CODEX_HOME": "/Users/user/.codex",
        "config.toml": "/Users/user/.codex/config.toml",
        "config.toml parse": "ok",
        "cwd": "/Users/user/Code/dotfiles",
        "model": "gpt-5.5",
        "model provider": "openai"
      }
    },
    "sandbox.helpers": {
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "OnRequest",
        "filesystem sandbox": "restricted",
        "network sandbox": "restricted"
      }
    },
    "runtime.provenance": {
      "status": "ok",
      "summary": "running brew on macos-aarch64",
      "details": {
        "install method": "brew",
        "platform": "macos-aarch64",
        "version": "0.144.1"
      }
    }
  },
  "note": "The full doctor output also reported unrelated local state DB warnings and provider reachability failures from the same restricted network context. This report is specifically about the managed network proxy CA bundle not being exposed through Cargo's documented CA environment variable."
}

What issue are you seeing?

When [features].network_proxy = true is enabled and the permission profile uses managed limited network mode, Codex injects the managed MITM CA bundle into several common CA environment variables, including:

  • SSL_CERT_FILE
  • REQUESTS_CA_BUNDLE
  • CURL_CA_BUNDLE
  • NODE_EXTRA_CA_CERTS
  • GIT_SSL_CAINFO
  • PIP_CERT
  • BUNDLE_SSL_CA_CERT
  • npm_config_cafile
  • NPM_CONFIG_CAFILE

However, Cargo does not reliably use these in this setup. As a result, Cargo commands that access crates.io through the managed proxy can fail TLS validation even when the relevant registry domains are allowlisted.

The missing environment variable is Cargo's documented CA bundle knob:

CARGO_HTTP_CAINFO

Cargo documents http.cainfo as configurable through CARGO_HTTP_CAINFO:

https://doc.rust-lang.org/cargo/reference/config.html#httpcainfo

What steps can reproduce the bug?

Use a permission profile with managed limited network proxy enabled and Cargo registry domains allowlisted:

default_permissions = "dev_workspace"

[permissions.dev_workspace.network]
enabled = true
mode = "limited"

[permissions.dev_workspace.network.domains]
"crates.io" = "allow"
"index.crates.io" = "allow"
"static.crates.io" = "allow"

[features]
network_proxy = true

Run:

$ cargo search serde --limit 1
error: failed to retrieve search results from the registry at https://crates.io

Caused by:
  [60] SSL peer certificate or SSH remote key was not OK (SSL certificate problem: unable to get local issuer certificate)

Control test using the managed CA bundle path already exposed by Codex:

$ CARGO_HTTP_CAINFO="$SSL_CERT_FILE" cargo search serde --limit 1
serde = "1.0.228"    # A generic serialization/deserialization framework
... and 18514 crates more (use --limit N to see more)
note: to learn more about a package, run `cargo info <name>`

That confirms the registry network policy is not the issue. Cargo succeeds as soon as the same managed CA bundle is provided through CARGO_HTTP_CAINFO.

What is the expected behavior?

Codex should expose the managed MITM CA bundle through Cargo's documented CA environment variable:

CARGO_HTTP_CAINFO

This should point to the same managed CA bundle path that Codex already injects into SSL_CERT_FILE, CURL_CA_BUNDLE, REQUESTS_CA_BUNDLE, and the other tool-specific CA variables.

Additional information

The likely fix is small:

// codex-rs/network-proxy/src/certs.rs
pub const CUSTOM_CA_ENV_KEYS: [&str; 11] = [
    "CODEX_CA_CERTIFICATE",
    "SSL_CERT_FILE",
    "REQUESTS_CA_BUNDLE",
    "CURL_CA_BUNDLE",
    "NODE_EXTRA_CA_CERTS",
    "GIT_SSL_CAINFO",
    "CARGO_HTTP_CAINFO",
    "PIP_CERT",
    "BUNDLE_SSL_CA_CERT",
    "npm_config_cafile",
    "NPM_CONFIG_CAFILE",
];

The existing proxy env injection code already iterates over CUSTOM_CA_ENV_KEYS, so adding Cargo's key should make the managed CA bundle available to Cargo automatically.

I can open a PR for this if maintainers want an external patch.

View original on GitHub ↗