Mole icon indicating copy to clipboard operation
Mole copied to clipboard

[BUG] Wrong output when elevating within mole instead.

Open weq opened this issue 8 months ago • 4 comments

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

  1. mole
  2. Select step 1
  3. 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.

Image

weq avatar Mar 19 '26 08:03 weq

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:

  1. Use sudo -p to set a custom prompt that includes a placeholder
  2. Or detect PAM configuration and show appropriate prompt
  3. Or use a more generic prompt like "Authentication:" instead of "Password:"

This requires design discussion with maintainers.

JasonOA888 avatar Mar 20 '26 04:03 JasonOA888

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!

yetval avatar Mar 20 '26 14:03 yetval

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.

JasonOA888 avatar Mar 20 '26 14:03 JasonOA888

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!

yetval avatar Mar 20 '26 14:03 yetval