Page MenuHomePhabricator

User-defined project domains should be validated
Closed, ResolvedPublic3 Estimated Story PointsBUG REPORT

Description

Steps to Reproduce:

  • Go to Special:GlobalWatchlistSettings
  • Add the wiki "foobar" and Save settings
  • Go to Special:GlobalWatchlist

Actual Results:

  • You get the popup "GlobalWatchlist error, please check the console!"

Expected Results:

  • Shown errors when attempting to save the invalid wiki. Or, "foobar" could silently be ignored and not ever saved.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
DannyS712 triaged this task as Medium priority.Nov 19 2020, 6:49 AM
DannyS712 moved this task from Unsorted to Next on the User-DannyS712 board.
DannyS712 set the point value for this task to 3.Nov 19 2020, 6:52 AM
DannyS712 added a subscriber: DannyS712.

Should be able to do in the next few days
Going to go with the show errors route, though validation will only be available if CentralAuth is installed.
To get the url forms of the wikis a user is attached on:

$urls = array_map(
	function ( $dbName ) {
		$wiki = WikiMap::getWiki( $dbName );
		return $wiki ? $wiki->getDisplayName() : '';
	},
	CentralAuthUser::getInstanceByName( 'DannyS712' )->listAttached()
);

(where DannyS712 is replaced with a variable for the acting user's name; can also use CentralAuthUser::getInstance with a user object)

Change 642091 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/GlobalWatchlist@master] Validate user-provided site list with CentralAuth

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

Change 642091 merged by jenkins-bot:
[mediawiki/extensions/GlobalWatchlist@master] Validate user-provided site list with CentralAuth

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

Urbanecm assigned this task to DannyS712.

Testing at https://meta.wikimedia.beta.wmflabs.org/wiki/Special:GlobalWatchlistSettings trying to add foobar
Sitelist:

meta.wikimedia.beta.wmflabs.org
en.wikipedia.beta.wmflabs.org
foobar

Actual result:
The site "meta.wikimedia.beta.wmflabs.org" does not match a wiki where you have an attached CentralAuth account.

tested with a few other inputs, its seems whatever I provide the first site fails as not matching.
However, testing via shell.php suggests that this should be working?

>>> $caU = CentralAuthUser::getInstance( User::newFromName( 'DannyS712' ) );
=> CentralAuthUser {#5273
     +mStateDirty: false,
     +mHomeWiki: null,
   }
>>> $urlForms = array_map( function ( $dbName ) { $wiki = WikiMap::getWiki( $dbName ); return $wiki ? $wiki->getDisplayName() : ''; }, $caU->listAttached() );
=> [
     "aa.wikipedia.beta.wmflabs.org",
     "api.wikimedia.beta.wmflabs.org",
     "ar.wikipedia.beta.wmflabs.org",
     "ca.wikipedia.beta.wmflabs.org",
     "commons.wikimedia.beta.wmflabs.org",
     "crh.wikipedia.beta.wmflabs.org",
     "cs.wikipedia.beta.wmflabs.org",
     "deployment.wikimedia.beta.wmflabs.org",
     "de.wikipedia.beta.wmflabs.org",
     "en-rtl.wikipedia.beta.wmflabs.org",
     "en.wikipedia.beta.wmflabs.org",
     "en.wikibooks.beta.wmflabs.org",
     "en.wikinews.beta.wmflabs.org",
     "en.wikiquote.beta.wmflabs.org",
     "en.wikisource.beta.wmflabs.org",
     "en.wikiversity.beta.wmflabs.org",
     "en.wikivoyage.beta.wmflabs.org",
     "en.wiktionary.beta.wmflabs.org",
     "eo.wikipedia.beta.wmflabs.org",
     "es.wikipedia.beta.wmflabs.org",
     "es.wikibooks.beta.wmflabs.org",
     "fa.wikipedia.beta.wmflabs.org",
     "he.wikipedia.beta.wmflabs.org",
     "he.wiktionary.beta.wmflabs.org",
     "hi.wikipedia.beta.wmflabs.org",
     "ja.wikipedia.beta.wmflabs.org",
     "ko.wikipedia.beta.wmflabs.org",
     "login.wikimedia.beta.wmflabs.org",
     "meta.wikimedia.beta.wmflabs.org",
     "ru.wikipedia.beta.wmflabs.org",
     "simple.wikipedia.beta.wmflabs.org",
     "sq.wikipedia.beta.wmflabs.org",
     "sv.wikipedia.beta.wmflabs.org",
     "test.wikipedia.beta.wmflabs.org",
     "wikidata.beta.wmflabs.org",
     "zh.wikipedia.beta.wmflabs.org",
     "zh.wikivoyage.beta.wmflabs.org",
   ]
>>> ExtensionRegistry::getInstance()->isLoaded( 'CentralAuth' )
=> true

will need to look into this more, though T268200: Beta cluster logstash down will make debugging a bit harder

Change 651220 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/GlobalWatchlist@master] Fix return in SpecialGlobalWatchlistSettings::maybeGetValidSites

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

Change 651220 merged by jenkins-bot:
[mediawiki/extensions/GlobalWatchlist@master] Fix return in SpecialGlobalWatchlistSettings::maybeGetValidSites

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

DannyS712 set Final Story Points to 4.