fix: attribut network requests to the exact exec on linux - #29697
Merged
Conversation
Contributor
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e522994a0a
ℹ️ 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".
jif-oai
force-pushed
the
jif/network-exec-attribution
branch
from
June 23, 2026 20:13
e522994 to
4a71b1a
Compare
viyatb-oai
reviewed
Jun 23, 2026
Contributor
There was a problem hiding this comment.
One issue before landing:
codex-rs/network-proxy/src/network_policy.rs:305— The execution ID is added only to the cloned request sent toNetworkPolicyDecider. The policy audit event below is still built from the original request and has no execution field; baseline-allowed and baseline-denied requests do not call the decider at all. Those audit records therefore remain unattributed even though the accepted connection has execution-scoped state.
can we derive the attribution from state before policy branching, include it in the audit event, and cover both baseline allow and deny paths.
viyatb-oai
force-pushed
the
jif/network-exec-attribution
branch
from
June 23, 2026 20:56
4a71b1a to
c4c3ea4
Compare
ddraper-oai
added a commit
that referenced
this pull request
Jun 23, 2026
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
viyatb-oai
force-pushed
the
jif/network-exec-attribution
branch
from
June 23, 2026 21:26
ed58547 to
ef9631d
Compare
viyatb-oai
force-pushed
the
jif/network-exec-attribution
branch
from
June 23, 2026 21:43
ef9631d to
a4e5878
Compare
viyatb-oai
approved these changes
Jun 23, 2026
jif-oai
commented
Jun 24, 2026
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
viyatb-oai
force-pushed
the
jif/network-exec-attribution
branch
from
June 25, 2026 17:56
6af16d9 to
10f7126
Compare
Co-authored-by: Codex <noreply@openai.com>
dylan-hurd-oai
approved these changes
Jul 6, 2026
Co-authored-by: Codex noreply@openai.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Managed-network commands within one Codex conversation share the same HTTP and SOCKS proxy ingress. When several exec calls run concurrently, the proxy sees the requested destination but cannot tell which exec opened the connection.
For example:
The complete path is:
Dropping the active or deferred exec registration removes the token. Connections that were already accepted retain their resolved attribution; new connections using an expired token fail closed.
Before and after
Before, Guardian could receive only the network destination:
{ "tool": "network_access", "host": "www.17track.net", "port": 443, "protocol": "https" }After, the same request includes the action that caused it:
{ "tool": "network_access", "host": "www.17track.net", "port": 443, "protocol": "https", "trigger": { "callId": "exec-network-first", "command": ["/bin/sh", "-c", "curl https://www.17track.net"] } }Listener accounting
This PR does not create proxy listeners per exec.
The Linux sandbox already creates a trusted routing bridge for each sandboxed command. This PR adds a short frame write to that bridge rather than introducing another listener, task, or proxy process.
The existing conversation-scoped listener pair remains. Making a single proxy service shared across multiple conversations would be a separate multi-tenant architecture change involving per-conversation policy, configuration, audit, and Guardian routing.
Keeping the implementation small
The attribution is bound once, when the TCP connection enters the proxy. The ingress installs an execution-scoped clone of the existing
NetworkProxyState, so the established HTTP, SOCKS, MITM, policy, audit, and blocked-request paths continue using their existing state lookup.This avoids plumbing a new request-context type through every protocol handler. Outside the two ingress wrappers, protocol-specific request handling is unchanged.
Security behavior
Platform scope
Exact bridge attribution is enabled on Linux. macOS and Windows retain their current shared-proxy behavior.
Test coverage
The concurrent end-to-end test starts two managed-network execs together and synchronizes them so both are active before either connects. It then inspects the two Guardian requests and compares the complete attribution pairs:
Focused proxy coverage verifies the bounded frame and that a registered framed connection receives the matching execution and environment state.
Scope
This fixes the Linux network-to-exec attribution path and records a denial against the exact matching tool call. It intentionally does not change:
Those remain separate concerns from attribution.
Relationship to #29456 and #29668
#29456 made the proxy environment and sandbox policy come from the same prepared network context. This PR adds the execution token to that prepared launch and consumes it at the shared ingress.
This follows #29668's shared-ingress framing direction, but completes the production registration, Linux bridge, core call mapping, denial mapping, and concurrent end-to-end path. It also keeps attribution in the existing per-connection proxy state instead of introducing request-context plumbing through every HTTP, SOCKS, and MITM handler. This PR is intended to supersede #29668 for the Linux attribution fix.