Repository navigation
fix(autofill): align file path intent extra with BasePGPActivity - #195
Merged
Merged
Conversation
AutofillDecryptActivity declared its own private EXTRA_FILE_PATH constant
("app.passwordstore.autofill.oreo.EXTRA_FILE_PATH") while its base class
BasePGPActivity reads the file path from the "FILE_PATH" extra. The mismatch
was latent until requireDecryptionKeysExist() began resolving the gpg-id scope
from fullPath (a8bfc66), which made every autofill decrypt crash with
IllegalArgumentException: FILE_PATH is missing.
Drop the local constant and use BasePGPActivity.EXTRA_FILE_PATH at all three
call sites, matching the convention already used by every other component in
the codebase. The missing-extra path still degrades gracefully via the
existing logcat(ERROR) + finish() guard in onStart().
Add a Robolectric test pinning the intent extra key contract so the mismatch
cannot silently return.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Selecting a Password Store entry from the Android autofill UI in a browser (reproduced in Firefox)
crashed the app 100% of the time:
Root cause
AutofillDecryptActivitydeclared its own private constantand used it both to build its intents and to read the extra in
onStart(). Its base classBasePGPActivityhowever resolvesfullPathfrom a different key:where
BasePGPActivity.EXTRA_FILE_PATH == "FILE_PATH".The mismatch was latent until a8bfc66 ("fix: recover nested GPG scope during key selection")
made
requireDecryptionKeysExist()callresolveGpgIdScope(repoRoot, File(fullPath), subDir). Thatwas the first time
fullPathwas dereferenced on the autofill path, turning a silent inconsistencyinto a hard crash on every autofill decrypt.
Fix
Delete the local constant and use
BasePGPActivity.EXTRA_FILE_PATHat all three call sites(
onStart,makeDecryptFileIntent,makeDecryptFileIntentSender). This matches the conventionalready used by every other component that talks to a
BasePGPActivitysubclass —DecryptActivity,PassSecretsMapUnlockActivity,LaunchActivity,AutofillSaveActivity,PasswordStore,PasswordItem.AutofillDecryptActivitywas the sole outlier.This fixes the root cause rather than papering over it:
filePathand the basefullPathnow readthe same extra, so the gpg-id scope is resolved against the real entry path.
Why not the upstream approach
Upstream avoids the crash by giving
fullPatha fallback to the repository root:That silently resolves the gpg-id scope against the repo root instead of the actual entry, which
would pick the wrong key for entries in nested
.gpg-idscopes. Bridging the real path is correct.Safety / regression review
"app.passwordstore.autofill.oreo.EXTRA_FILE_PATH"appeared in exactly one file — noAndroidManifest.xmlentry, test, deep link, or keep rule depends on it.AutofillDecryptActivityisexported="false", and all three intent construction sites go throughits own companion factories (
AutofillFilterView,Api26AutofillResponseBuilder,Api30AutofillResponseBuilder). No external component can send this intent.BasePGPActivity.repoPath(EXTRA_REPO_PATH) is not dereferenced anywhere on theautofill decrypt path, so the crash does not merely move to the next missing extra.
logcat(ERROR)+finish()guard in
onStart()— no crash.makeDecryptFileIntentappliesputExtras(forwardedExtras)beforeputExtra(EXTRA_FILE_PATH, …),so a framework-supplied extra can never shadow the path.
Testing
AutofillDecryptActivityTest(Robolectric) assertingmakeDecryptFileIntentcarries thefile path under
BasePGPActivity.EXTRA_FILE_PATH. This fails against the old code.3A281JEHN02185), appapp.passwordstore.pando85v1.25.1: crash reproduced and captured from logcat before the fix.spotlessCheck,assembleDebug,test -PslimTests,lint.Changelog
Added an entry under
[Unreleased] → Fixed.