PhilippC / keepass2android

Password manager app for Android
https://play.google.com/store/apps/details?id=keepass2android.keepass2android
GNU General Public License v3.0
4.82k stars 390 forks source link

Auto-fill pop-up does not show or only flashes on firefox #1808

Closed pelzvieh closed 3 years ago

pelzvieh commented 3 years ago

When viewing login forms of websites in Firefox, usually no auto-fill pop-up is showing. Repeated tapping into the username and password fields triggers the pop-up, but it immediately vanishes again. I believe it is vanishing in case of any redraw happening after the change of input focus - which is usually the case (slight scrolling, website showing a required field warning, etc.). The flashing pop-up itself seems to work fine, i.e. contains matching entries, and if you manage to tap the correct entry in the fraction of a second it is showing, it even fills out the fields.

PhilippC commented 3 years ago

I didn't find what I could do differently to avoid this behavior. For me it usually helps to tap the password field. I know this is not satisfactory, but maybe you can post this on the Firefox tracker also because it only happens with Firefox, but not Opera Mini or Firefox Klar/Focus.

BobVul commented 3 years ago

Recent investigation on the Firefox side (with a huge thanks to Makoto Kato): https://bugzilla.mozilla.org/show_bug.cgi?id=1715549

See especially comment 6: https://bugzilla.mozilla.org/show_bug.cgi?id=1715549#c6

Looks like a temporary workaround is to set accessibility.force_disabled=1 on Firefox (only on non-release versions). I have tried this, and it makes the keepass2android pop-up perfectly stable, which suggests that this is the same problem.

Looks like their suggestion as a long-term fix for Bitwarden is:

I think that BitWarden should disable compatibility mode since we already support autofill framework. I will send PR to disable it with longVersionCode. Firefox Nightly seems not to use compatibility mode.

Would it be possible to implement something similar in keepass2android to better support Firefox? It looks to be just a change in the autofill-service configuration.

guerda commented 3 years ago

Hey @BobVul ! Great stuff, thanks for posting and summarizing this. Can I ask you to explain how to set the flag in Fx Mobile beta? As far as I know there's no about:config on mobile. Thanks

guerda commented 3 years ago

Nevermind, it seems that about:config does exist in beta, but not in the release.

Setting this flag does work for me, too! Thanks again, Bob.

BobVul commented 3 years ago

Please thank makototako instead, I merely paraphrased their words/work from their comments on bugzilla to bring it to the attention of Philipp here...

makotokato commented 3 years ago

How to fix this on keepass2android, see https://github.com/bitwarden/mobile/pull/1592 since keepass2android still uses compatibility mode even if Firefox has native autofill support. I cannot understand why keepass2android turns on this mode even if newer Fenix.

guerda commented 3 years ago

Thanks for the hint, would this be this line to be changed?

https://github.com/PhilippC/keepass2android/blob/4a5a77de21d408df514021f19a9982e2d9bbd534/src/keepass2android/Resources/xml/autofillservice.xml#L44

I don't know what to change here, so I cannot create a PR, do you know how?

makotokato commented 3 years ago

Thanks for the hint, would this be this line to be changed?

https://github.com/PhilippC/keepass2android/blob/4a5a77de21d408df514021f19a9982e2d9bbd534/src/keepass2android/Resources/xml/autofillservice.xml#L44

Yes, firefox and firefox_beta.

I don't know what to change here, so I cannot create a PR, do you know how?

Simple fix is that you remove compatibility-package elements for org.mozilla.firefox and org.mozilla.firefox_beta since newer Fenix has native autofill support. But if removing entries, since old Firefox (until 62) doesn't have it, if user uses old version such as Firefrox 60, autofill won't work. My PR of Bitwarden modifies maxLongVersionCode for old version of Firefox and beta, so autofill service doesn't use compatibility mode If Firefox is the latest version.

guerda commented 3 years ago

Thanks, sounds straightforward. How did you decide in the version which was used for maxVersionCode?

makotokato commented 3 years ago

Thanks, sounds straightforward. How did you decide in the version which was used for maxVersionCode?

That version code is N-1 version (Firefox 93.2.0 and Firefox 94 beta3) since I don't want to check/debug old version for autofill implementation.

tinsukE commented 3 years ago

@PhilippC thanks a ton for pushing a fix! When could we expect it to hit Play Store builds?

PhilippC commented 2 years ago

sorry that this took a bit, it's now available in 1.09b-pre0 in the beta channel: https://play.google.com/apps/testing/keepass2android.keepass2android

psydvl commented 2 years ago

Still have issue on 1.09b-pre1 And Firefox Beta 95.0.0-beta.3

tinsukE commented 2 years ago

I haven't had the issue on 1.09b-pre1 and Firefox 94.1.2. That being said, now the suggestion to use KeePass comes from my SwiftKey keyboard, but when coming back from authenticating in KeePass, the pop-up to use the credential has never failed to appear or disappeared on its own.

Taknok commented 2 years ago

@tinsukE if suggestion is set by your keyboard, this only means that anysoft keyboard has implemented this new api: https://developer.android.com/guide/topics/text/ime-autofill

If @psydvl does not use a keyboard with this feature (or older android version), the autofill will not be triggered by the keyboard and maybe the issue is still present for "traditional" popup on firefox. Could you upload a video/gif of the behavior ?

pelzvieh commented 2 years ago

Ah, works very different, but works like a charm! Thanks for implementing this!