Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Passphrase caching forever loops and errors #2945

Open
apprehensions opened this issue Mar 10, 2024 · 4 comments
Open

[BUG] Passphrase caching forever loops and errors #2945

apprehensions opened this issue Mar 10, 2024 · 4 comments
Assignees
Labels
A-PGPainless Area: PGPainless-backed PGP C-bug Category: This is a bug E-medium Effort: This requires a fair amount of work P-high Priority: high, must be resolved before next major release
Milestone

Comments

@apprehensions
Copy link

Describe the bug

I am unable to decrypt any entry with passphrase caching.

Steps to reproduce

Steps to reproduce the behavior:

  1. Enable passphrase caching
  2. Try to open a password entry
  3. Observe as theres nothing given (empty screen, like it didn't get a password), and logcat is forever looped.

Expected behavior

I am able to get the password entry.

Screenshots

No response

Device information

  • Device: Google Pixel 7a
  • OS: Android 14
  • App version: 2.0.0-SNAPSHOT

Additional context

Logs
03-10 17:31:54.410 13012 13034 D TrafficStats: tagSocket(73) with statsTag=0xffffffff, statsUid=-1
03-10 17:31:54.843 13012 13034 D TrafficStats: tagSocket(73) with statsTag=0xffffffff, statsUid=-1
03-10 17:31:57.377 13012 13034 D TrafficStats: tagSocket(73) with statsTag=0xffffffff, statsUid=-1
03-10 17:31:59.278 13012 13084 D ProfileInstaller: Installing profile for app.passwordstore
03-10 17:32:13.159 13012 13021 W p.passwordstore: Cleared Reference was only reachable from finalizer (only reported once)
03-10 17:32:16.870 13012 13012 W RecyclerView: No adapter attached; skipping layout
03-10 17:32:18.770 13012 13012 W WindowOnBackDispatcher: OnBackInvokedCallback is not enabled for the application.
03-10 17:32:18.770 13012 13012 W WindowOnBackDispatcher: Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
03-10 17:32:18.770 13012 13012 D BiometricAuthenticator: onAuthenticationSucceeded()
03-10 17:32:19.169 13012 13073 D org.pgpainless.decryption_verification.OpenPgpMessageInputStream: Symmetrically Encrypted Data Packet at depth 0 encountered
03-10 17:32:19.169 13012 13073 D org.pgpainless.decryption_verification.OpenPgpMessageInputStream: Symmetrically Encrypted Integrity-Protected Data has 0 SKESK(s) and 1 PKESK(s) from which 0 PKESK(s) have an anonymous recipient
03-10 17:32:19.169 13012 13073 D org.pgpainless.decryption_verification.OpenPgpMessageInputStream: Encountered PKESK for recipient 6A0F611345E0E07D
03-10 17:32:19.208 13012 13073 D org.pgpainless.key.info.KeyRingInfo: (Sub?)-Key XXXXXXXXXXXXXXXXX is not encryption-capable.
03-10 17:32:19.208 13012 13073 D org.pgpainless.decryption_verification.OpenPgpMessageInputStream: Attempt decryption using secret key XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
03-10 17:32:19.210 13012 13012 E DecryptActivity: app.passwordstore.crypto.errors.UnknownError
03-10 17:32:19.210 13012 13012 E DecryptActivity: 	at app.passwordstore.data.crypto.CryptoRepository.access$decryptPgp(Unknown Source:561)
03-10 17:32:19.210 13012 13012 E DecryptActivity: 	at app.passwordstore.data.crypto.CryptoRepository$decrypt$2.invokeSuspend(Unknown Source:38)
03-10 17:32:19.210 13012 13012 E DecryptActivity: 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:8)
03-10 17:32:19.210 13012 13012 E DecryptActivity: 	at kotlinx.coroutines.DispatchedTask.run(Unknown Source:114)
03-10 17:32:19.210 13012 13012 E DecryptActivity: 	at com.google.android.gms.tasks.zzi.run(Unknown Source:76)
03-10 17:32:19.210 13012 13012 E DecryptActivity: 	at kotlinx.coroutines.scheduling.TaskImpl.run(Unknown Source:2)
03-10 17:32:19.210 13012 13012 E DecryptActivity: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(Unknown Source:95)
03-10 17:32:19.210 13012 13012 E DecryptActivity: Caused by: org.pgpainless.exception.WrongPassphraseException: Wrong passphrase provided for key 6a0f611345e0e07d
03-10 17:32:19.210 13012 13012 E DecryptActivity: 	at kotlin.UnsignedKt.unlockSecretKey(Unknown Source:1343)
03-10 17:32:19.210 13012 13012 E DecryptActivity: 	at org.pgpainless.decryption_verification.OpenPgpMessageInputStream.consumePackets(Unknown Source:1813)
03-10 17:32:19.210 13012 13012 E DecryptActivity: 	at org.pgpainless.decryption_verification.OpenPgpMessageInputStream.<init>(SourceFile:55)
03-10 17:32:19.210 13012 13012 E DecryptActivity: 	at io.sentry.metrics.MetricsApi.withOptions(Unknown Source:55)
03-10 17:32:19.210 13012 13012 E DecryptActivity: 	at app.passwordstore.data.crypto.CryptoRepository.access$decryptPgp(Unknown Source:421)
03-10 17:32:19.210 13012 13012 E DecryptActivity: 	... 6 more
03-10 17:32:19.210 13012 13012 E DecryptActivity: Caused by: org.bouncycastle.openpgp.PGPException: Exception decrypting key
03-10 17:32:19.210 13012 13012 E DecryptActivity: 	at org.bouncycastle.openpgp.PGPSecretKey.extractKeyData(Unknown Source:323)
03-10 17:32:19.210 13012 13012 E DecryptActivity: 	at org.bouncycastle.openpgp.PGPSecretKey.extractPrivateKey(Unknown Source:15)
03-10 17:32:19.210 13012 13012 E DecryptActivity: 	at kotlin.UnsignedKt.unlockSecretKey(Unknown Source:75)
03-10 17:32:19.210 13012 13012 E DecryptActivity: 	... 10 more
03-10 17:32:19.210 13012 13012 E DecryptActivity: Caused by: java.lang.NullPointerException: Attempt to read from field 'java.lang.Object org.eclipse.jgit.revwalk.RevWalk$2.val$lItr' on a null object reference in method 'byte[] org.bouncycastle.openpgp.PGPSecretKey.extractKeyData(org.eclipse.jgit.revwalk.RevWalk$2)'
03-10 17:32:19.210 13012 13012 E DecryptActivity: 	at org.bouncycastle.openpgp.PGPSecretKey.extractKeyData(Unknown Source:25)
03-10 17:32:19.210 13012 13012 E DecryptActivity: 	... 12 more
03-10 17:32:19.467 13012 13073 D org.pgpainless.decryption_verification.OpenPgpMessageInputStream: Symmetrically Encrypted Data Packet at depth 0 encountered
03-10 17:32:19.468 13012 13073 D org.pgpainless.decryption_verification.OpenPgpMessageInputStream: Symmetrically Encrypted Integrity-Protected Data has 0 SKESK(s) and 1 PKESK(s) from which 0 PKESK(s) have an anonymous recipient
03-10 17:32:19.469 13012 13073 D org.pgpainless.decryption_verification.OpenPgpMessageInputStream: Encountered PKESK for recipient 6A0F611345E0E07D
03-10 17:32:19.545 13012 13073 D org.pgpainless.key.info.KeyRingInfo: (Sub?)-Key XXXXXXXXXXXXXXXXX is not encryption-capable.
03-10 17:32:19.546 13012 13073 D org.pgpainless.decryption_verification.OpenPgpMessageInputStream: Attempt decryption using secret key XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
.. And it loops forever, attempting to decrypt
@apprehensions apprehensions added C-bug Category: This is a bug S-awaiting-triage Status: New issues that have not been assessed yet labels Mar 10, 2024
@apprehensions
Copy link
Author

