Page MenuHomePhabricator

OATHAuth: Add support for expiring recovery codes
Closed, ResolvedPublic

Description

For the parent task, we need to implement support for expiring recovery codes at all. "Normal" recovery codes, which are generated by the user for themself, should remain valid indefinitely.

Acceptance criteria

  • Expiring recovery codes can be used to log in to the account only before their expiration time.
  • Expiring recovery codes are not listed (nor downloadable) on Special:AccountSecurity.
  • Expiring recovery codes are single-use.
  • Expired recovery codes are removed from the database as soon as any write operation happens to the user's recovery codes (e.g., other code was used).
  • Expiring recovery codes are also removed when the user is regenerating their codes.

Event Timeline

Change #1254179 had a related patch set uploaded (by Mszwarc; author: Mszwarc):

[mediawiki/extensions/OATHAuth@master] Extract a class for single recovery code

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

Change #1254202 had a related patch set uploaded (by Mszwarc; author: Mszwarc):

[mediawiki/extensions/OATHAuth@master] Add optional expiration timestamp to recovery codes

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

Change #1254179 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@master] Extract a class for single recovery code

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

Change #1254202 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@master] Add optional expiration timestamp to recovery codes

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

Change #1254222 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@master] Hide expiring recovery codes from Special:AccountSecurity

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

Expiring recovery codes are not listed (nor downloadable) on Special:AccountSecurity.

User should be able to notice their existence and be able to remove them. Otherwise if malicious user try to recover their 2FA (more common if we grant 2FA recovery permission to sysops) user will have no way to combat that.

Expiring recovery codes are not listed (nor downloadable) on Special:AccountSecurity.

User should be able to notice their existence and be able to remove them. Otherwise if malicious user try to recover their 2FA (more common if we grant 2FA recovery permission to sysops) user will have no way to combat that.

Yes, I'd like to make a difference between listing the codes and indicating the existence of them.

For the first – we don't want to encourage users to store temporary codes, because they would expire soon. That's why the codes themselves shouldn't be available from the special page.

For indicating the existence of such codes – this idea is valid (I've also mentioned it in one of the commit messages, for lack of time to create a proper task). This is something that should be implemented (T420908).

Change #1259891 had a related patch set uploaded (by Mszwarc; author: Mszwarc):

[mediawiki/extensions/OATHAuth@master] Fix encryption of recovery codes with data

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

Change #1259891 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@master] Fix encryption of recovery codes with data

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