Skip to content

Allow global network allowlist wildcard - #15549

Merged
rreichel3-oai merged 6 commits into
mainfrom
rreichel3/network-proxy-global-allow-wildcard
Mar 24, 2026
Merged

Allow global network allowlist wildcard#15549
rreichel3-oai merged 6 commits into
mainfrom
rreichel3/network-proxy-global-allow-wildcard

Conversation

@rreichel3-oai

Copy link
Copy Markdown
Contributor

Problem

Today codex-network-proxy rejects a global * in network.allowed_domains, so there is no static way to configure a denylist-only posture for public hosts. Users have to enumerate broad allowlist patterns instead.

Approach

  • Make global wildcard acceptance field-specific: allowed_domains can use *, while denied_domains still rejects a global wildcard.
  • Keep the existing evaluation order, so explicit denies still win first and local/private protections still apply unless separately enabled.
  • Add coverage for the denylist-only behavior and update the README to document it.

Validation

  • just fmt
  • cargo test -p codex-network-proxy (full run had one unrelated flaky telemetry test: network_policy::tests::emit_block_decision_audit_event_emits_non_domain_event; reran in isolation and it passed)
  • cargo test -p codex-network-proxy network_policy::tests::emit_block_decision_audit_event_emits_non_domain_event -- --exact --nocapture
  • just fix -p codex-network-proxy
  • just argument-comment-lint

Update network-proxy glob compilation and validation so the global * wildcard is accepted for allowed_domains but still rejected for denied_domains.

Add host-policy and config-state tests covering denylist-only behavior with a global allowlist wildcard, and refresh the network-proxy README to document the new mode.
Add a network-proxy regression test that starts from allowed_domains = ["*"], adds a new denied host that has no exact allowlist entry, and verifies the host is then blocked while the global allowlist remains.
Use allowlist- and denylist-specific glob compilation helpers instead of a positional boolean, and keep wildcard rejection validation only on the denylist path.
}

#[tokio::test]
async fn host_blocked_global_wildcard_allowlist_allows_public_hosts_except_denylist() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@bolinfest this test confirms this usecase functions as expected!

Comment thread codex-rs/network-proxy/src/policy.rs Outdated
for pattern in patterns {
ensure!(
!is_global_wildcard_domain_pattern(pattern),
matches!(global_wildcard, GlobalWildcard::Allow)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we deMorgan this to:

if global_wildcard == GlobalWildcard::Reject && is_global_wildcard_domain_pattern(pattern) {
  return Err(...)
}

Because then it's clearer that the error message follows from the condition.

Apply review feedback in network-proxy glob compilation by spelling the reject case as an explicit if/return Err branch instead of a negated ensure condition.
Raise the rust-ci tests job timeout from 30 to 40 minutes so slower Windows ARM runs have more headroom before GitHub cancels the job.
@rreichel3-oai
rreichel3-oai merged commit 1db6cb9 into main Mar 24, 2026
36 checks passed
@rreichel3-oai
rreichel3-oai deleted the rreichel3/network-proxy-global-allow-wildcard branch March 24, 2026 14:43
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 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.

2 participants