mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 16:45:07 +00:00
Harden test mode against auth and uninstall side effects
This commit is contained in:
@@ -108,6 +108,11 @@ request_sudo_access() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Tests must never trigger real password or Touch ID prompts.
|
||||
if [[ "${MOLE_TEST_MODE:-0}" == "1" || "${MOLE_TEST_NO_AUTH:-0}" == "1" ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Detect if running in TTY environment
|
||||
local tty_path="/dev/tty"
|
||||
local is_gui_mode=false
|
||||
@@ -299,6 +304,11 @@ ensure_sudo_session() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ "${MOLE_TEST_MODE:-0}" == "1" || "${MOLE_TEST_NO_AUTH:-0}" == "1" ]]; then
|
||||
MOLE_SUDO_ESTABLISHED="false"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Stop old keepalive if exists
|
||||
if [[ -n "$MOLE_SUDO_KEEPALIVE_PID" ]]; then
|
||||
_stop_sudo_keepalive "$MOLE_SUDO_KEEPALIVE_PID"
|
||||
|
||||
Reference in New Issue
Block a user