Skip to content

doc: say which network policies attach no network device - #1006

Merged
Pedro Henrique Penna (ppenna) merged 1 commit into
devfrom
nvx-issue-fix/1001-no-device-policies
Oct 29, 2026
Merged

Pedro Henrique Penna (ppenna) merged 1 commit into
devfrom
nvx-issue-fix/1001-no-device-policies

Conversation

@ppenna

@ppenna Pedro Henrique Penna (ppenna) commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1001.

doc/run.md and doc/usage.md said that a sandbox policy that "lets nothing through" attaches no network device. nvx::host::network::openvmm_arguments attaches none exactly when a policy has no proxy, denies egress by default without allow rules, and denies ingress and host-loopback access, whatever its deny rules. This names that condition by its options in both documents, as the issue's first option asks, and keeps the behavior.

Based on dev at fbeb563bb. One documentation commit; no code, test, or behavior changes.

Problem and root cause

The documents described the condition by its effect, then listed --network-egress deny without allow rules, ingress denied, and --host-loopback deny. openvmm_arguments tests the policy's options instead (nvx-rs/src/host/network/arguments.rs: no proxy, egress == Deny, allow.rules.is_empty(), ingress == Deny, host_loopback == Deny), so both parts of the description were too broad:

  • A policy can let nothing through and still attach a device. On the CLI, --network-egress deny --host-loopback deny with --network-egress-allow 192.0.2.1 and --network-egress-deny 192.0.2.0/24, whose deny rule covers the allow rule, renders --net and both rules. Through the Rust API, a NetworkPolicy whose allow rule excepts its whole destination lowers to no OpenVMM rule but attaches a device, as the issue reports.
  • A proxy-only policy has every option that the documents listed, yet attaches a device for its proxy.

The documents also did not say which allow rules count. The CLI compiles a --network-egress-policy-file to native rules before it builds the policy, as nvx-rs/README.md describes, so a file whose allow rules all except their whole destinations leaves no allow rule and attaches no device, while the same rule in a typed policy of the Rust API counts.

Change

Commit Files Change
018ea1a34 doc doc/run.md, doc/usage.md Names the condition by its options in the Sandbox networking section of doc/run.md, in its note on what changed since earlier releases, and in the --net row of the sandbox options in doc/usage.md: --network-egress deny and --host-loopback deny, without allow rules, --network-ingress allow, or --network-proxy, whatever the deny rules. Says that a policy file's allow rules are those that it compiles to, that any other policy attaches a device even if it lets nothing through, with an example, and that the typed policy of the Rust API counts every allow rule.

Why documentation rather than a behavior change

The issue offers two fixes: name the condition by its options, or also attach no device for a policy whose allow rules lower to no OpenVMM rule, "which also changes the template key of such a policy". This takes the first, the conservative one:

The behavior change can still follow as its own issue once the template stack has landed, if maintainers want it.

Validation

  • Base: dev at fbeb563bb29adf085184227fde46deed29def40f. Head: 018ea1a34dc54cfeb323ee81a63dd806b1665efc, signed.

  • Reproduced on dev at the base, on Windows, before changing anything, with scratch tests that are not committed:

    • A unit test of openvmm_arguments for 10.0.0.2/24: no arguments for a deny-all policy, with or without a deny rule; --net and the portable profile for an allow rule whose except covers its whole cidr, with no --network-egress-allow rendered; for an allow rule that a deny rule covers; for a proxy-only policy; and for a deny-all policy with host-loopback access Outbound, the CLI's default without --host-loopback.
    • Three nvx-rs sandbox run --dry-run cases in the harness of nvx-rs/tests/cli/dry_run.rs: --network-egress deny --host-loopback deny alone renders no network option; adding --network-egress-allow 192.0.2.1 --network-egress-deny 192.0.2.0/24 renders --net and both rules; and a --network-egress-policy-file whose allow rule excepts its whole destination renders no network option.
    • nvx-rs egress compile of that policy file prints {"allow": [], "deny": []}.
  • At the head, on Windows: python scripts\check_markdown_links.py; python -m compileall -q scripts; and python -m unittest scripts/test_nvx_tools.py scripts/test_markdown_links.py scripts/test_performance.py with NVX_RS set to a release nvx-rs built at the base (732 tests, OK, 34 skipped). They include test_usage_documents_every_option_of_nvx_rs, which checks that the sandbox section of doc/usage.md names exactly the options of nvx-rs sandbox --help.

  • Hosts: none, since the change is documentation only and changes no runtime behavior.

    Host profile Backend Host type Result
    none n/a n/a Not applicable: no runtime behavior changes
  • CI: run 40892621875, attempt 1, passed on head 018ea1a34: Required status check and the 7 other checks that ran succeeded, and the other 29 were skipped, since every path is documentation and the change selects no suite; see Change classification. Nothing is pending.

