Skip to content

NanVix: Preserve block-default networking with blockedHosts - #1071

Open
Huzaifa Danish (huzaifa-d) wants to merge 7 commits into
mainfrom
user/modanish/fix-issue-787
Open

NanVix: Preserve block-default networking with blockedHosts#1071
Huzaifa Danish (huzaifa-d) wants to merge 7 commits into
mainfrom
user/modanish/fix-issue-787

Conversation

@huzaifa-d

@huzaifa-dHuzaifa Danish (huzaifa-d) commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

📖 Description

Prevent the NanVix backend from treating blockedHosts as permission to enable
host networking when network.defaultPolicy is block.

  • Reject blockedHosts unless the default network policy is allow.
  • Keep allowedHosts valid as an allowlist under the secure block default.
  • Make network enablement independently fail safe if validation is bypassed.
  • Document the supported NanVix network-policy combinations.

🔗 References

Resolves#787

🔍 Validation

  • cargo fmt --all -- --check
  • cargo clippy -p nanvix_runner --all-targets -- -D warnings
  • cargo test -p nanvix_runner (37 passed)
  • Rust-specific review and cross-model adversarial review completed; findings addressed.

✅ Checklist

  • Signed the Contributor License Agreement
  • Linked to an issue
  • Updated documentation (if applicable)
  • Updated Copilot instructions (not applicable; no build, architecture, or convention changes)
  • If this PR changes Cargo.lock, the dependency-feed-check check passes (not applicable; Cargo.lock is unchanged)

📋 Issue Type

  • Bug fix
  • Feature
  • Task

GitHub Actions runs the PR validation build automatically. The ADO pipeline
(MXC-PR-Build) is the Azure version of the PR pipeline, kept in parity with the GitHub
Actions build; it runs on merge to main, and Microsoft reviewers with write access can trigger it
on a PR with /azp run. See docs/pull-requests.md.

If the dependency-feed-check check fails on a new dependency, the crate must be added to
the feed before the PR can pass. See docs/pull-requests.md
for the steps.

Microsoft Reviewers: Open in CodeFlow

huzaifa-msftand others added 5 commits August 31, 2026 10:29
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI balanced review requested due to automatic review settings August 31, 2026 18:32
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

CopilotAI 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.

Copilot review overview

Review tier: Balanced
Findings: None

What changed in this PR

Fixes NanVix networking so blockedHosts cannot widen block-default policies.

Changes:

  • Rejects blocklists unless defaultPolicy is allow.
  • Makes network enablement fail-safe and adds regression tests.
  • Documents supported policy combinations.
FileDescription
src/​backends/​nanvix/​runner/​src/​lib.rsImplements validation, fail-safe enablement, and tests.
docs/​nanvix-microvm/​nanvix.mdDocuments the network-policy matrix.
docs/​superpowers/​specs/​2026-08-31-nanvix-blocked-hosts-default-policy-design.mdRecords the fix design.
docs/​superpowers/​plans/​2026-08-31-nanvix-blocked-hosts-default-policy.mdRecords the implementation plan.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

CopilotAI review requested due to automatic review settings September 1, 2026 17:12
@huzaifa-d
Huzaifa Danish (huzaifa-d) marked this pull request as ready for review September 1, 2026 17:13
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

CopilotAI 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.

Copilot review overview

Review tier: Balanced
Findings: None

CopilotAI review requested due to automatic review settings September 1, 2026 17:13

CopilotAI 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.

Copilot review overview

Review tier: Balanced
Findings: None

Comment on lines +654 to +660
if !request.policy.blocked_hosts.is_empty()
&& request.policy.default_network_policy != NetworkPolicy::Allow
{
return Err(NanVixError::Preflight(
ERR_BLOCKED_HOSTS_REQUIRE_ALLOW.to_string(),
));
}

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.

thought: I guess you do this because there's no point in having a block list when default is already to block? I figured in that case we'd just ignore the block list entries since all of them would be blocked anyway, but it's probably fine to be thorough.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Branden, don't we need to unify the semantics of this at the policy layer? Why is this per backend?

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@jsidewhite

Copy link
Copy Markdown
Member

Per-host egress filtering

This is policy that applies equally to all backends. Can we unify the documentation on this in the backend-agnostic location?


Refers to: docs/nanvix-microvm/nanvix.md:164 in f900351. [](commit_id = f900351, deletion_comment = False)

| Workload | Error |
| ------------------------------- | ----------------------------------- |
| Both `allowedHosts` + `blockedHosts` | Rejected at preflight (mutually exclusive) |
| `blockedHosts` + `defaultPolicy: "block"` | Rejected at preflight (blocklists require an allow default) |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same

/// the runner passes `-allow-host-networking` to nanvixd; per-host lists are
/// additionally forwarded as `-allow-host`/`-block-host` (see
/// [`Self::spawn_nanvixd`]).
fn host_networking_enabled(request: &ExecutionRequest) -> bool {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

host_networking_enabled

Huzaifa, what would this take to pull out into a common lib?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🕐

@microsoft-github-policy-servicemicrosoft-github-policy-serviceBot added the Needs-Author-Feedback Issue needs attention from issue or PR author label Sep 1, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs-Author-FeedbackIssue needs attention from issue or PR author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NanVix blockedHosts overrides defaultPolicy=block

6 participants

@huzaifa-d@jsidewhite@dhoehna@bbonaby@huzaifa-msft