Skip to content

fix(policy): reject TLD wildcard patterns in network policy endpoints#791

Merged
johntmyers merged 1 commit intomainfrom
fix/reject-tld-wildcards
Apr 9, 2026
Merged

fix(policy): reject TLD wildcard patterns in network policy endpoints#791
johntmyers merged 1 commit intomainfrom
fix/reject-tld-wildcards

Conversation

@johntmyers
Copy link
Copy Markdown
Collaborator

Summary

TLD wildcards like *.com were accepted by openshell policy set but silently failed at the proxy layer — 0 bytes returned, connection closed, no denial logged. This makes them rejected at submission time with a clear InvalidArgument error.

Related Issue

Closes #787

Changes

  • openshell-policy: Added PolicyViolation::TldWildcard variant and host validation in validate_sandbox_policy() — rejects wildcard hosts with ≤2 DNS labels (e.g., *.com, **.org)
  • openshell-sandbox: Upgraded the "very broad wildcard" warning to a hard error in validate_l7_policies() as defense-in-depth
  • openshell-server: Inherited rejection via existing validate_policy_safety() delegation — added test coverage

Testing

  • mise run pre-commit passes
  • Unit tests added/updated (8 new tests across 3 crates)
  • E2E tests added/updated (if applicable)
  • Manual verification: deployed to local cluster, confirmed *.com policy is rejected at submission and control policies (*.wikipedia.org, httpbin.org) still work

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

TLD wildcards like *.com were accepted by policy validation but silently
failed at the proxy layer — 0 bytes returned, no denial logged. Now
rejected at submission time with a clear error message.

Closes #787
@johntmyers johntmyers self-assigned this Apr 9, 2026
@johntmyers johntmyers requested a review from a team as a code owner April 9, 2026 16:28
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot bot commented Apr 9, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@johntmyers johntmyers added the test:e2e Requires end-to-end coverage label Apr 9, 2026
@johntmyers johntmyers merged commit 13051df into main Apr 9, 2026
15 checks passed
@johntmyers johntmyers deleted the fix/reject-tld-wildcards branch April 9, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:e2e Requires end-to-end coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TLD wildcard patterns in network policy accepted but silently rejected by proxy

2 participants