[BUG] Wrong output when elevating within mole instead.
Describe the bug
If you use a different manner of utilizing sudo instead of just password, like a yubikey with PIN etc. The "Password:" dialog is just "wrong" output from mole. Fixing this just would just remove misconception. Entering the PIN works when it asks for the "Password:".
Steps to reproduce
mole- Select step 1
- Asks for sudo password.
Expected behavior
Send output from sudo directly back instead of statically showing password:
Additional context
Here you can see how it is on my machine.
Thanks for the report. The issue is in lib/core/sudo.sh:
printf "${PURPLE}${ICON_ARROW}${NC} Password: " > "$tty_path"
This hardcodes "Password:" instead of detecting the actual PAM prompt.
Challenge: The current implementation captures password input directly via read, bypassing sudo's own prompt. This is intentional to control the UI, but it means we lose the actual PAM prompt text.
Potential fix:
- Use
sudo -pto set a custom prompt that includes a placeholder - Or detect PAM configuration and show appropriate prompt
- Or use a more generic prompt like "Authentication:" instead of "Password:"
This requires design discussion with maintainers.
Hey, I've already opened a PR (#599) that addresses this by passing through sudo's native prompt directly instead of hardcoding 'Password:'. Feel free to check it out!
Thanks for the PR! That's a much better approach than my suggestion - passing through sudo's native prompt is cleaner than trying to detect PAM configuration. I'll check out #599.
Thanks! Yeah, letting sudo handle it natively keeps things simple and works for any auth method out of the box. If you have any feedback on the PR, let me know!