Skip to content

Wire managed MITM CA trust into child env#22668

Merged
winston-openai merged 42 commits into
mainfrom
dev/winston/mitm-ca-trust
Jun 1, 2026
Merged

Wire managed MITM CA trust into child env#22668
winston-openai merged 42 commits into
mainfrom
dev/winston/mitm-ca-trust

Conversation

@winston-openai
Copy link
Copy Markdown
Contributor

@winston-openai winston-openai commented May 14, 2026

Stack

  1. Parent PR: Use named MITM permissions config #18240 uses named MITM permissions config.
  2. This PR wires managed MITM CA trust into spawned child processes.

Why

When Codex terminates HTTPS for limited mode or MITM hooks, child HTTPS clients need to trust Codex's managed MITM CA. Exporting proxy URLs alone is not enough, but blindly replacing user CA settings would be wrong: it can break custom enterprise/test roots, leak unreadable CA files into generated bundles, or make the child env disagree with its sandbox policy.

Summary

  1. Build immutable managed CA bundles under $CODEX_HOME/proxy that include native roots, the managed MITM CA, and only inherited or command-scoped CA bundles the child is allowed to read.
  2. Export curated CA env vars alongside managed proxy env vars while preserving user CA override semantics, including nested Codex SSL_CERT_FILE precedence.
  3. Thread generated CA bundle paths into child sandbox readable roots, including debug sandbox execution, so the exported env vars work inside sandboxed commands.
  4. Remove only Codex-generated MITM CA bundle env when a child intentionally drops managed proxying for escalation or no-proxy retry.
  5. Document the managed CA bundle behavior and cover env injection, per-child bundle generation, sandbox readable roots, and no-proxy cleanup in tests.

Validation

  1. Ran just test -p codex-network-proxy.
  2. Ran just test -p codex-protocol.
  3. Ran just fix -p codex-network-proxy -p codex-protocol.
  4. Tried focused codex-core validation, but the crate currently fails to compile in core/tests/suite/guardian_review.rs because an existing Op::UserInput initializer is missing additional_context.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 14, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@winston-openai winston-openai force-pushed the codex/mitm-feature-gate-landing branch from 7a319d2 to 60c5973 Compare May 15, 2026 12:33
@winston-openai winston-openai force-pushed the dev/winston/mitm-ca-trust branch from bf01363 to a410150 Compare May 15, 2026 12:33
@evawong-oai evawong-oai force-pushed the codex/mitm-feature-gate-landing branch 2 times, most recently from 09024fe to b4ceb64 Compare May 20, 2026 23:42
Base automatically changed from codex/mitm-feature-gate-landing to main May 21, 2026 00:10
@winston-openai winston-openai marked this pull request as ready for review May 26, 2026 19:52
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 13e783f35b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread codex-rs/network-proxy/src/certs.rs Outdated
Comment thread codex-rs/network-proxy/src/certs.rs Outdated
Comment thread codex-rs/network-proxy/src/proxy.rs Outdated
Comment thread codex-rs/network-proxy/src/certs.rs
@winston-openai
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e910c8c788

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread codex-rs/network-proxy/src/proxy.rs Outdated
Comment thread codex-rs/network-proxy/src/certs.rs
@winston-openai winston-openai requested a review from a team as a code owner May 26, 2026 22:45
@winston-openai
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bb82054dd0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread codex-rs/network-proxy/src/proxy.rs Outdated
Comment thread codex-rs/linux-sandbox/src/bwrap.rs Outdated
Comment thread codex-rs/network-proxy/Cargo.toml
Comment thread codex-rs/linux-sandbox/src/linux_run_main.rs Outdated
Comment thread codex-rs/network-proxy/src/certs.rs Outdated
@winston-openai
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 971cbc3d86

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread codex-rs/network-proxy/src/certs.rs Outdated
Comment thread codex-rs/network-proxy/src/proxy.rs Outdated
Comment thread codex-rs/core/src/tools/runtimes/mod.rs Outdated
@winston-openai
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0cd665434c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread codex-rs/network-proxy/src/proxy.rs Outdated
Comment thread codex-rs/network-proxy/src/proxy.rs Outdated
Comment thread codex-rs/core/src/tools/runtimes/mod.rs Outdated
Comment thread codex-rs/network-proxy/src/proxy.rs Outdated
Comment thread codex-rs/network-proxy/src/proxy.rs
Comment thread codex-rs/core/src/tools/runtimes/mod.rs Outdated
@winston-openai
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

let dir = File::open(parent).with_context(|| format!("failed to open {}", parent.display()))?;
dir.sync_all()
.with_context(|| format!("failed to fsync {}", parent.display()))?;

P2 Badge Avoid fsyncing directories on Windows

On Windows, File::open(parent) for a directory typically fails with access denied, so every new write_atomic_create_new call returns an error after creating/linking the file. When MITM is first enabled on Windows this can leave ca.key written but report failure before ca.pem is created, after which subsequent startups hit the “both managed MITM CA files must exist” path and MITM remains unusable until the user manually cleans $CODEX_HOME/proxy. Gate the directory fsync to platforms that support opening directories, or make it best-effort.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread codex-rs/network-proxy/Cargo.toml
@winston-openai
Copy link
Copy Markdown
Contributor Author

[codex] Addressed the Windows directory-fsync feedback in 6c939f9: file contents are still fsynced, but the parent-directory fsync is gated off on Windows where opening directories via File::open is not reliable.

@winston-openai
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6c939f9b0c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread codex-rs/network-proxy/src/certs.rs Outdated
Comment thread codex-rs/network-proxy/src/proxy.rs Outdated
@winston-openai
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7a21873b67

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread codex-rs/network-proxy/src/certs.rs
Comment thread codex-rs/network-proxy/src/proxy.rs
Comment thread codex-rs/network-proxy/Cargo.toml
@winston-openai
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b2ba6db5f2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread codex-rs/network-proxy/src/proxy.rs
Comment thread codex-rs/network-proxy/Cargo.toml
Copy link
Copy Markdown
Collaborator

@viyatb-oai viyatb-oai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed current head. No remaining blocking findings under the agreed scope for command-scoped custom CA overrides.

@winston-openai winston-openai enabled auto-merge (squash) June 1, 2026 16:16
@winston-openai winston-openai merged commit bca18cb into main Jun 1, 2026
46 of 47 checks passed
@winston-openai winston-openai deleted the dev/winston/mitm-ca-trust branch June 1, 2026 23:24
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants