Skip to content

tests: give the runtime adapter's executions their network's settings - #882

Merged
Pedro Henrique Penna (ppenna) merged 3 commits into
devfrom
esaurez/822-pr10-guest-network-settings-20261023
Oct 27, 2026
Merged

Pedro Henrique Penna (ppenna) merged 3 commits into
devfrom
esaurez/822-pr10-guest-network-settings-20261023

Conversation

@esaurez

@esaurez Enrique Saurez (esaurez) commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #866; this PR retargets when its parent merges.

Stack: #866 → #882 (this PR) → #883 → #876 → #871 → #873 → #874, on dev. #863, #864, #865, #867, #868, #869, #870, #872, #875, and #878 are merged.

Part of #822: PR 10 of 11, the guest's settings.

What changed

  • The root configuration gains an optional field, listeners (root::Listeners: published or unpublished), which says whether the sandbox's listeners are published. It is the 17th field, after workload-uid and workload-gid; no other field moves, and the version stays 1. Without it, the listeners are published, as nvx::guest::entry's default has them, which refuses the most to the executions.
  • The worker builds the sandbox of its executions through its one seam, worker::executions::Sandbox::new(identity, publication), with the publication that the configuration names; the hostname stays the entry's default. Executions, and the check of the account of the sandbox's workload identity, enter the root with that publication (worker::Entrance::publication). While the listeners are published, the entry refuses CAP_NET_BIND_SERVICE and CAP_NET_RAW at stage 0, with which a workload could forge the announcements of its listeners.
  • A layered launch names the publication of its network as OpenVMM publishes listeners: LayeredLaunch::with_network puts the network on the plan, with the listeners published when ingress or host-loopback access is allowed, and unpublished otherwise, or without a network.
  • The host gives each execution the URL of a proxy-only network's proxy (SandboxPlan::proxy_url) in the proxy variables of its environment, layered::PROXY_VARIABLES (http_proxy, https_proxy, HTTP_PROXY, and HTTPS_PROXY), after its own entries, with layered::with_proxy; a start that names any of them keeps its own proxy settings. The host program's exec reads the plan that the launch recorded, with LaunchRecord::read_plan. Before it attaches, exec checks that the framing still carries each start with the proxy's variables, and runs none of the executions if one no longer fits.
  • The network device, its addresses, and the announcer of the guest's listeners stay with NVX's /init.
  • The adapter's README and the module docs describe the field, the publication, and the proxy.

Tests

  • src/root.rs: the field's encoding, last, its decoding, and the configurations that the guest refuses for it.
  • tests/guest_session.rs, guest-only: an_execution_enters_the_root_with_the_publication_of_listeners_that_its_configuration_names, without the field, and with each publication: the refusals at stage 0 while listeners are published, the capabilities that the entry still allows, and the account check of a workload identity, which enters with the configuration's publication.
  • tests/layered_launch.rs, host-only: the publication that a launch names for each element of a policy; an_execution_finds_the_url_of_its_network_s_proxy_in_its_environment, for each scheme and with a start that names its own proxy; and the_record_of_a_launch_gives_back_its_plan.
  • tests/vm_layered.rs, on a real hypervisor: executions_take_the_settings_of_a_proxy_only_network, which on Linux also has exec refuse, before it attaches, a batch with a start that the framing carries alone but not with the proxy's URL, none of whose executions runs; and published_listeners_refuse_binding_and_raw_sockets.

Validation

At this head, on #866 at f9b8829a, with OpenVMM built at the pinned a12d9167. The previous head, 23eb4ef9, moved onto #866's new head unchanged: its git range-diff is all =.

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.

🟡 Changes recommended

Proxy injection can invalidate a later start after earlier executions have already been sent, so the augmented batch needs validation before submission.

1 open issue
What changed in this PR

This PR connects the runtime adapter’s execution settings to its sandbox network policy, advancing #822’s end-to-end sandbox support.

Changes:

  • Adds listener-publication configuration and passes it into guest capability checks.
  • Supplies proxy environment variables from the recorded launch plan while preserving caller overrides.
  • Adds configuration, host, guest, and VM coverage with updated documentation.
File Description
tests/​runtime-adapter/​tests/​vm_layered.rs Adds proxy and published-listener VM scenarios.
tests/​runtime-adapter/​tests/​layered_launch.rs Tests publication, proxy injection, and plan readback.
tests/​runtime-adapter/​tests/​guest_session.rs Tests publication-dependent capability admission.
tests/​runtime-adapter/​src/​worker/​executions.rs Carries sandbox publication into execution entry.
tests/​runtime-adapter/​src/​worker.rs Applies configured publication to entry and account checks.
tests/​runtime-adapter/​src/​root.rs Defines and validates the optional listeners field.
tests/​runtime-adapter/​src/​lib.rs Documents execution network settings.
tests/​runtime-adapter/​src/​layered.rs Derives publication, injects proxies, and reads recorded plans.
tests/​runtime-adapter/​src/​bin/​runtime-adapter-host.rs Integrates network settings into launch and execution commands.
tests/​runtime-adapter/​README.md Documents configuration, behavior, and test coverage.

