Page MenuHomePhabricator

CU 2.0: MediaWiki\User\UserOptionsManager::saveOptions was called on anon user
Closed, ResolvedPublicBUG REPORT

Description

What is the problem?

Clicking "Restart Tour":

[fd82a22e-2720-41dc-8239-3ed328ce1974] /w/index.php?title=Special:Investigate/IPs_%26_User_agents&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1OTcxNjY4MzEsImRhdGEiOiJlSUdZNWZvR1pTK2h5N2UwZ1RvZ0VOaVJqQjZoT01qMXAwNnlwdGhwN2dqcUlCN1Z4UWV3c3dmM1AwdFpEdmxCU0wwcHk3a2xmMlViaytiMnFKUk5JdTdSaXhBVjR4ZzJVR2RmRzc4NHJKcTlxakw4MXIxMzI1QlFaNHlNOTlcL2JuRU5KVnp0dUxqeTJtYU50V0QwdjgwYU50SVlaSjFJakNDR055TDFLWUp1M21iTHhkVE5rWG5RSlRjaG9YMzUxeGZmNFIwdWEwXC9CdGdtMlI5MDMzWUJiUEpQbmdnSzNzNXpHTUp4ZXVhXC9wbUV1VXNGdUx5WTR2cjlaK090T1FWamg5R2lBPT0ifQ.bYnDEkJDACxx1o6dCpc-89aR5E_taFHz083nNwvUlC4&tour=checkuserinvestigate InvalidArgumentException from line 382 of /srv/mediawiki/php-1.36.0-wmf.3/includes/user/UserOptionsManager.php: MediaWiki\User\UserOptionsManager::saveOptions was called on anon userBacktrace:#0 /srv/mediawiki/php-1.36.0-wmf.3/extensions/CheckUser/src/SpecialInvestigate.php(932): MediaWiki\User\UserOptionsManager->saveOptions(User)
#1 /srv/mediawiki/php-1.36.0-wmf.3/extensions/CheckUser/src/SpecialInvestigate.php(148): MediaWiki\CheckUser\SpecialInvestigate->reLaunchTour()
#2 /srv/mediawiki/php-1.36.0-wmf.3/includes/specialpage/SpecialPage.php(600): MediaWiki\CheckUser\SpecialInvestigate->execute(string)
#3 /srv/mediawiki/php-1.36.0-wmf.3/includes/specialpage/SpecialPageFactory.php(635): SpecialPage->run(string)
#4 /srv/mediawiki/php-1.36.0-wmf.3/includes/MediaWiki.php(307): MediaWiki\SpecialPage\SpecialPageFactory->executePath(Title, RequestContext)
#5 /srv/mediawiki/php-1.36.0-wmf.3/includes/MediaWiki.php(940): MediaWiki->performRequest()
#6 /srv/mediawiki/php-1.36.0-wmf.3/includes/MediaWiki.php(543): MediaWiki->main()
#7 /srv/mediawiki/php-1.36.0-wmf.3/index.php(53): MediaWiki->run()
#8 /srv/mediawiki/php-1.36.0-wmf.3/index.php(46): wfIndexMain()
#9 /srv/mediawiki/w/index.php(3): require(string)
#10 {main}
Steps to reproduce problem
  1. 2. 3.

Expected behavior:
Observed behavior:

Environment

Operating system:
Browser:
Wiki(s):
Editor, if applicable:

Screenshots (if applicable):

Event Timeline

Change 619342 had a related patch set uploaded (by Dbarratt; owner: Dbarratt):
[mediawiki/extensions/CheckUser@master] Ensure that the Special:Investigate permission checks are performed

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

Change 619342 merged by jenkins-bot:
[mediawiki/extensions/CheckUser@master] Ensure that the Special:Investigate permission checks are performed

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

I can no longer reproduce this bug. I have tried clicking "Restart Tour":

  • From the Compare tab:
    • after logging out on a different tab (now get taken to the "Permission error" page) <- this reliably reproduced this bug before
    • after being blocked (now see the usual block message)
    • after having CheckUser right removed (now see "Permission error")
    • after my investigate token expires (now get returned to the Special:Investigate front page)
  • From the front page:
    • after logging out (again, taken to "Permission error")
    • after being blocked (again, see block message)

The initial request to restart a tour returns a redirect, leading to a second request. To check that this did not lead to the SpecialInvestigate:execute method being called twice (as per T259032), I checked that only one EventLogging event gets fired (on the second request).

I also tested that other requests to Special:Investigate get validated correctly. For example, adding a new target to the investigation after being logged out or adding a filter after being blocked.

In case of regression, I tested that restarting a tour, adding a new target, adding a filter and switching tabs behave as they did before and the correct number of EventLogging events were fired.

Test environment Local vagrant CheckUser 2.5 (ca7789a)