Page MenuHomePhabricator

Checkuser throws exception if looking up user with invalid name
Closed, ResolvedPublicPRODUCTION ERROR

Description

See XH7ukQpAICsAAK@78zcAAADX (not pasting fully due to sort of sensitive data). Note the Title ends in an underscore, which is illegal for a title.

Bad value for parameter $dbkey: invalid DB key 'REDACTED_'
#0 /srv/mediawiki/php-1.33.0-wmf.19/includes/title/TitleValue.php(105): Wikimedia\Assert\Assert::parameter(boolean, string, string)
#1 /srv/mediawiki/php-1.33.0-wmf.19/includes/cache/LinkBatch.php(179): TitleValue->__construct(integer, string)
#2 /srv/mediawiki/php-1.33.0-wmf.19/includes/cache/LinkBatch.php(143): LinkBatch->addResultToCache(LinkCache, Wikimedia\Rdbms\ResultWrapper)
#3 /srv/mediawiki/php-1.33.0-wmf.19/includes/cache/LinkBatch.php(130): LinkBatch->executeInto(LinkCache)
#4 /srv/mediawiki/php-1.33.0-wmf.19/extensions/CheckUser/includes/CheckUserLogPager.php(116): LinkBatch->execute()
#5 /srv/mediawiki/php-1.33.0-wmf.19/includes/pager/IndexPager.php(231): CheckUserLogPager->preprocessResults(Wikimedia\Rdbms\ResultWrapper)
#6 /srv/mediawiki/php-1.33.0-wmf.19/includes/pager/IndexPager.php(609): IndexPager->doQuery()
#7 /srv/mediawiki/php-1.33.0-wmf.19/includes/pager/ReverseChronologicalPager.php(35): IndexPager->isNavigationBarShown()
#8 /srv/mediawiki/php-1.33.0-wmf.19/extensions/CheckUser/includes/specials/SpecialCheckUserLog.php(70): ReverseChronologicalPager->getNavigationBar()
#9 /srv/mediawiki/php-1.33.0-wmf.19/includes/specialpage/SpecialPage.php(569): SpecialCheckUserLog->execute(NULL)
#10 /srv/mediawiki/php-1.33.0-wmf.19/includes/specialpage/SpecialPageFactory.php(558): SpecialPage->run(NULL)
#11 /srv/mediawiki/php-1.33.0-wmf.19/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#12 /srv/mediawiki/php-1.33.0-wmf.19/includes/MediaWiki.php(867): MediaWiki->performRequest()
#13 /srv/mediawiki/php-1.33.0-wmf.19/includes/MediaWiki.php(517): MediaWiki->main()
#14 /srv/mediawiki/php-1.33.0-wmf.19/index.php(42): MediaWiki->run()
#15 /srv/mediawiki/w/index.php(3): include(string)
#16 {main}

Event Timeline

Huji triaged this task as Medium priority.
Huji subscribed.

I can confirm that ending the username with _ will cause an exception. Looking for the root cause now.

Change 494638 had a related patch set uploaded (by Huji; owner: Huji):
[mediawiki/extensions/CheckUser@master] Use getSafeTitleFor instead of getTitleFor to make links

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

Guess what, it was a regression that I had introduced in https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/CheckUser/+/374851/ more than year ago!

Change 494638 had a related patch set uploaded (by Huji; owner: Huji):
[mediawiki/extensions/CheckUser@master] Use getSafeTitleFor instead of getTitleFor to make links

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

Not seen in Logstash for over 30 days. Keeping open because I'm unable to verify it myself given the restricted input. Is this still reproducible?

It is. I just created a log for you on fawiki :)

I haven't been able to find the time to resubmit 494638, which will eventually fix this.

PS: That was the right nudge at the right time, @Krinkle :) I submitted a new patchset.

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:07 PM

Change 494638 merged by jenkins-bot:
[mediawiki/extensions/CheckUser@master] Validate username input before constructing subpage links

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

Change 634269 had a related patch set uploaded (by Urbanecm; owner: Urbanecm):
[mediawiki/extensions/CheckUser@master] Validate username input before constructing subpage links

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

The new patch does the job correctly.

Unfortunately, I cannot think of any way to create a unit test for this. Closing now because I just +2 the new patch.

Change 634269 merged by jenkins-bot:
[mediawiki/extensions/CheckUser@master] Validate username input before constructing subpage links

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