Re-importing the key does not change anything.

@apprehensions
Copy link
Author

The issue at hand here is the passphrase is not being re-prompted when there is no cached passphrase. That is why it fails.

Please check if the cached passphrase is valid and cache it, in this case it doesn't seem to work. Uninstalling completely fixed the problem for me.

@msfjarvis
Copy link
Member

I've also noticed the issue today where the passphrase cache wasn't working but the logic to re-prompt for the password worked as expected. I'll investigate both issues in a while.

@msfjarvis msfjarvis self-assigned this Mar 10, 2024
@msfjarvis msfjarvis added E-medium Effort: This requires a fair amount of work P-high Priority: high, must be resolved before next major release A-PGPainless Area: PGPainless-backed PGP S-in-progress Status: Implementation is underway and removed S-awaiting-triage Status: New issues that have not been assessed yet labels Mar 10, 2024
@msfjarvis msfjarvis added this to the v2.0.0 milestone Mar 10, 2024
@msfjarvis
Copy link
Member

I was temporarily able to reproduce this while working on a minor overhaul of the passphrase caching code, unfortunately I can't do so anymore. I'll continue looking later and see if I can get a consistent reproduction.

In the mean time the latest snapshot should allow you to purge your passphrase cache by disabling and re-enabling it from settings, so if the problem is a poisoned cache entry that should resolve it.

@msfjarvis msfjarvis removed the S-in-progress Status: Implementation is underway label May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-PGPainless Area: PGPainless-backed PGP C-bug Category: This is a bug E-medium Effort: This requires a fair amount of work P-high Priority: high, must be resolved before next major release
Projects
Status: 📋 Being triaged
Development

No branches or pull requests

2 participants