Exception "User account is not global" on Special:ContentTranslation with lang/target params
Closed, ResolvedPublic

Description

For example, if I open https://dev.translatewiki.net/w/i.php?title=Special:ContentTranslation&page=Vantaa&from=en&to=es&targettitle=Vantaa&version=2 in incognito mode, I get the following error:

[946fc2b6f7ea09fc38e7af62] /w/i.php?title=Special:ContentTranslation&page=Vantaa&from=en&to=es&targettitle=Vantaa&version=1 Exception from line 20 of /www/dev.translatewiki.net/docroot/w/extensions/ContentTranslation/includes/Translator.php: User account is not global

Backtrace:

#0 /www/dev.translatewiki.net/docroot/w/extensions/ContentTranslation/specials/SpecialContentTranslation.php(104): ContentTranslation\Translator->getGlobalUserId()
#1 /www/dev.translatewiki.net/docroot/w/extensions/ContentTranslation/specials/SpecialContentTranslation.php(151): SpecialContentTranslation->isExistingTranslation()
#2 /www/dev.translatewiki.net/docroot/w/extensions/ContentTranslation/specials/SpecialContentTranslation.php(187): SpecialContentTranslation->onTranslationView()
#3 /www/dev.translatewiki.net/docroot/w/extensions/ContentTranslation/specials/ContentTranslationSpecialPage.php(23): SpecialContentTranslation->getRedirectURL()
#4 /www/dev.translatewiki.net/docroot/w/includes/specialpage/SpecialPage.php(569): ContentTranslationSpecialPage->execute(NULL)
#5 /www/dev.translatewiki.net/docroot/w/includes/specialpage/SpecialPageFactory.php(581): SpecialPage->run(NULL)
#6 /www/dev.translatewiki.net/docroot/w/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#7 /www/dev.translatewiki.net/docroot/w/includes/MediaWiki.php(868): MediaWiki->performRequest()
#8 /www/dev.translatewiki.net/docroot/w/includes/MediaWiki.php(525): MediaWiki->main()
#9 /www/dev.translatewiki.net/docroot/w/index.php(42): MediaWiki->run()
#10 {main}

This can happen in two ways:

  1. Session has expired when user clicks to continue a draft on the dashboard
  2. Direct access via browser history or bookmarks

Logstash has 88 instances of this for the past 7 days. That is not a lot, but it's still log spam that should be fixed.

Suggested fix: Check if user is anonymous before loading the draft. This is mostly easily done on the PHP side, and it can display a nicely formatted error message instead. For example using SpecialPage::requireLogin.

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 25 2018, 1:26 PM
Krinkle renamed this task from Exception when trying to access a draft as anonymous user to Exception "User account is not global" on Special:ContentTranslation with lang/target params.Oct 1 2018, 11:29 PM
Krinkle triaged this task as High priority.
Krinkle added a subscriber: Krinkle.

Tentatively triaging as high priority due to the exposed fatal exception on a public GET url that actively contributes to false alarms. Under that priority, I don't particularly mind what printed result is for users, as long as it doesn't produce HTTP 500 or log under fatal/exception. Anything less severe that that would make it increasingly less impactful.

Recent data:

  • Example https://id.wikipedia.org/w/index.php?title=Istimewa:ContentTranslation&page=Yodeling&from=en&to=id&targettitle=Yodel (reproducible when logged-out).

Change 465379 had a related patch set uploaded (by Santhosh; owner: Santhosh):
[mediawiki/extensions/ContentTranslation@master] Show login page if anon user try to access existing translation

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

Change 465379 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Show login page if anon user try to access existing translation

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

Change 465765 had a related patch set uploaded (by Krinkle; owner: Santhosh):
[mediawiki/extensions/ContentTranslation@wmf/1.32.0-wmf.24] Show login page if anon user try to access existing translation

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

Change 465765 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@wmf/1.32.0-wmf.24] Show login page if anon user try to access existing translation

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

Krinkle closed this task as Resolved.

Mentioned in SAL (#wikimedia-operations) [2018-10-10T21:50:55Z] <krinkle@deploy1001> Synchronized php-1.32.0-wmf.24/extensions/ContentTranslation/specials/SpecialContentTranslation.php: T205433 - Ib34b28c5bb114c (duration: 00m 49s)