Skip to content

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

Merged
Huzaifa Danish (huzaifa-d) merged 8 commits into
mainfrom
user/modanish/fix-issue-787
Sep 25, 2026
Merged

Huzaifa Danish (huzaifa-d) merged 8 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 Waiting for additional information or action from the issue or pull-request 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 Requires attention or a decision from the MXC maintainers. and removed Needs-Author-Feedback Waiting for additional information or action from the issue or pull-request author. labels Sep 17, 2026
huzaifa-msft and others added 3 commits September 25, 2026 12:13
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep the authored allowOutbound value in the private in-process request while retaining block-default wire generation for allowlists.

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

🟢 Approval recommended

Shared validation, SDK projection, backend behavior, fixtures, tests, and documentation are consistently aligned.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
Resolved since last review (2)

Comment thread sdk/node/src/bindings/request.ts Outdated
@jsidewhite

Copy link
Copy Markdown
Member
fn validate_policies(request: &ExecutionRequest) -> Result<(), RunnerError> {

todo future: remove this


Refers to: src/backends/hyperlight/common/src/lib.rs:476 in 6f0a5ef. [](commit_id = 6f0a5ef, deletion_comment = False)

@jsidewhite

Copy link
Copy Markdown
Member
    }

remove this? you already put it in validator.rs

fn validate_legacy_host_lists(request: &ExecutionRequest) -> Result<(), ScriptResponse> {
    let policy = &request.policy;

    if policy.default_network_policy == NetworkPolicy::Block
        && policy.allowed_hosts.is_empty()
        && !policy.blocked_hosts.is_empty()
    {
        return Err(ScriptResponse::error(
            "blockedHosts requires allowedHosts when network.defaultPolicy='block'",
        ));
    }

    if policy.default_network_policy == NetworkPolicy::Allow && !policy.allowed_hosts.is_empty() {
        return Err(ScriptResponse::error(
            "allowedHosts requires network.defaultPolicy='block'",
        ));
    }

    Ok(())
}

Refers to: src/backends/hyperlight/common/src/lib.rs:490 in 6f0a5ef. [](commit_id = 6f0a5ef, deletion_comment = False)

Comment thread sdk/node/src/sandbox.ts Outdated
Comment thread src/core/mxc_engine/src/policy/exact/mod.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 Waiting for additional information or action from the issue or pull-request author. label Sep 25, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 25, 2026 20:15

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

It changes security-boundary networking semantics across several platform backends and SDK request paths, requiring final human validation.

Review effort: Balanced
Findings: 1 Low severity

Open (1)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 25, 2026 20:50

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

Node and Rust builders still accept invalid blocklist-only authoring on Unix instead of enforcing the documented SDK contract.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
Previously missed (2)

In code that hasn't changed since last review

Medium severity Do not defer blocklist-only validation on Unix

sdk/​node/​src/​sandbox.ts:544

This Unix exception still applies to both host lists, so blockedHosts with neither allowedHosts nor allowOutbound is emitted as defaultPolicy: 'block' and only fails later during backend execution. That contradicts the SDK contract documented in this PR that blocklist-only authoring is rejected unless outbound is otherwise allowed. Reject that shape before applying the backend-specific exception; only bare allowlists should be deferred.

Medium severity Reject blocklist-only policies during request authoring

src/​core/​mxc-sdk/​tests/​sdk_helpers.rs:183

The Unix branch codifies the opposite of the stated Rust SDK contract: build_request succeeds for a blocklist-only policy even though the generated block-default request is invalid under the new shared matrix. Add an authoring check for blocked_hosts non-empty with both allowed_hosts empty and allow_outbound == false, then require this case to fail on every platform rather than deferring it to execution.

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:

@huzaifa-d
Huzaifa Danish (huzaifa-d) merged commit 6b2c889 into main Sep 25, 2026
31 checks passed
@huzaifa-d
Huzaifa Danish (huzaifa-d) deleted the user/modanish/fix-issue-787 branch September 25, 2026 22:09
@microsoft-github-policy-service microsoft-github-policy-service Bot removed Needs-Attention Requires attention or a decision from the MXC maintainers. Needs-Author-Feedback Waiting for additional information or action from the issue or pull-request author. labels Sep 25, 2026
Elliot (theelliotm) added a commit that referenced this pull request Sep 28, 2026
Elliot (theelliotm) added a commit that referenced this pull request Sep 28, 2026
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.

NanVix blockedHosts overrides defaultPolicy=block

8 participants