fix(network-proxy): recheck network proxy connect targets#19999
fix(network-proxy): recheck network proxy connect targets#19999evawong-oai merged 2 commits intomainfrom
Conversation
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e0d08ebf92
ℹ️ 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".
| type Error = BoxError; | ||
|
|
||
| async fn connect(&self, addr: SocketAddr) -> Result<TcpStream, Self::Error> { | ||
| if !self.policy.allow_local_binding().await? && is_non_public_ip(addr.ip()) { |
There was a problem hiding this comment.
Preserve explicit local allowlist in target recheck
Rejecting all non-public socket addresses when allow_local_binding is false regresses a supported policy path: NetworkProxyState::host_blocked intentionally permits explicitly allowlisted local literals. With this connector check, allowlisted targets like localhost/10.0.0.1 pass host policy but are still denied at connect time (PermissionDenied), so valid configurations now fail.
Useful? React with 👍 / 👎.
|
Validation I ran before merge:
Remaining readiness gate: verify the target event build includes the merge commit and rerun the original rbndr.us PoC or an equivalent real Codex managed proxy regression showing the old local target read path fails. Ship decision: approved and merged as the minimal fix. I updated the readiness row to Closed but Verify. |
Why
The proxy checks the requested host before opening the upstream connection, but DNS can resolve an allowed hostname to a loopback, private, or other non-public address after that first decision. Without a final check on the actual socket target, a request that looks acceptable at the hostname layer can still connect to a local service once resolution completes.
What changed
CONNECT, SOCKS5, and MITM upstream connectionsSecurity impact
Direct proxy egress now rechecks the resolved socket address before connecting, closing the gap between hostname policy evaluation and the final network target.
Verification
cargo test -p codex-network-proxy