Follow-ups

doc/run.md and doc/usage.md said that a sandbox policy that "lets
nothing through" attaches no network device, and listed egress denied
without allow rules, ingress denied, and --host-loopback deny. That is
not the rule that nvx::host::network::openvmm_arguments applies: it
attaches no device exactly when a policy has no proxy, denies egress by
default without allow rules, and denies ingress and host-loopback
access, whatever its deny rules. Both parts of the description were
too broad:

- A policy can let nothing through and still attach a device. A
  sandbox with --network-egress deny and --host-loopback deny renders
  --net and both rules when it also has --network-egress-allow
  192.0.2.1 and --network-egress-deny 192.0.2.0/24, whose deny rule
  covers the allow rule. Through the Rust API, a NetworkPolicy whose
  allow rule excepts its whole destination lowers to no OpenVMM rule
  but attaches a device too, as #1001 reports.
- A proxy-only policy has every option that the documents listed, but
  attaches a device for its proxy.

The documents also did not say which allow rules count. The CLI
compiles a --network-egress-policy-file to native rules before it
builds the policy, so a file whose allow rules all except their whole
destinations leaves no allow rule and attaches no device, while the
same rule in a typed policy of the Rust API counts.

Name the condition by its options in the Sandbox networking section of
doc/run.md, in its note on what changed since earlier releases, and in
the --net row of the sandbox options in doc/usage.md. Say that a policy
file's allow rules are those that it compiles to, that any other policy
attaches a device even if it lets nothing through, and that the typed
policy of the Rust API counts every allow rule.

The issue also offers attaching no device for a policy whose allow
rules lower to no OpenVMM rule. That would change behavior and the
template key of such policies, which the open template stack, #958 and
the pull requests above it, derives from this lowering; #958 even
defines the device of a closed policy as the one that the same policy
gets with one more such rule. So this change keeps the behavior and
documents it.

Fixes #1001.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 29, 2026 14:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified for this documentation-only clarification of when NVX omits a network device.

No open issues 🎉

What changed in this PR

This documentation-only PR addresses #1001 by stating the exact network-policy conditions under which NVX attaches no network device. Runtime behavior and template keys remain unchanged.

Changes:

  • Replaces “lets nothing through” with the specific options that omit a network device.
  • Clarifies how compiled policy-file allow rules differ from typed Rust API rules.
  • Adds an example of a policy that blocks all traffic but still attaches a device.
File Description
doc/​usage.md Clarifies device-attachment conditions in the sandbox --net reference.
doc/​run.md Explains the precise conditions, rule-counting differences, and an example; updates the historical behavior note.

Review effort: Balanced

@ppenna
Pedro Henrique Penna (ppenna) merged commit cb56326 into dev Oct 29, 2026
38 checks passed
@ppenna
Pedro Henrique Penna (ppenna) deleted the nvx-issue-fix/1001-no-device-policies branch October 29, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Say which network policies attach no network device

2 participants