feat(network-proxy): add embedded OTEL policy audit logging#12046
Merged
mcgrew-oai merged 37 commits intomainfrom Feb 25, 2026
Merged
feat(network-proxy): add embedded OTEL policy audit logging#12046mcgrew-oai merged 37 commits intomainfrom
mcgrew-oai merged 37 commits intomainfrom
Conversation
feat(network-proxy): add embedded OTEL policy audit logging
refactor(network-proxy): reduce HTTP audit helper args to satisfy clippy - change `emit_http_block_decision_audit_event` in `network-proxy/src/http_proxy.rs` to accept a single `BlockDecisionAuditEventArgs` parameter instead of 8 scalar arguments - update all HTTP deny-path callsites (CONNECT limited mode, unix-socket method/guard/unsupported/not-allowed, proxy-disabled, and method-policy denies) to construct and pass `BlockDecisionAuditEventArgs` - preserve existing audit behavior and fields while removing repeated argument plumbing and clippy `too_many_arguments` violations
network-proxy: unify OTel policy events under policy_decision
Contributor
Author
### Network-proxy OTel event matrix
All policy telemetry now emits:
- `event.name = codex.network_proxy.policy_decision`
Use the tuple `(scope, decision, source, reason)` to distinguish scenarios.
1. **Host-policy allow (HTTP/CONNECT/SOCKS)**
- `network.policy.scope = domain`
- `network.policy.decision = allow`
- `network.policy.source = baseline_policy` or `decider`
- `network.policy.reason = allow` or `not_allowed` (override case)
- Protocol can be `http`, `https_connect`, `socks5_tcp`, `socks5_udp`
2. **Host-policy deny**
- `network.policy.scope = domain`
- `network.policy.decision = deny`
- `network.policy.source = baseline_policy` or `decider`
- `network.policy.reason` commonly one of:
- `denied`
- `not_allowed`
- `not_allowed_local`
- `policy_denied`
3. **Host-policy ask (decider)**
- `network.policy.scope = domain`
- `network.policy.decision = ask`
- `network.policy.source = decider`
- `network.policy.reason` commonly `not_allowed`
4. **Limited-mode method deny (HTTP/CONNECT)**
- `network.policy.scope = non_domain`
- `network.policy.decision = deny`
- `network.policy.source = mode_guard`
- `network.policy.reason = method_not_allowed`
5. **Limited-mode method deny (SOCKS)**
- `network.policy.scope = non_domain`
- `network.policy.decision = deny`
- `network.policy.source = mode_guard`
- `network.policy.reason = method_not_allowed`
6. **Proxy disabled (any path)**
- `network.policy.scope = non_domain`
- `network.policy.decision = deny`
- `network.policy.source = proxy_state`
- `network.policy.reason = proxy_disabled`
7. **Unix socket unsupported platform**
- `network.policy.scope = non_domain`
- `network.policy.decision = deny`
- `network.policy.source = proxy_state`
- `network.policy.reason = unix_socket_unsupported`
- Sentinel endpoint fields:
- `server.address = unix-socket`
- `server.port = 0`
8. **Unix socket not allowlisted**
- `network.policy.scope = non_domain`
- `network.policy.decision = deny`
- `network.policy.source = proxy_state`
- `network.policy.reason = not_allowed`
- Sentinel endpoint fields:
- `server.address = unix-socket`
- `server.port = 0`
9. **Unix socket allowlisted (new in this PR)**
- `network.policy.scope = non_domain`
- `network.policy.decision = allow`
- `network.policy.source = proxy_state`
- `network.policy.reason = allow`
- Sentinel endpoint fields:
- `server.address = unix-socket`
- `server.port = 0`
Note: one request can emit multiple events in sequence (for example `domain/allow` followed by `non_domain/deny` in limited mode). |
Contributor
Author
|
@codex review |
Contributor
|
Codex Review: Didn't find any major issues. Chef's kiss. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
viyatb-oai
approved these changes
Feb 18, 2026
feat(network-proxy): add embedded OTEL policy audit logging
refactor(network-proxy): reduce HTTP audit helper args to satisfy clippy - change `emit_http_block_decision_audit_event` in `network-proxy/src/http_proxy.rs` to accept a single `BlockDecisionAuditEventArgs` parameter instead of 8 scalar arguments - update all HTTP deny-path callsites (CONNECT limited mode, unix-socket method/guard/unsupported/not-allowed, proxy-disabled, and method-policy denies) to construct and pass `BlockDecisionAuditEventArgs` - preserve existing audit behavior and fields while removing repeated argument plumbing and clippy `too_many_arguments` violations
network-proxy: unify OTel policy events under policy_decision
remove attempt_id
…enai/codex into mcgrew/new-network-proxy-logs
…enai/codex into mcgrew/new-network-proxy-logs
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.
PR Summary
This PR adds embedded-only OTEL policy audit logging for
codex-network-proxyand threads audit metadata fromcodex-coreinto managed proxy startup.What changed
network_policy.rswith targetcodex_otel.network_proxy.codex.network_proxy.domain_policy_decisiononce per domain-policy evaluation.codex.network_proxy.block_decisionfor non-domain denies.event.timestamp, and fallback defaults (http.request.method="none",client.address="unknown").REASON_UNIX_SOCKET_UNSUPPORTEDand used it for unsupported unix-socket auditing.NetworkProxyAuditMetadatato runtime/state, re-exported fromlib.rsandstate.rs.start_proxy_with_audit_metadata(...)in core config, withstart_proxy()delegating to default metadata.codex.rsfrom session/auth context, including originator sanitization for OTEL-safe tagging.network-proxy/README.mdwith embedded-mode audit schema and behavior notes.server.address="unix-socket",server.port=0).Explicit exclusions
main.rsbinary wiring.standalone_otel.rs.Tests
network_policy.rstests for event mapping, metadata propagation, fallbacks, timestamp format, and target prefix.Validation run
just fmtcargo test -p codex-network-proxy✅cargo test -p codex-coreran with one unrelated flaky timeout (shell_snapshot::tests::snapshot_shell_does_not_inherit_stdin), and the test passed when rerun directly ✅