From 6623b00b2af2beee93d312ad89d998b5bf1aad18 Mon Sep 17 00:00:00 2001 From: ruihan Date: Fri, 30 Oct 2026 11:37:50 -0300 Subject: [PATCH] fix(dualboot): keep account passwords out of diagnostics --- tests/test_dualboot_logging.bats | 38 ++++++++++++++++++++++++++++++++ unleash | 2 +- unleash-standalone.sh | 2 +- 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 tests/test_dualboot_logging.bats diff --git a/tests/test_dualboot_logging.bats b/tests/test_dualboot_logging.bats new file mode 100644 index 0000000..4454e39 --- /dev/null +++ b/tests/test_dualboot_logging.bats @@ -0,0 +1,38 @@ +#!/usr/bin/env bats + +@test "dualboot keeps passwords out of diagnostics while preserving network preferences" { + local entrypoint + for entrypoint in unleash unleash-standalone.sh; do + local script="$BATS_TEST_DIRNAME/../$entrypoint" + local definitions="$BATS_TEST_TMPDIR/$entrypoint.functions" + local target="$BATS_TEST_TMPDIR/$entrypoint Data" log="$BATS_TEST_TMPDIR/$entrypoint.log" + mkdir -p "$target/private/etc" "$target/private/var/db" "$target/Library/Preferences/SystemConfiguration" + printf 'original network preferences\n' > "$target/Library/Preferences/SystemConfiguration/preferences.plist" + printf 'original Wi-Fi networks\n' > "$target/Library/Preferences/com.apple.wifi.known-networks.plist" + cp -R "$target/Library" "$BATS_TEST_TMPDIR/$entrypoint.before" + sed '/^main "\$@"$/d' "$script" > "$definitions" + run "${UNLEASH_TEST_SHELL:-bash}" -u -c ' + source "$1" + target="$2" logfile="$3" + fixture_password="fixture-password-not-for-a-real-account" + load_config() { :; } + is_root() { return 0; } + resolve_target_volumes() { printf "%s|%s\n" "$target-system" "$target"; } + prompt_default() { printf -v "$1" "%s" "Fixture User"; } + prompt_username() { printf -v "$1" "%s" fixture; } + prompt_password() { printf -v "$1" "%s" "$fixture_password"; } + find_available_uid() { echo 501; } + create_admin_user() { [ "$5" = "$fixture_password" ]; } + main --log-file "$logfile" dualboot + ' "$script" "$definitions" "$target" "$log" + [ "$status" -eq 0 ] + [[ "$output" == *"Boot the target and login"* ]] + [[ "$output" != *"fixture-password-not-for-a-real-account"* ]] + [ -s "$log" ] + run grep -F 'fixture-password-not-for-a-real-account' "$log" + [ "$status" -eq 1 ] + [ -f "$target/private/var/db/.AppleSetupDone" ] + grep -q '0.0.0.0 deviceenrollment.apple.com' "$target/private/etc/hosts" + diff -r "$BATS_TEST_TMPDIR/$entrypoint.before" "$target/Library" + done +} diff --git a/unleash b/unleash index 9c3e9d4..c4f126d 100755 --- a/unleash +++ b/unleash @@ -282,7 +282,7 @@ cmd_dualboot() { end_ok info "User: $username" - info "Pass: $passw" + info "Log in with the password entered above." info "Boot the target and login." } diff --git a/unleash-standalone.sh b/unleash-standalone.sh index 1c40249..fcd94d9 100755 --- a/unleash-standalone.sh +++ b/unleash-standalone.sh @@ -3094,7 +3094,7 @@ cmd_dualboot() { end_ok info "User: $username" - info "Pass: $passw" + info "Log in with the password entered above." info "Boot the target and login." }