Page MenuHomePhabricator

Don't save scratch_tokens if empty array (like they are on new TOTP rows)
Closed, ResolvedPublic

Description

It seems when we're inserting new TOTP rows we're adding empty scratch_tokens arrays in oad_data... Fallout from T232336: Separate recovery codes into a separate 2FA module.

We should probably stop doing this ASAP, as we'll just need to remove them again (probably part of T405235: Create MediaWiki maintenance script to migrate older TOTP devices to modern TOTP + Recovery Codes configuration, rather than doing another script ontop).

Event Timeline

Reedy triaged this task as High priority.Oct 10 2025, 12:17 AM

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

[mediawiki/extensions/OATHAuth@master] TOTPKey: Only serialize scratch_tokens if not an empty array

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

Reedy renamed this task from Don't set scratch_tokens on new TOTP rows to Don't save scratch_tokens if empty array (like they are on new TOTP rows).Oct 10 2025, 12:55 AM

Change #1195087 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@master] TOTPKey: Only serialize scratch_tokens if not an empty array

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

Reedy claimed this task.