Skip credential preflight in manual-full mode

This commit is contained in:
2026-05-27 08:33:56 +03:00
parent b8ddf8f22d
commit 747ed623ab
4 changed files with 50 additions and 6 deletions

View File

@@ -298,6 +298,43 @@ exit 0
SH
chmod +x "$fake_oc_bin"
fake_missing_keychain_bin="$TMP_DIR/fake-missing-keychain-bin"
mkdir -p "$fake_missing_keychain_bin"
cat > "$fake_missing_keychain_bin/security" <<'SH'
#!/bin/sh
exit 1
SH
chmod +x "$fake_missing_keychain_bin/security"
manual_full_no_credentials_home="$TMP_DIR/manual-full-no-credentials-home"
manual_full_no_credentials_capture="$TMP_DIR/manual-full-no-credentials-capture"
mkdir -p "$manual_full_no_credentials_home"
manual_full_no_credentials_output="$(
HOME="$manual_full_no_credentials_home" \
PATH="$fake_missing_keychain_bin:$PATH" \
LEMANA_VPN_CONFIG_DIR="$manual_full_no_credentials_home/.config/lemana-vpn" \
OPENCONNECT_LITE_CONFIG_DIR="$manual_full_no_credentials_home/.config/openconnect-lite" \
LEMANA_VPN_CREDENTIAL_SOURCE=keychain \
LEMANA_VPN_OC_BIN="$fake_oc_bin" \
LEMANA_VPN_OC_PYTHON=python3 \
LEMANA_VPN_WEBENGINE_PROCESS="$fake_webengine" \
LEMANA_VPN_AUTHENTICATOR="$fake_authenticator" \
LEMANA_VPN_PATCH_BACKUP_DIR="$TMP_DIR/manual-full-no-credentials-patch-backups" \
LEMANA_VPN_DNS_CLEANUP="$TMP_DIR/no-dns-cleanup" \
LEMANA_VPN_CONNECT_LOG="$TMP_DIR/manual-full-no-credentials.log" \
LEMANA_VPN_CAPTURE_LAUNCH="$manual_full_no_credentials_capture" \
bash "$ROOT/bin/vpn-lemanapro.sh" --manual-full --json
)"
printf '%s\n' "$manual_full_no_credentials_output" | grep -q '"event":"manual_sso","autofill":false,"submit":false'
if printf '%s\n' "$manual_full_no_credentials_output" | grep -Eq '"event":"(username_required|keychain_required)"'; then
echo "manual-full should not require saved username or Keychain credentials before opening the browser" >&2
exit 1
fi
grep -q -- '--browser-display-mode shown' "$manual_full_no_credentials_capture"
grep -q '^autofill_disable=1$' "$manual_full_no_credentials_capture"
grep -q '^autofill_click=0$' "$manual_full_no_credentials_capture"
if command -v expect >/dev/null 2>&1; then
first_username_home="$TMP_DIR/first-username-home"
mkdir -p "$first_username_home/.config/lemana-vpn" "$first_username_home/.config/openconnect-lite"
@@ -329,7 +366,7 @@ spawn env \
LEMANA_VPN_DNS_CLEANUP=$env(TMP_DIR)/no-dns-cleanup \
LEMANA_VPN_CONNECT_LOG=$env(TMP_DIR)/first-username.log \
LEMANA_VPN_CAPTURE_LAUNCH=$env(MANUAL_FULL_CAPTURE) \
bash $env(ROOT)/bin/vpn-lemanapro.sh --manual-full --json
bash $env(ROOT)/bin/vpn-lemanapro.sh --manual --json
expect "Corporate LDAP username:"
send "lemana-first-user\r"
expect eof