From 14cb3570c158664f91bbc14b1ed7ea6507b766e7 Mon Sep 17 00:00:00 2001 From: cabbage Date: Tue, 27 Oct 2026 06:03:02 +0000 Subject: [PATCH] fix(test): prevent fixture password expiry after baseline restore --- docs/testing-vm.md | 8 ++++++++ scripts/windows/test-host | 14 ++++++++++++++ test/windowsnative/native_fixture_test.go | 10 ++++++++++ 3 files changed, 32 insertions(+) diff --git a/docs/testing-vm.md b/docs/testing-vm.md index 1769a05..4aeb9a0 100644 --- a/docs/testing-vm.md +++ b/docs/testing-vm.md @@ -41,6 +41,14 @@ reads the same value for both accounts from: /home/cabbage/.local/share/rvbox-secrets/rvbox-win10-test.password ``` +After every baseline restore, `test-host prepare` uses the fixture Administrator +to mark these two accounts' passwords as non-expiring before normal-user +Guest Control checks. Restoring a snapshot retains its old password-set date; +the original `rvboxtest` password expired on 2026-10-18 even though the VM was +clean. This per-run repair preserves the fixed password, account enablement, +other users, and machine-wide password policy. It does not log Administrator +into an interactive session or modify any retained snapshot. + The file must be mode `0600` and is supplied to VirtualBox only with `--passwordfile`; the controller never places it on a command line, run manifest, log, or artifact. The SSH key and the Helium host account credential diff --git a/scripts/windows/test-host b/scripts/windows/test-host index e398c31..2d3ac13 100755 --- a/scripts/windows/test-host +++ b/scripts/windows/test-host @@ -351,6 +351,18 @@ configure_display_keepalive() { fail "fixture provisioner could not disable disposable display/sleep timers" } +configure_fixture_password_expiry() { + # Snapshot restore preserves PasswordLastSet, not the wall clock. The + # fixed test credential can therefore expire long after a clean capture. + # Keep both recorded fixture accounts reusable without changing passwords, + # enabling accounts, or weakening the machine-wide password policy. + account_check=$(printf '$ErrorActionPreference="Stop"; $ProgressPreference="SilentlyContinue"; foreach ($name in @("%s","%s")) { Set-LocalUser -Name $name -PasswordNeverExpires $true; if ((Get-LocalUser -Name $name).PasswordExpires) { throw "Fixture password still expires" } }; Write-Output RVBOX_GUEST_OK' "$guest_user" "$provisioner_user") + account_encoded=$(printf '%s' "$account_check" | iconv -f UTF-8 -t UTF-16LE | base64 -w 0) + provisioner_run --exe 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' --wait-stdout --wait-stderr --unquoted-args -- \ + -NoProfile -NonInteractive -EncodedCommand "$account_encoded" >/dev/null || \ + fail "fixture provisioner could not disable fixture-account password expiration" +} + assert_mouse_bypassed() { # Read-only guard for the canonical USB-tablet baseline. An additions # reinstall may re-register VBoxMouse; fail visibly instead of silently @@ -420,6 +432,8 @@ case "$action" in step prepare-guest-additions-ready configure_display_keepalive step prepare-display-keepalive + configure_fixture_password_expiry + step prepare-fixture-password-expiry assert_clean_guest # Retained pre-workaround snapshots fail this guard until explicitly # repaired; never report a prepared fixture with the bad path revived. diff --git a/test/windowsnative/native_fixture_test.go b/test/windowsnative/native_fixture_test.go index 8935dd3..b06f2ae 100644 --- a/test/windowsnative/native_fixture_test.go +++ b/test/windowsnative/native_fixture_test.go @@ -45,6 +45,16 @@ func TestNativeFixtureAssets_HP_HARNESS_20(t *testing.T) { } } testHost := read("scripts/windows/test-host") + for _, required := range []string{"configure_fixture_password_expiry", "Set-LocalUser -Name $name -PasswordNeverExpires $true", "prepare-fixture-password-expiry", "Fixture password still expires"} { + if !strings.Contains(testHost, required) { + t.Fatalf("native test-host is missing fixed fixture credential contract %q", required) + } + } + expiryStep := strings.Index(testHost, " step prepare-fixture-password-expiry") + cleanStep := strings.Index(testHost, " assert_clean_guest\n") + if expiryStep < 0 || cleanStep < expiryStep { + t.Fatal("fixture password expiration must be disabled before normal-user cleanliness checks") + } for _, required := range []string{"xz -T0 -3", "accelerated_stage", "copy_stage_file", "--proxy", "--anyauth", "--continue-at", "rvbox.exe.xz", "retry_limit=4", "ConnectTimeout=10", "bundle transfer did not reach the expected SHA-256 manifest", "verified transfer_sha256", "reset-force-poweroff", "$run_root/.accelerated-stage.XXXXXX", "service-startup.log", "test-logs/rvbox.log"} { if !strings.Contains(testHost, required) { t.Fatalf("native test-host is missing compressed transfer contract %q", required)