Skip to content

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

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

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

Conversation

@huzaifa-d

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

Copy link
Copy Markdown
Contributor

📖 Description

Prevent legacy network host lists from silently changing or bypassing the selected network.defaultPolicy across shared validation, backend lowering, and SDK-generated requests.

  • Enforce the valid legacy defaultPolicy/host-list matrix in shared wxc_common validation while keeping policy models as raw data.
  • Make NanVix and Hyperlight lower the same validated legacy semantics, retaining backend-specific rejection when a microVM filter cannot represent both lists.
  • Make Node and Rust SDK builders emit a block default whenever an allowlist narrows outbound access; reject blocklist-only policies unless outbound is otherwise allowed. The C# SDK inherits the corrected Rust builder behavior through mxc_ffi.
  • Migrate affected Bubblewrap and LXC fixtures to equivalent valid shapes and update the LXC CIDR harness to assert its new default-DROP posture.
  • Keep Seatbelt backend tests on shared-valid inputs so they continue exercising backend representability, and correct their remediation guidance.
  • Correct Seatbelt, Bubblewrap, and cross-SDK documentation to distinguish shared validity, SDK construction, and backend representability.

🔗 References

Resolves #787

🔍 Validation

  • node scripts/versioning/validate-configs.js
  • npm test and npm run typecheck from sdk/node
  • cargo fmt --all -- --check
  • cargo test -p wxc_common
  • cargo test -p mxc_engine policy
  • cargo test -p mxc-sdk --test sdk_helpers
  • cargo test -p seatbelt_common --lib
  • cargo check -p seatbelt_common --tests --target aarch64-apple-darwin
  • cargo clippy -p seatbelt_common --tests --target aarch64-apple-darwin -- -D warnings
  • cargo test -p nanvix_runner
  • cargo test -p hyperlight_common --features hyperlight
  • cargo clippy -p wxc_common -p nanvix_runner --all-targets -- -D warnings
  • cargo clippy -p hyperlight_common --all-targets --features hyperlight -- -D warnings
  • cargo clippy -p mxc_engine -p mxc-sdk --all-targets -- -D warnings

✅ Checklist

  • Signed the Contributor License Agreement
  • Linked to an issue
  • Updated documentation (if applicable)
  • Updated Copilot instructions (not applicable; this correction does not change repository build commands, architecture, or contributor conventions)
  • 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

Copilot AI 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.

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.

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.
File Description
src/​backends/​nanvix/​runner/​src/​lib.rs Implements validation, fail-safe enablement, and tests.
docs/​nanvix-microvm/​nanvix.md Documents the network-policy matrix.
docs/​superpowers/​specs/​2026-08-31-nanvix-blocked-hosts-default-policy-design.md Records the fix design.
docs/​superpowers/​plans/​2026-08-31-nanvix-blocked-hosts-default-policy.md Records the implementation plan.

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

Copilot AI 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
@huzaifa-d
Huzaifa Danish (huzaifa-d) requested a review from a team as a code owner 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.

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.

Copilot review overview

Review tier: Balanced
Findings: None

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

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.

Copilot review overview

Review tier: Balanced
Findings: None

Comment thread src/backends/nanvix/runner/src/lib.rs Outdated
@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)

Comment thread docs/nanvix-microvm/nanvix.md Outdated
Comment thread src/backends/nanvix/runner/src/lib.rs Outdated

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-service microsoft-github-policy-service Bot added the Needs-Author-Feedback Issue needs attention from issue or PR author label Sep 1, 2026
Copilot AI review requested due to automatic review settings September 17, 2026 20:33
@huzaifa-d
Huzaifa Danish (huzaifa-d) requested a review from a team September 17, 2026 20:33
@microsoft-github-policy-service microsoft-github-policy-service Bot added Needs-Attention Issue needs attention from Microsoft and removed Needs-Author-Feedback Issue needs attention from issue or PR author labels Sep 17, 2026
Copilot AI review requested due to automatic review settings September 17, 2026 21:45

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.

Copilot review overview

🟡 Changes recommended

The NanVix documentation does not clearly state that blocklists under a block default are rejected.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
Resolved since last review (1)

Comment thread docs/nanvix-microvm/nanvix.md Outdated
Comment thread src/core/wxc_common/src/models.rs Outdated
Comment thread docs/schema.md Outdated
Reject legacy host lists that cannot refine defaultPolicy in shared validation,
keep ContainerPolicy as data, and have NanVix and Hyperlight lower validated
raw fields while retaining their backend-specific combined-list limitation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

Copilot review overview

🟡 Changes recommended

Existing Seatbelt and SDK documentation still describes a configuration now rejected by shared validation.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
Resolved since last review (1)

Comment thread docs/schema.md
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 18, 2026 03:56

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.

Copilot review overview

🟡 Changes recommended

Existing backend fixtures and public documentation contain combinations newly rejected by shared validation.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity · 1 Low severity

Open (2)

Comment thread src/core/wxc_common/src/validator.rs
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 18, 2026 16:37

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.

Copilot review overview

🟡 Changes recommended

The migrated Bubblewrap deny-precedence fixture now blocks its required control connection to 10.0.2.2.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (2)

Comment thread tests/configs/bubblewrap_network_firewall_denylist.json
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 18, 2026 16:59
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

Copilot review overview

🔵 Needs a closer look

The schema 0.8 version-specific documentation still describes legacy networking without the newly enforced validity rules.

Review effort: Balanced
Findings: None

Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Low severity Update the version-specific 0.8 legacy networking docs

docs/​schema.md:87

The new matrix also governs legacy fields accepted by schema 0.8, but docs/sandbox-policy/0.8.0/policy.md:55-65 still describes allowOutbound as unconditionally allowing egress and lists allowedHosts/blockedHosts without the newly required combinations. A reader of that version-specific contract can therefore author a policy that shared validation now rejects. Please mirror this matrix (or link to it and update the field descriptions) in the 0.8 policy page as part of this behavior change.

Copilot AI review requested due to automatic review settings September 18, 2026 17:02

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.

Copilot review overview

🟢 Approval recommended

The implementation consistently preserves default-policy semantics across validation, backend lowering, SDK construction, tests, and documentation.

Review effort: Balanced
Findings: None

Comment thread sdk/node/src/sandbox.ts
throw new Error(
"blockedHosts requires allowedHosts when network.defaultPolicy='block'",
);
}

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.

I'm unclear on why this is needed at SDK layer, but changes otherwise look good!

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.

:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Copilot-Instructions PR modifies Copilot instruction files (.github/copilot-instructions.md or .github/instructions/) Needs-Attention Issue needs attention from Microsoft

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NanVix blockedHosts overrides defaultPolicy=block

7 participants