MediaWiki:GrowthMentors.json is a part of community configuration, meaning its content is processed on request. This means its content needs to be carefully validated on each read and write, to ensure its content meets the code authors' assumptions and to avoid any fatal errors (which would take the site down). For this file, the validation is supposed to be handled by StructuredMentorListValidator class, called from ConfigHooks.
Unfortunately, the validation is currently broken (as an unintended side effect of T383330: Deprecate calling legacy Community Configuration). This means it is possible to abuse write access to MediaWiki:GrowthMentors.json to take down the site for at least some of its users. An example page content that would do this is this:
{ "Mentors": { "43912": { "weight": "tramvaj" } } }
With this as the content, any user who has user ID 43912 as their mentor assigned will experience fatal errors that look like this:
[58aa3efe-af0c-96f0-bdd8-67655dc99d32] /w/api.php?action=query&meta=userinfo TypeError: Argument 4 passed to GrowthExperiments\Mentorship\Mentor::__construct() must be of the type int, string given, called in /srv/mediawiki/php-1.44.0-wmf.12/extensions/GrowthExperiments/includes/Mentorship/Provider/AbstractStructuredMentorProvider.php on line 90
Backtrace:
from /srv/mediawiki/php-1.44.0-wmf.12/extensions/GrowthExperiments/includes/Mentorship/Mentor.php(29)
#0 /srv/mediawiki/php-1.44.0-wmf.12/extensions/GrowthExperiments/includes/Mentorship/Provider/AbstractStructuredMentorProvider.php(90): GrowthExperiments\Mentorship\Mentor->__construct(MediaWiki\User\UserIdentityValue, null, string, string)
#1 /srv/mediawiki/php-1.44.0-wmf.12/extensions/GrowthExperiments/includes/Mentorship/Provider/AbstractStructuredMentorProvider.php(63): GrowthExperiments\Mentorship\Provider\AbstractStructuredMentorProvider->newFromMentorDataAndUserIdentity(array, MediaWiki\User\UserIdentityValue, MediaWiki\User\User)
#2 /srv/mediawiki/php-1.44.0-wmf.12/extensions/GrowthExperiments/includes/Mentorship/MentorPageMentorManager.php(134): GrowthExperiments\Mentorship\Provider\AbstractStructuredMentorProvider->newMentorFromUserIdentity(MediaWiki\User\UserIdentityValue, MediaWiki\User\User)
#3 /srv/mediawiki/php-1.44.0-wmf.12/extensions/GrowthExperiments/includes/Mentorship/MentorPageMentorManager.php(181): GrowthExperiments\Mentorship\MentorPageMentorManager->getMentorForUser(MediaWiki\User\User, string)
#4 /srv/mediawiki/php-1.44.0-wmf.12/extensions/GrowthExperiments/includes/HelpPanelHooks.php(273): GrowthExperiments\Mentorship\MentorPageMentorManager->getMentorForUserSafe(MediaWiki\User\User)
#5 /srv/mediawiki/php-1.44.0-wmf.12/extensions/GrowthExperiments/includes/HelpPanelHooks.php(197): GrowthExperiments\HelpPanelHooks->getMentorData(GrowthExperiments\Config\MediaWikiConfigReaderWrapper, MediaWiki\User\User, MediaWiki\Context\DerivativeContext, LanguageEn)
#6 /srv/mediawiki/php-1.44.0-wmf.12/includes/HookContainer/HookContainer.php(159): GrowthExperiments\HelpPanelHooks->onBeforePageDisplay(MediaWiki\Output\OutputPage, SkinApi)
#7 /srv/mediawiki/php-1.44.0-wmf.12/includes/HookContainer/HookRunner.php(991): MediaWiki\HookContainer\HookContainer->run(string, array, array)
#8 /srv/mediawiki/php-1.44.0-wmf.12/includes/Output/OutputPage.php(3198): MediaWiki\HookContainer\HookRunner->onBeforePageDisplay(MediaWiki\Output\OutputPage, SkinApi)
#9 /srv/mediawiki/php-1.44.0-wmf.12/includes/api/ApiFormatBase.php(349): MediaWiki\Output\OutputPage->output()
#10 /srv/mediawiki/php-1.44.0-wmf.12/includes/api/ApiMain.php(2240): MediaWiki\Api\ApiFormatBase->closePrinter()
#11 /srv/mediawiki/php-1.44.0-wmf.12/includes/api/ApiMain.php(1029): MediaWiki\Api\ApiMain->printResult(int)
#12 /srv/mediawiki/php-1.44.0-wmf.12/includes/api/ApiMain.php(953): MediaWiki\Api\ApiMain->handleException(TypeError)
#13 /srv/mediawiki/php-1.44.0-wmf.12/includes/api/ApiMain.php(915): MediaWiki\Api\ApiMain->executeActionWithErrorHandling()
#14 /srv/mediawiki/php-1.44.0-wmf.12/includes/api/ApiEntryPoint.php(153): MediaWiki\Api\ApiMain->execute()
#15 /srv/mediawiki/php-1.44.0-wmf.12/includes/MediaWikiEntryPoint.php(202): MediaWiki\Api\ApiEntryPoint->execute()
#16 /srv/mediawiki/php-1.44.0-wmf.12/api.php(44): MediaWiki\MediaWikiEntryPoint->run()
#17 /srv/mediawiki/w/api.php(3): require(string)
#18 {main}This is because "tramvaj" (or any string) is not a valid value for mentor weight (only non-negative integers are valid in this context).
The expected failover behaviour when MediaWiki:GrowthMentors.json has invalid content is to behave as if there were no mentors (until someone fixes the invalid content manually).