fix(test): prevent fixture password expiry after baseline restore

This commit is contained in:
cabbage committed 2026-10-27 06:03:02 +00:00
1 parent 34274f0f62
commit 14cb3570c1
3 files changed
+32

No files matched your search

+14
View File
@@ -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.