Page MenuHomePhabricator

XTools' ArticleInfo gadget will be blocked by CSP
Open, MediumPublic

Description

When the gadget is ran, this error appears in my console:

[Report Only] Refused to connect to 'https://xtools.wmflabs.org/api/page/articleinfo/en.wikipedia.org/MediaWiki:Gadget-XTools-ArticleInfo.js?format=html&uselang=en' because it violates the following Content Security Policy directive: "default-src 'self' data: blob: upload.wikimedia.org https://commons.wikimedia.org meta.wikimedia.org *.wikimedia.org *.wikipedia.org *.wikinews.org *.wiktionary.org *.wikibooks.org *.wikiversity.org *.wikisource.org wikisource.org *.wikiquote.org *.wikidata.org *.wikivoyage.org *.mediawiki.org wikimedia.org". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback.

Event Timeline

MusikAnimal subscribed.

Indeed :( There is talk for users to be able to selectively whitelist certain external domains, in this case xtools.wmflabs.org. Or, we could rewrite the script to work entirely off of the MediaWiki APi, but this will make it much slower and we might have to lose some functionality.

MusikAnimal changed the task status from Open to Stalled.Jun 22 2021, 4:59 AM

Unactionable at this time.

Welp, T135963 looks pretty stalled to me, so at any rate we're not in trouble yet.

Change #1248574 had a related patch set uploaded (by Krinkle; author: Krinkle):

[operations/mediawiki-config@master] Allow toolforge APIs in enforced CSP mode

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

Change #1248574 merged by jenkins-bot:

[operations/mediawiki-config@master] Allow toolforge APIs in enforced CSP mode

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

Mentioned in SAL (#wikimedia-operations) [2026-03-05T19:56:49Z] <krinkle@deploy2002> Started scap sync-world: Backport for [[gerrit:1248574|Allow toolforge APIs in enforced CSP mode (T135963 T419137 T220475)]]

Mentioned in SAL (#wikimedia-operations) [2026-03-05T19:58:55Z] <krinkle@deploy2002> krinkle: Backport for [[gerrit:1248574|Allow toolforge APIs in enforced CSP mode (T135963 T419137 T220475)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2026-03-05T20:04:27Z] <krinkle@deploy2002> Finished scap sync-world: Backport for [[gerrit:1248574|Allow toolforge APIs in enforced CSP mode (T135963 T419137 T220475)]] (duration: 07m 37s)

@Krinkle Are we permanently allowlisted now or what? I do realize there's still T299855: XTools ArticleInfo gadget should not execute WMCS HTML which we can look into.

Of importance, the vast majority of uses of the XTools PageInfo gadget/endpoint are from end users loading it in their personal JS, which uses an HTML API, not JSON.

I've confirmed with Krinkle the gadget won't break (yet). But we should start moving things to the MediaWiki namespace, and properly gadget-ize it, similar to what was done for MoreMenu and Krinkle's RTRC gadgets. And also resolve T299855.

MusikAnimal changed the task status from Stalled to Open.Mar 5 2026, 9:05 PM
MusikAnimal raised the priority of this task from Low to Medium.