Page MenuHomePhabricator

Regeneration of Recovery Codes doesn't work properly
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue:
Regenerate Recovery Codes.

What happens?:
The new code is not displayed; instead, the existing code is shown with one element missing.
You need to regenerate 10 times to truly regenerate new codes.

What should have happened instead?:
Fix the bug.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
1.45.0-wmf.24 (rMW0b6805d184fb)

Comment:
I notified on jawiki at HERE and HERE.
PLEASE BE CAREFUL WHEN YOU CHANGE THE CODE ABOUT RECOVERY CODES!

Event Timeline

Ok, I specifically understand now.

Keep regenerating codes, it doesn't actually regenerate, you lose one at a time until they're all gone...

Reedy triaged this task as High priority.Oct 25 2025, 4:17 PM

Right... So when src/HTMLForm/RecoveryCodesStatusForm.php runs, it runs both onSubmit and onSuccess.

onSubmit is presuming you've consumed the first. and if you're regenerating, it'll eat one too..

Which means on the same page load, a var_dump in each function...

image.png (1×915 px, 202 KB)

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

[mediawiki/extensions/OATHAuth@master] RecoveryCodeStatusForm: Don't assume there's only one recovery code

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

Ok, I specifically understand now.

Keep regenerating codes, it doesn't actually regenerate, you lose one at a time until they're all gone...

Yeah, that's what I mean. Thank you so much!

Change #1198651 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@master] RecoveryCodeStatusForm: Don't assume there's only one recovery code

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

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

[mediawiki/extensions/OATHAuth@wmf/1.45.0-wmf.24] RecoveryCodeStatusForm: Don't assume there's only one recovery code

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

Reedy renamed this task from Regenerate Recovery Codes, it consume to Regeneration of Recovery Codes doesn't work properly.Oct 25 2025, 5:56 PM

Change #1198656 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@wmf/1.45.0-wmf.24] RecoveryCodeStatusForm: Don't assume there's only one recovery code

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

Mentioned in SAL (#wikimedia-operations) [2025-10-25T18:01:01Z] <reedy@deploy2002> Started scap sync-world: Backport for [[gerrit:1198656|RecoveryCodeStatusForm: Don't assume there's only one recovery code (T408294)]]

Mentioned in SAL (#wikimedia-operations) [2025-10-25T18:05:07Z] <reedy@deploy2002> reedy: Backport for [[gerrit:1198656|RecoveryCodeStatusForm: Don't assume there's only one recovery code (T408294)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2025-10-25T18:18:09Z] <reedy@deploy2002> Finished scap sync-world: Backport for [[gerrit:1198656|RecoveryCodeStatusForm: Don't assume there's only one recovery code (T408294)]] (duration: 17m 08s)

Reedy claimed this task.

Thanks for the report!

I've found numerous other bugs... So many tasks filed off the back of this :(

Thanks for the report!

I've found numerous other bugs... So many tasks filed off the back of this :(

That's a bad news… . I deeply thank and rely on you.