Repository navigation
host: give each VM a private directory with fixed names - #1280
Pedro Henrique Penna (ppenna) merged 1 commit into
Conversation
This pull request changes existing testsIt modifies or removes 2 existing test asset(s), listed below. Review each with care: a change to a test can hide a regression that the test caught. See doc/contribute.md#changes-to-existing-tests. Test code
Test policy
Relocated unchanged: 0; added: 30. Compared the merge base |
There was a problem hiding this comment.
🟡 Changes recommended
A critical symlink-refusal bypass in VM directory opening and creation accepts paths ending in / or /., allowing retained paths to be redirected later.
1 open issue
What changed in this PR
Implements SL2.7 of the host API slimming workstream: caller-owned private VM directories, fixed output names, and a redacted capability type. Launching processes and persisting credentials remain outside this slice.
Changes:
- Adds
host::vmdirectory, output, and capability types. - Reuses Linux privacy checks and adds a stricter, VM-specific Windows access policy.
- Adds platform tests, documents reserved names, and updates both public API inventories.
| File | Description |
|---|---|
scripts/test-layout-allowlist.json |
Allows seven temporary dead-code expectations for later callers. |
nvx-rs/src/host/vm/tests.rs |
Tests directory privacy, output names, and capability redaction. |
nvx-rs/src/host/vm.rs |
Defines VM directories, fixed outputs, and capabilities. |
nvx-rs/src/host/platform/windows/tests.rs |
Re-exports security inspection helpers for tests. |
nvx-rs/src/host/platform/windows/private/tests.rs |
Adds security inspection helpers and VM access-policy cases. |
nvx-rs/src/host/platform/windows/private.rs |
Adds owner-only, protected VM directory validation. |
nvx-rs/src/host/platform/windows/mod.rs |
Exposes VM directory helpers internally. |
nvx-rs/src/host/platform/tests.rs |
Makes Windows inspection helpers available to host tests. |
nvx-rs/src/host/mod.rs |
Exports and documents host::vm. |
nvx-rs/README.md |
Documents directory privacy, reserved names, and credentials. |
nvx-rs/public-api/windows.txt |
Records the 12 new VM API entries on Windows. |
nvx-rs/public-api/linux.txt |
Records the 12 new VM API entries on Linux. |
Review effort: Balanced
|
Scope update following the revised #1076/#1099 contract: SL2.7 needs the public-API foundation, not retired error-type PR #1267. The base is being updated to Preserve fixed names, capability redaction, owner-only permissions and the required trailing-slash/dot symlink correction. The existing symlink finding is not waived by this API change. Earlier validation remains evidence for its recorded head; revised code/inputs need affected checks and reviews before readiness. No Ready transition or manual CI dispatch is included. |
f91df78 to
935ec70
Compare
Add caller-owned VM directories, fixed output names and redacted control capabilities without creating launch outputs or persisting credentials. Require current-user ownership and mode 0700 on Linux, or a protected owner-only DACL on Windows, without changing existing directories. Use the crate's Result and report a non-private directory as ErrorKind::Io. Normalize trailing separators and dot components before no-follow checks so a final symbolic link is refused, while preserving parent components. Keep the existing store privacy policies unchanged. Compare Windows ACL snapshots using the same canonical SDDL SID spellings as the descriptor serializer, including well-known aliases. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d334d041-d2f2-47db-be92-5564ff14f2d7
935ec70 to
b93206a
Compare
aaa6bfd
into
feature/nvx-refactor

