android-password-store/Android-Password-Store

[BUG] Passphrase prompt should not be shown for keys that have none

durka opened this issue ยท 5 comments

durka commented

Describe the bug

When I go to decrypt a password, Password Store asks me for a password. It's not clear, but I'm assuming it wants the passphrase for my PGP key, but there isn't one.

I can enter anything, or nothing, and click OK and it still decrypts the password.

Steps to reproduce

Steps to reproduce the behavior:

  1. Import a key with no passphrase
  2. Select a password from the store
  3. Enter something in the password prompt, or don't
  4. Click OK

Expected behavior

Just decrypt the password.

Screenshots

No response

Device information

  • Device: Pixel 7
  • OS: Android 14
  • App version: 2.0.0-SNAPSHOT (broken biometric authentication workaround)

Additional context

No response

The underlying PGP library accepts the passphrase as part of a separate SecretKeyProtector object which I assume just completely gets ignored when the key doesn't have any passphrase. I'll have to check if there's a way for us to detect the same from outside without having to resolve to attempt decryption twice.

I've pushed a change that inspects the encrypted message and skips asking for a passphrase if it's not needed, please test out the new snapshot build once it's available and let me know how it goes.

durka commented

It's not quite working. It avoids asking me for a passphrase and reaches the password display screen, but the password is never displayed.

Note: if I enable the "passphrase cache", then it successfully decrypts and displays the password. This is a perfectly fine state of affairs for me personally, because it means even with the biometric auth disabled due to #2802, then there is still a biometric layer before the password comes up.

Attached is a logcat from trying to decrypt a password with the passphrase cache disabled:
aps-logcat.txt

Thanks for checking it out, I'll give it another go sometime today.

Finally managed to find enough time and motivation to take another look at this, once #3069 is merged this should be resolved.