Review effort: Balanced

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.

🔵 Needs a closer look

Network-dependent capability permissions warrant human review while backend CI, including KVM validation, remains pending.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@esaurez
Enrique Saurez (esaurez) force-pushed the esaurez/822-pr09-network-policy-plan-20261023 branch from da7de80 to b9f0083 Compare October 26, 2026 23:34
@esaurez
Enrique Saurez (esaurez) force-pushed the esaurez/822-pr10-guest-network-settings-20261023 branch from a7f7862 to 23eb4ef Compare October 27, 2026 00:00
@esaurez
Enrique Saurez (esaurez) requested a balanced review from Copilot October 27, 2026 00:00

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.

🔵 Needs a closer look

Coordinated changes to guest capability restrictions and host/guest execution framing warrant final human review despite no confirmed blocking defects.

No open issues 🎉

Review effort: Balanced

@esaurez
Enrique Saurez (esaurez) force-pushed the esaurez/822-pr09-network-policy-plan-20261023 branch from b9f0083 to f9b8829 Compare October 27, 2026 00:55
@esaurez
Enrique Saurez (esaurez) force-pushed the esaurez/822-pr10-guest-network-settings-20261023 branch from 23eb4ef to a7f43d2 Compare October 27, 2026 00:55
@esaurez
Enrique Saurez (esaurez) requested a balanced review from Copilot October 27, 2026 00: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.

🔵 Needs a closer look

Changes to guest capability enforcement and cross-platform network behavior warrant final human review and exact-head CI validation.

No open issues 🎉

Review effort: Balanced

Enrique Saurez and others added 3 commits October 26, 2026 19:14
The root configuration gains an optional listeners field, after the
workload identity, which says whether the guest's listeners are
published. Executions, and the account check of a workload identity,
enter the root with that publication, so that while listeners are
published the entry refuses CAP_NET_BIND_SERVICE and CAP_NET_RAW at
stage 0. A layered launch names the publication of its network as
OpenVMM publishes listeners: with ingress or host-loopback access
allowed, and none without a network.

The host gives an execution's start the URL of a proxy-only network's
proxy in the proxy variables of its environment, with
layered::with_proxy, from the plan that LaunchRecord::read_plan reads
back from the store. The network device, its addresses, and the
announcer of the guest's listeners stay with NVX's /init.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a7c15634-094a-4a66-af59-25a58e732f4b
The host program's exec reads the plan that the launch recorded, and
gives each execution the URL of the proxy of the VM's network, if any,
in its environment with layered::with_proxy, after its --env entries,
unless they name the proxy variables themselves.

The VM scenarios can now give their VM a network, which the launch reads
from a file that the scenario writes. In a proxy-only network, the
executions find the proxy's URL in their environment, and root may hold
CAP_NET_BIND_SERVICE and CAP_NET_RAW. A network with ingress allowed
publishes the guest's listeners, so the guest refuses both at stage 0.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a7c15634-094a-4a66-af59-25a58e732f4b
The proxy's variables lengthen an execution's start, so a start that the
framing carried when exec parsed its command line may no longer fit once
exec gives it the proxy of the VM's network. exec found out only as it
sent that start, after it had sent the starts before it, and then failed
without collecting their outcomes.

exec now gives every start the proxy's variables, and checks each as it
checked them without the proxy, before it attaches; it runs none of the
executions if one no longer fits. A start takes its key once exec has
attached, and a key's encoding has the same size whatever its value.

On Linux, whose command lines carry a start as long as the framing
allows, the proxy-only VM scenario checks that exec refuses such a batch
before it attaches, that none of its executions ran, and that the VM
still runs the next command's executions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a7c15634-094a-4a66-af59-25a58e732f4b
@ppenna
Pedro Henrique Penna (ppenna) force-pushed the esaurez/822-pr10-guest-network-settings-20261023 branch from a7f43d2 to 42ec8dd Compare October 27, 2026 02: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.

🔵 Needs a closer look

Network-dependent capability enforcement crosses the host–guest boundary and warrants human review with exact-head cross-platform CI, including KVM.

No open issues 🎉

Review effort: Balanced

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.

3 participants