Part of #1099.
Implements SL2.7 only: a caller-owned private VM directory, fixed output
names, and a redacted control capability. Launch preparation, output creation,
spawning, restore listeners and credential persistence remain outside this PR.
Changes
host::vm::{VmDir, VmOutputs, Capability, create_private_dir}in theexisting
nvxcrate. The fallible directory functions return the crate'sResult;a non-private directory is
ErrorKind::Io, and native I/O failures retaintheir cause.
preserves the caller's umask and never repairs an unsafe existing directory.
protected DACL containing only allow entries for that user. At least one
entry must grant full access through bitwise
FILE_ALL_ACCESScontainmentor
GENERIC_ALL, with OI and CI and without IO or NP.no-follow checks, without resolving symlinks or parent components. This
refuses a final symbolic link even when its path ends in
/or/..and capture names. The snapshot directory is
openvmm/; the separatetemporary-file prefix is
.openvmm.//./pipe/openvmm-microvm-<32 lowercase hex>names; restore-ready uses//./pipe/nvx-restore-ready-<32 lowercase hex>.Capability::as_bytes()borrows the protocol-sized bytes. Both Debug formsredact them, and these APIs write no credential file or launch output.
The existing broader store, template, snapshot, log-job and pipe policies are
unchanged. The PR's own diff changes no package, workspace, manifest, lockfile,
version, protocol or OpenVMM pin. The seven temporary dead-code expectations
name their later callers; no later lifecycle step is implemented to suppress a lint.
Both public API inventories add exactly 12 VM entries and remove none.
The rebase onto
feature/nvx-refactoratef703702retains both the existingruntime documentation and the VM documentation.
Windows CI repair
The Windows all-features job in run
42160212636
failed two VM-directory assertions. The test helper returned expanded SID
strings, while the security-descriptor serializer uses canonical SDDL aliases
such as
LA. Equivalent ownership was therefore compared using differentspellings, including in the inherited-directory error classification.
Correct only
user_sid()in the owning test module to serialize the ownerthrough the same SDDL API and revision as the ACL snapshot. Add
security_identifier_spelling_matches_the_descriptor_snapshotwith thedeterministic SYSTEM and LocalService aliases (
SYandLS). The regressionfailed before the fix and passes afterward. Production SID comparisons, all
privacy checks, and both original assertions remain unchanged.
Existing tests and size
check_test_changesagainst the recorded baseef703702reports two changesto existing tests, zero relocations and 30 added entries, which include helpers:
private_directories_support_long_pathsscripts/test-layout-allowlist.jsonhost/vm.rs; existing entries are unchanged.renames_support_long_paths_without_replacing_existing_files,invalid_paths_do_not_create_or_rename_their_prefixthe_store_is_private_to_the_current_user,stores_belong_to_the_current_user_with_mode_700,stores_open_only_existing_directories,directories_that_others_may_access_are_refusedprivate_directories_belong_to_the_current_user_and_grant_others_nothing,snapshots_that_openvmm_published_are_private_without_entries_for_their_fileslinks_and_unsafe_ownership_are_refused_before_the_vm_starts,stores_too_deep_for_the_control_socket_of_a_capture_are_refusedvmms_start_with_the_callers_umask_without_the_owners_bits,one_shot_vmms_start_with_the_callers_umask_without_the_owners_bits,spawns_fail_with_the_error_of_a_refused_umaska_vm_directory_is_created_owner_only_and_protected_under_a_permissive_parent,existing_vm_directories_that_grant_others_or_inherit_are_refused_and_left_unchangedNo existing executable test was removed, moved or weakened. The new tests cover
privacy and unchanged unsafe directories, native errors, every fixed and reserved
name, fresh Windows pipe names, capability redaction and no file writes. The
Linux symlink regression covers
/,/.,/./and//.//on both functions,including unchanged links and targets. There are 14 new test definitions:
10 run on Linux and 10 on Windows. The tests and their helpers remain out of
line. The
tests-modifiedlabel is retained.Measured against
ef703702: 244 tool-counted core lines in five countedfiles: 242 production lines in four files, plus two JSON policy lines.
This remains below the issue's 520-line stop; the CI repair adds test code only.
Validation
All current results below cover clean source head
b93206aband tree6b8ce93719f5f781923db77f1d752a5d6c9c426b, including the SID-helper repair.Historical results for
935ec708and the intermediate uncommitted repairare not counted as current-head passes.
check-nvx-rsactionNVX_BUNDLEgenuinely unset: 18 tests on Windows and 19 on Linux.check-qualityactionThe four public scenarios are
managed-exec-config,sandbox-lifecycle,sandbox-proxy-onlyandsandbox-ram-upper. The adapter runs the exact prebuilttests named by its committed scenario inventory, with the original naming and
per-test outcome checks. Source cleanliness, executable hashes and runtime
provenance are verified before and after each VM set.
Both host CLIs and the adapter programs are built from the current sources.
Native OpenVMM
14dc4116and kernel 6.18.38 are authenticated, hash-verifiedinputs from
v0.1.0-dev.cbfe738d4ca8; they are not relabeled as new builds.The Alpine and Ubuntu initramfses and Ubuntu EROFS fixture are assembled from
this checkout with its validated static guest binaries, then rehashed and
validated on both platforms. No release's
nvx-rsor guest image is substituted.This is the selected host-API regression set, not the later group-final full
distribution matrix. KVM remains for CI. The existing Draft state and
feature/nvx-refactordestination are preserved; no manual CI run, readinesstransition or merge is requested.