Skip to content

fix(policy): propose rules for unknown DNS hosts - #3707

Merged
pimlock merged 5 commits into
mainfrom
fix-policy-dns-new-host-proposals/pm
Sep 25, 2026
Merged

pimlock merged 5 commits into
mainfrom
fix-policy-dns-new-host-proposals/pm

Conversation

@pimlock

@pimlock pimlock commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fix missing mechanistic policy proposals when a sandbox requests a hostname absent from its network policy. Policy DNS now stages a contract-free synthetic observation so TCP mediation can capture the host, port, and verified binary, deny the connection, and send the denial to the mapper, even with agent-authored proposal settings unset. Docker workloads also stop inheriting host DNS search domains, because an observation answer for the first search-expanded name would otherwise shadow the name the workload asked for.

Related Issue

No issue required: this fixes the observed missing proposal for unknown DNS names in the existing policy DNS and policy advisor flow (related feature: #2712).

Changes

  • Stage unknown names locally without an upstream DNS lookup or egress grant. Every unknown lookup still emits the policy_dns_ineligible DNS denial, and a failed staging attempt emits a DNS failure event.
  • Keep the plain REFUSED answer for reserved names (localhost, metadata, and host-gateway aliases), during fail-closed policy quarantine, and after the observation budget is spent. Observations may hold at most a quarter of each address family's synthetic pool (up to 128 names per family for the supervisor lifetime), and their addresses are never reused.
  • Let transparent TCP policy evaluation read the observation name. The mediated path now re-acquires the policy DNS mapping at the generation that produced the authorization decision and denies any mismatch instead of resolving the name again, so an observation never reaches an upstream dial, even across a policy reload. The listener path already pinned the decision generation and also refuses observation records.
  • Name the queried host in DNS denial and failure events instead of host:53, which read as a connection to that host. Transparent TCP denials for a policy DNS address show the mapped hostname and keep the synthetic address in dst_endpoint.ip.
  • Stop Docker workload containers from inheriting host DNS search domains (dns_search set to .), matching the Podman, Kubernetes, and VM resolver configuration.
  • Add the new-hostname-proposal conformance scenario and register it in the installed-artifact policy-advisor suite. Both proposal scenarios share draft polling that tolerates transient rule get failures and requires a single draft scoped to the expected host, port, and binary.
  • Document policy DNS use for direct HTTP, HTTPS, and other TCP connections, the absence of search domains, the observation budget, and quarantine behavior. Update the architecture docs, CI.md, and the policy advisor e2e README.

Testing

  • mise run pre-commit passes.
  • Unit tests added/updated.

Checklist

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

Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
@github-actions

Copy link
Copy Markdown

Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
- Emit the policy_dns_ineligible denial for every unknown name and
  report observation staging failures as DNS failure events.
- Refuse unknown names during fail-closed quarantine and after the
  observation budget, now a quarter of each address family's pool.
- Pin transparent TCP to the mapping of the deciding policy generation
  so a reload between DNS and authorization fails closed.
- Stop Docker workloads from inheriting host DNS search domains, which
  let the first expanded short name claim an observation address.
- Share mechanistic draft polling in conformance, register
  new-hostname-proposal in the installed suite, and update docs.

Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
@pimlock pimlock added the test:e2e Requires end-to-end coverage label Sep 25, 2026
@github-actions

Copy link
Copy Markdown

Label test:e2e applied for 67f2bb4. Open the existing run and click Re-run all jobs to execute with the label set. The run will execute the standard E2E suite after building the required gateway, sandbox, and supervisor images once. The matching required CI gate status on this PR will flip green automatically once the run finishes.

Comment thread crates/openshell-driver-docker/src/lib.rs
The proxy tests name PolicyEndpointId, which proxy.rs imported only on
Linux, so the macOS test build failed. Import it for test builds too.

Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
DNS denial and failure events attached port 53 to the queried name,
which read as a connection to that host. They now carry only the name.
Transparent TCP denials for a policy DNS address show the mapped
hostname and keep the synthetic address in dst_endpoint.ip.

Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Comment thread crates/openshell-supervisor-network/src/policy_dns/mod.rs
@pimlock
pimlock added this pull request to the merge queue Sep 25, 2026
Merged via the queue into main with commit aead95b Sep 25, 2026
106 checks passed
@pimlock
pimlock deleted the fix-policy-dns-new-host-proposals/pm branch September 25, 2026 08:41
jakolehm added a commit to jakolehm/OpenShell that referenced this pull request Sep 25, 2026
Merge upstream 9244868, including NVIDIA#3707, while retaining the opt-in per-connection approval hook and deferred DNS path.

Keep deferred approvals distinct from non-authorizing observations, share the unknown-name budget, and retain reserved-name, quarantine, and policy-generation guards. Policy-changing approvals require a new DNS lookup and connection retry.

Validation: 1365 network tests passed (2 ignored); network all-target Clippy passed on Rust 1.95. Full mise gates were attempted but blocked by unavailable uv/sccache tooling and an installer shell test error.
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
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.

2 participants