Page MenuHomePhabricator

Log in broken, if CentralAuth is enabled
Closed, ResolvedPublicBUG REPORT

Description

When trying to log in on a CentralAuth enabled wiki (with both MediaWiki and CentralAuth at master):

[ZGoESCn7C09djVIkFTLI4gAAANE] /wiki/index.php?title=Special:UserLogin&returnto=Item:Q1 Wikimedia\Assert\PreconditionException: Expected MediaWiki\User\UserIdentityValue to belong to 'wikidatawiki', but it belongs to the local wiki

Backtrace:

from /var/www/html/wiki/includes/dao/WikiAwareEntityTrait.php(59)
#0 /var/www/html/wiki/includes/user/UserGroupManager.php(707): MediaWiki\User\UserIdentityValue->assertWiki()
#1 /var/www/html/wiki/extensions/CentralAuth/includes/User/CentralAuthUser.php(2761): MediaWiki\User\UserGroupManager->getUserGroupMemberships()
#2 /var/www/html/wiki/extensions/CentralAuth/includes/User/CentralAuthUser.php(2588): MediaWiki\Extension\CentralAuth\User\CentralAuthUser->localUserData()
#3 /var/www/html/wiki/extensions/CentralAuth/includes/User/CentralAuthUser.php(2557): MediaWiki\Extension\CentralAuth\User\CentralAuthUser->queryAttached()
#4 /var/www/html/wiki/extensions/CentralAuth/includes/Hooks/Handlers/PasswordPoliciesHookHandler.php(57): MediaWiki\Extension\CentralAuth\User\CentralAuthUser->getLocalGroups()
#5 /var/www/html/wiki/includes/HookContainer/HookContainer.php(160): MediaWiki\Extension\CentralAuth\Hooks\Handlers\PasswordPoliciesHookHandler->onPasswordPoliciesForUser()
#6 /var/www/html/wiki/includes/HookContainer/HookRunner.php(3027): MediaWiki\HookContainer\HookContainer->run()
#7 /var/www/html/wiki/includes/password/UserPasswordPolicy.php(191): MediaWiki\HookContainer\HookRunner->onPasswordPoliciesForUser()
#8 /var/www/html/wiki/includes/password/UserPasswordPolicy.php(81): UserPasswordPolicy->getPoliciesForUser()
#9 /var/www/html/wiki/includes/user/User.php(1022): UserPasswordPolicy->checkUserPassword()
#10 /var/www/html/wiki/includes/auth/AbstractPasswordPrimaryAuthenticationProvider.php(109): User->checkPasswordValidity()
#11 /var/www/html/wiki/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php(161): MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider->checkPasswordValidity()
#12 /var/www/html/wiki/includes/auth/AuthManager.php(532): MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider->beginPrimaryAuthentication()
#13 /var/www/html/wiki/includes/auth/AuthManager.php(462): MediaWiki\Auth\AuthManager->continueAuthentication()
#14 /var/www/html/wiki/includes/specialpage/AuthManagerSpecialPage.php(374): MediaWiki\Auth\AuthManager->beginAuthentication()
#15 /var/www/html/wiki/includes/specialpage/AuthManagerSpecialPage.php(506): AuthManagerSpecialPage->performAuthenticationStep()
#16 /var/www/html/wiki/includes/htmlform/HTMLForm.php(744): AuthManagerSpecialPage->handleFormSubmit()
#17 /var/www/html/wiki/includes/specialpage/AuthManagerSpecialPage.php(437): HTMLForm->trySubmit()
#18 /var/www/html/wiki/includes/specialpage/LoginSignupSpecialPage.php(326): AuthManagerSpecialPage->trySubmit()
#19 /var/www/html/wiki/includes/specialpage/SpecialPage.php(701): LoginSignupSpecialPage->execute()
#20 /var/www/html/wiki/includes/specialpage/SpecialPageFactory.php(1548): SpecialPage->run()
#21 /var/www/html/wiki/includes/MediaWiki.php(328): MediaWiki\SpecialPage\SpecialPageFactory->executePath()
#22 /var/www/html/wiki/includes/MediaWiki.php(925): MediaWiki->performRequest()
#23 /var/www/html/wiki/includes/MediaWiki.php(579): MediaWiki->main()
#24 /var/www/html/wiki/index.php(50): MediaWiki->run()
#25 /var/www/html/wiki/index.php(46): wfIndexMain()
#26 {main}

Caused by b565ab8404325ea31301c79d82883f58f781bcd6

Event Timeline

Change 921699 had a related patch set uploaded (by Hoo man; author: Hoo man):

[mediawiki/core@master] Recognize the local wiki id in WikiAwareEntityTrait::assertWiki

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

Seems to be breaking the daily selenium tests which makes this affect more than just CentralAuth. Would appreciate a quick fix.

Umherirrender lowered the priority of this task from Unbreak Now! to Needs Triage.May 21 2023, 12:29 PM
Umherirrender subscribed.

I have reverted https://gerrit.wikimedia.org/r/c/mediawiki/core/+/914900 and merged that directly.

Change 921699 abandoned by Hoo man:

[mediawiki/core@master] Recognize the local wiki id in WikiAwareEntityTrait::assertWiki

Reason:

Seems this would be hard to do properly now, let's go and fix the callers instead :/

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