Page MenuHomePhabricator

wikitech still relies on OATHAuth legacy single-key (was PHP Notice: Undefined index: keys)
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   PHP Notice: Undefined index: keys
exception.trace
from /srv/mediawiki/php-1.39.0-wmf.5/extensions/OATHAuth/src/OATHUserRepository.php(98)
#0 /srv/mediawiki/php-1.39.0-wmf.5/extensions/OATHAuth/src/OATHUserRepository.php(98): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.39.0-wmf.5/extensions/OATHAuth/src/Hook/HookHandler.php(98): MediaWiki\Extension\OATHAuth\OATHUserRepository->findByUser(User)
#2 /srv/mediawiki/php-1.39.0-wmf.5/includes/HookContainer/HookContainer.php(160): MediaWiki\Extension\OATHAuth\Hook\HookHandler->onGetPreferences(User, array)
#3 /srv/mediawiki/php-1.39.0-wmf.5/includes/HookContainer/HookRunner.php(1913): MediaWiki\HookContainer\HookContainer->run(string, array)
#4 /srv/mediawiki/php-1.39.0-wmf.5/includes/preferences/DefaultPreferencesFactory.php(249): MediaWiki\HookContainer\HookRunner->onGetPreferences(User, array)
#5 /srv/mediawiki/php-1.39.0-wmf.5/includes/api/ApiOptions.php(205): MediaWiki\Preferences\DefaultPreferencesFactory->getFormDescriptor(User, DerivativeContext)
#6 /srv/mediawiki/php-1.39.0-wmf.5/includes/api/ApiOptions.php(115): ApiOptions->getPreferences()
#7 /srv/mediawiki/php-1.39.0-wmf.5/includes/api/ApiMain.php(1897): ApiOptions->execute()
#8 /srv/mediawiki/php-1.39.0-wmf.5/includes/api/ApiMain.php(871): ApiMain->executeAction()
#9 /srv/mediawiki/php-1.39.0-wmf.5/includes/api/ApiMain.php(842): ApiMain->executeActionWithErrorHandling()
#10 /srv/mediawiki/php-1.39.0-wmf.5/api.php(90): ApiMain->execute()
#11 /srv/mediawiki/php-1.39.0-wmf.5/api.php(45): wfApiMain()
#12 /srv/mediawiki/w/api.php(3): require(string)
#13 {main}
Impact
Notes

Comes from an OATHAuth hook ( https://www.mediawiki.org/wiki/Extension:OATHAuth ) while browsing Special:RecentChanges on https://wikitech.wikimedia.org

Event Timeline

hashar triaged this task as Unbreak Now! priority.Mar 30 2022, 8:25 AM
hashar created this task.

Beside l10n update, there have been no recent modifications to OATHAuth extension :-\

My local copy of the repository was not up-to-date. We had:

$ git releasenotes --no-merges origin/wmf/1.39.0-wmf.4..origin/wmf/1.39.0-wmf.5
Sam Reed (2):
      * [22505f7] OATHUserRepository: Remove some legacy handling
      * [6898d6b] OATHUserRepository: Stop handling legacy single-key

[BOT] Translation updater bot (3):
      * [9606a8f] Localisation updates from https://translatewiki.net.
      * [1b6ed14] Localisation updates from https://translatewiki.net.
      * [4faabe7] Localisation updates from https://translatewiki.net.

Very likely, I thought there was no change introduced recently cause my local copy of OATHAuth was not up-to-date (I have amended my comment above).

Looks like we should rollback the change. Or maybe labswiki users have not been migrated?

Change 774995 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/extensions/OATHAuth@master] Revert "OATHUserRepository: Stop handling legacy single-key"

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

maybe running updateTOTPToMultipleKeys.php on labswiki does fix the issue.

Change 774995 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@master] Revert "OATHUserRepository: Stop handling legacy single-key"

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

Change 774996 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/extensions/OATHAuth@wmf/1.39.0-wmf.5] Revert "OATHUserRepository: Stop handling legacy single-key"

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

The change is so simple that for now we can revert it. It can easily be reapplied after any missing migration has been done.

Krinkle subscribed.

Thanks @Zabe. We didn't think to check labswiki. Oops :/

Change 774996 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@wmf/1.39.0-wmf.5] Revert "OATHUserRepository: Stop handling legacy single-key"

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

Mentioned in SAL (#wikimedia-operations) [2022-03-31T08:30:27Z] <hashar@deploy1002> Synchronized php-1.39.0-wmf.5/extensions/OATHAuth/src/OATHUserRepository.php: Backport: [[gerrit:774996|Revert "OATHUserRepository: Stop handling legacy single-key" (T305029)]] (duration: 00m 51s)

hashar renamed this task from PHP Notice: Undefined index: keys to wikitech still relies on OATHAuth legacy single-key (was PHP Notice: Undefined index: keys).Mar 31 2022, 8:41 AM
hashar lowered the priority of this task from Unbreak Now! to High.

This is no more an unbreak now since the faulty patch got rolled back. I have kept the task open to get wikitech updated and then we can reapply the change?

It doesn't anymore!

MariaDB [labswiki]> select * from oathauth_users WHERE data NOT like "{\"keys%";
Empty set (0.001 sec)

It doesn't anymore!

MariaDB [labswiki]> select * from oathauth_users WHERE data NOT like "{\"keys%";
Empty set (0.001 sec)

And neither does labtestwiki. Patch should be good to be rolled forward again