Page MenuHomePhabricator

Allow iOS/macOS/iPadOS to autofill 2fa codes
Open, Needs TriagePublicFeature

Description

the upcoming versions of iPadOS/iOS and macOS include a builtin 2fa client. Using the beta software I've tested the functionality, and have found that when Phabricator or Matomo request a 2fa code, safari automatically suggests autofilling a 2fa code. With OATHAuth however, this does not happen. Comparing how the input fields are defined, the only consistent difference I can find is that autofocus is set differently.

// mediawiki
<input id="wpOATHToken" name="OATHToken" size="20" dir="ltr" spellcheck="false" tabindex="1" required="" autofocus="" autocomplete="off" class="mw-ui-input webfonts-changed">

// phabricator
<input type="text" pattern="\d*" name="authfactor.2.mfa.response" autocomplete="off" id="UQ0_0" autofocus="autofocus">

In mediawiki autofocus is set to an empty string, and in phabricator/matomo it's set to "autofocus".

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Aklapper changed the subtype of this task from "Task" to "Feature Request".Aug 17 2021, 10:48 PM

For future reference, please use the feature request form (linked from the top of the task creation page) for creating feature requests. Thanks.

I’ve done some testing and the solution that I’ve found so far is to set autocomplete to “one-time-code”. It was set to off per T226049 and T141735, but at least in safari the problem mentioned in those tasks doesn’t happen when setting it to “one-time-code”.

Change 714148 had a related patch set uploaded (by MacFan4000; author: MacFan4000):

[mediawiki/extensions/OATHAuth@master] set autocomplete=\u2018one-time-code\u2019 on forms

https://gerrit.wikimedia.org/r/714148

Just noting the task description talks about autofocus, but then you're changing autocomplete...

Change 717455 had a related patch set uploaded (by Reedy; author: MacFan4000):

[mediawiki/extensions/OATHAuth@REL1_36] set autocomplete=\u2018one-time-code\u2019 on forms

https://gerrit.wikimedia.org/r/717455

Change 717456 had a related patch set uploaded (by Reedy; author: MacFan4000):

[mediawiki/extensions/OATHAuth@REL1_35] set autocomplete=\u2018one-time-code\u2019 on forms

https://gerrit.wikimedia.org/r/717456

Change 714148 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@master] set autocomplete=\u2018one-time-code\u2019 on forms

https://gerrit.wikimedia.org/r/714148

Change 717456 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@REL1_35] set autocomplete=\u2018one-time-code\u2019 on forms

https://gerrit.wikimedia.org/r/717456

Change 717455 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@REL1_36] set autocomplete=\u2018one-time-code\u2019 on forms

https://gerrit.wikimedia.org/r/717455

MacFan4000 claimed this task.
Huji subscribed.

This may seem like a cool feature for iOS, but it has a significant undesirable side effect for all other OSs. There was good reason for setting "autocomplete" to "off" in T141735. I doubt that most 2FA logins happen via iOS devices, therefore I suggest we revert this change in favor of the larger user group.

I’ve done some testing and the solution that I’ve found so far is to set autocomplete to “one-time-code”. It was set to off per T226049 and T141735, but at least in safari the problem mentioned in those tasks doesn’t happen when setting it to “one-time-code”.

Well, it does occur in Firefox and Chrome.

Spec: HTML5 (doesn't say how exactly it should be handled though)
Firefix bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=1547294
No bug reports for other browsers, although https://bugs.chromium.org/p/chromium/issues/detail?id=1026373 is related.