Page MenuHomePhabricator

Tighten validation of page titles in CommunityConfiguration
Open, Needs TriagePublic

Description

CommunityConfiguration allows clients to specify a value should be a page title, cf.:

class Schema extends JsonSchema {
	public const GEHelpPanelViewMoreTitle = [
		self::REF => [
			'class' => MediaWikiDefinitions::class, 'field' => 'PageTitle',
		],
	];
}

However, CommunityConfiguration then never validates the value actually is a page title that might exist. At times, this might cause errors such as T431625: https://test.wikipedia.org/ has been replaced by a TypeError or T431632: Misconfiguring Revise Tone's Community Configuration can turn off Suggested Edits for everyone. Within this task, we should make CommunityConfiguration validate page titles.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

This is not a straightforward task, as page title restrictions aren't easily expressible in JSON Schema... But, we can at least get closer, I believe.

Change #1309113 had a related patch set uploaded (by Shubhita6; author: Shubhita6):

[mediawiki/extensions/CommunityConfiguration@master] Tighten validation of page titles in CommunityConfiguration

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

Implemented server-side validation for PageTitleControl and PageTitlesControl in JsonSchemaValidator using the TitleParser service, along with test coverage and localization.

Gerrit change: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CommunityConfiguration/+/1309113