Page MenuHomePhabricator

Support conditional mediation in WebAuthnAuthenticator
Closed, ResolvedPublic

Description

The first step of passwordless login is conditional mediation, where we send the browser a challenge, receive a response, and only then figure out who the user is. This requires sending a challenge without knowing which user it's for.

We generate WebAuthn challenges using the WebAuthnAuthenticator class, but constructing an instance of this class requires a User object, which we won't have in the passwordless login case. We should change WebAuthnAuthenticator to a service, and pass the User object in as a parameter to the methods that need it.

This will then allow us to add a method similar to startAuthentication() but for conditional mediation, with the following differences:

  • allowCredentials is an empty array (rather than being an array of the user's credential IDs)
  • The user verification flag is set to "required" (rather than "preferred")

(We don't need to do this for continueAuthentication(), because by that stage we'll know who the user is.)

  • Make WebAuthnAuthenticator a service, wired up in ServiceWiring.php, no longer requiring a User object (or the passkeyMode flag) to construct it
  • Add a User object parameter (and the passkeyMode flag) to the methods that need it
  • Add a method that generates a conditional mediation challenge, without needing a User object

Event Timeline

Change #1239107 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/OATHAuth@master] WIP: Service-ify WebAuthnAuthenticator

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

Change #1239161 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/OATHAuth@master] WebAuthnAuthenticator: Add conditionalAuthentication

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

Change #1239107 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@master] Service-ify WebAuthnAuthenticator

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

Change #1239161 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@master] WebAuthnAuthenticator: Add conditionalAuthentication

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

sbassett triaged this task as Medium priority.
sbassett moved this task from Incoming to Our Part Is Done on the Security-Team board.
sbassett added a project: SecTeam-Processed.