Skip to content

feat: introducing a network sandbox proxy#8442

Merged
viyatb-oai merged 77 commits intomainfrom
pr/network-proxy-crate
Jan 24, 2026
Merged

feat: introducing a network sandbox proxy#8442
viyatb-oai merged 77 commits intomainfrom
pr/network-proxy-crate

Conversation

@viyatb-oai
Copy link
Collaborator

@viyatb-oai viyatb-oai commented Dec 22, 2025

This add a new crate, codex-network-proxy, a local network proxy service used by Codex to enforce fine-grained network policy (domain allow/deny) and to surface blocked network events for interactive approvals.

  • New crate: codex-rs/network-proxy/ (codex-network-proxy binary + library)
  • Core capabilities:
    • HTTP proxy support (including CONNECT tunneling)
    • SOCKS5 proxy support (in the later PR)
    • policy evaluation (allowed/denied domain lists; denylist wins; wildcard support)
    • small admin API for polling/reload/mode changes
    • optional MITM support for HTTPS CONNECT to enforce “limited mode” method restrictions (later PR)

Will follow up integration with codex in subsequent PRs.

Testing

  • cd codex-rs && cargo build -p codex-network-proxy
  • cd codex-rs && cargo run -p codex-network-proxy -- proxy

@github-actions
Copy link
Contributor

github-actions bot commented Dec 22, 2025

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

@viyatb-oai viyatb-oai changed the title [sandbox] Introducing a network sandbox proxy feat: introducing a network sandbox proxy Dec 24, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

Closing this pull request because it has had no updates for more than 14 days. If you plan to continue working on it, feel free to reopen or open a new PR.

@github-actions github-actions bot closed this Jan 8, 2026
@viyatb-oai viyatb-oai reopened this Jan 8, 2026
Copy link
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: d2042b92b6

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
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: ef2c2d3131

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
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: 8c394c2dbd

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +385 to +387
.iter()
.map(|s| s.to_ascii_lowercase())
.collect();
Copy link
Contributor

Choose a reason for hiding this comment

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

P2 Badge Compare managed unix socket allowlists case-sensitively

The managed constraint check lowercases unix socket paths before comparing them. On case-sensitive macOS filesystems, this lets an untrusted layer satisfy the constraint with a different-cased path (e.g., managed allows /tmp/Sock, user config uses /tmp/sock), which can refer to a different socket while still passing validation. Socket paths should be compared exactly (or canonicalized) rather than case-folded.

Useful? React with 👍 / 👎.

Copy link
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: f2f6e54016

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +126 to +128
if cfg.policy.allow_unix_sockets.is_empty() {
return (http_addr, admin_addr);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

P2 Badge Gate unix-socket loopback clamping on supported platforms

clamp_bind_addrs forces both listeners onto 127.0.0.1 whenever allow_unix_sockets is non-empty, but unix-socket proxying is macOS-only (unix_socket_permissions_supported() returns false elsewhere). In a shared config that enables unix sockets for macOS, this will silently clamp Linux/Windows binds to loopback even when dangerously_allow_non_loopback_* is true, breaking non-loopback deployments despite the feature being unsupported. Consider guarding this clamping behavior behind the platform support check.

Useful? React with 👍 / 👎.

let codex_home = find_codex_home().context("failed to resolve CODEX_HOME")?;
let cli_overrides = Vec::new();
let overrides = LoaderOverrides::default();
let config_layer_stack = load_config_layers_state(&codex_home, None, &cli_overrides, overrides)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's look at this in a follow-up PR, as I'd like to have a stronger abstraction for detecting changes in the stack.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What's here is pretty good, but I want to take a deeper look when I have more time. This isn't blocking.

Copy link
Collaborator

@bolinfest bolinfest left a comment

Choose a reason for hiding this comment

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

Really amazing work here! Thanks for being so attentive to all of the feedback: I know it was a lot!!!

@viyatb-oai viyatb-oai removed the request for review from dylan-hurd-oai January 24, 2026 01:34
Copy link
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: 8daa525777

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +184 to +187
let path = cfg_path.display();
warn!("failed to reload config from {path}: {err}; keeping previous config");
Err(err)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

P1 Badge Continue serving when config reload fails

When build_config_state() returns an error (e.g., a transiently invalid config.toml), this branch returns Err(err) even though the previous config is explicitly kept. Because reload_if_needed() compares mtimes against the old layer_mtimes, the reload will be retried on every request and will keep returning an error, effectively taking the proxy down until the config is fixed. Consider swallowing the reload error (and/or updating mtimes) so the last known-good config continues to serve requests.

Useful? React with 👍 / 👎.

@viyatb-oai viyatb-oai merged commit 7722249 into main Jan 24, 2026
32 checks passed
@viyatb-oai viyatb-oai deleted the pr/network-proxy-crate branch January 24, 2026 01:47
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 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