Page MenuHomePhabricator

Restore loading of graphs from URL for Wikimedia allowed domains
Closed, DeclinedPublic

Description

As part of the upgrades to the Graph extension, we temporarily removed the ability to load graphs from a URL with the goal of restoring support to some graphs on Wikimedia servers. This task encompasses all work to restore graphs. This work will be prioritized based on number of graphs impacted (e.g. error rate in production)

In Wikimedia we only support geoshape (from maps.wikimedia.org), wikidatasparql (from query.wikidata.org) and wikirawupload (from upload.wikimedia.org)

These were originally defined here: https://github.com/nyurik/mw-graph-shared

TODO

  • Restore loading of URLs from trusted domains. An attempt to render a graph from an untrusted domain will render an error.
  • Explicitly disallow http by default
  • Restore loading of graphs from the wikidatasparql:// protocol
  • Restore loading of graphs from the geoshape:// protocol
  • Restore loading of graphs from the wikiraw:// protocol

Sign off steps

The Graph extension previously supported other protocols. Understand the usage of these and how and if to restore these for 3rd parties if needed.

  • Restore loading of graphs from the wikiapi:// protocol
  • Restore loading of graphs from the wikirest:// protocol
  • Restore loading of graphs from the tabular:// protocol
  • Restore loading of graphs from the map:// protocol
  • Restore loading of graphs from the wikifile:// protocol
  • Restore loading of graphs from the geoline// protocol
  • Restore loading of graphs from the mapsnapshot:// protocol

References

  • @colt_browning: "...it would be great to eventually enable map: and tabular://. We use them in ru:Template:SkyMap (8000+ transclusions)." | source
  • @RobinLeicester: "OSM Location map is working fine on the Beta site by using direct file addressing at the moment, but if that is not suitable for final release, it will be looking for access to maps.wikimedia.org/img/ and to commons images (currently accessed using filepath..." | source
  • @Snaevar: "On protocols, there are 4 modules I am aware of that are going or have gone trough vega2to5 changes. Module:Statistical on ruwiki did not use protocols prior to the change and does not do so now. The other three Module:Graph, Template:Graph:Lines and "Template:OSM Location map" are all waiting on the protocols. Not sure how much clearer that can be." | source

Related Objects

StatusSubtypeAssignedTask
OpenBUG REPORTCCiufo-WMF
ResolvedSecurityJdlrobson
DuplicateNone
OpenNone
StalledJdlrobson
ResolvedTheDJ
StalledNone
StalledBUG REPORTNone
StalledNone
DeclinedNone
OpenFeatureJdlrobson
ResolvedBawolff
DeclinedNone
DeclinedNone
DeclinedNone
Resolved Jseddon
ResolvedJdlrobson
ResolvedJdlrobson
Resolvedsbassett
ResolvedFeatureJdlrobson
DeclinedFeatureNone
DeclinedJdlrobson
OpenNone

Event Timeline

Change 910613 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/Graph@master] Allow URLs that match the allowed domains

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

Change 910613 merged by jenkins-bot:

[mediawiki/extensions/Graph@master] Allow URLs that match the allowed domains

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

Change 912228 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/extensions/Graph@master] Fix URL sanitization

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

Change 912228 merged by jenkins-bot:

[mediawiki/extensions/Graph@master] Fix URL sanitization

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

Change 912422 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/Graph@master] WIP: Restore wikidatasparql support

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

Change 912428 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/Graph@master] WIP: Restore wikirest schema

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

Change 912429 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/Graph@master] WIP: Restore Wikiraw schema

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

Change 912958 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/Graph@master] Subdomains should be trusted

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

Change 912958 merged by jenkins-bot:

[mediawiki/extensions/Graph@master] Subdomains should be trusted

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

Change 912429 abandoned by Jdlrobson:

[mediawiki/extensions/Graph@master] WIP: Restore Wikiraw schema

Reason:

Merging into a239ec3069650a118818922ae676a34acfc3ac4c

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

Change 912422 abandoned by Jdlrobson:

[mediawiki/extensions/Graph@master] WIP: Restore wikidatasparql support

Reason:

Merging into Ia239ec3069650a118818922ae676a34acfc3ac4c

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

Change 913984 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/extensions/Graph@master] Add $wgGraphAllowHttp

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

Change 912428 abandoned by Jdlrobson:

[mediawiki/extensions/Graph@master] Restore custom protocols, mapping to https equivalent

Reason:

I will circle back to this when we have data indicating we need to prioritize this.

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

Change 913984 merged by jenkins-bot:

[mediawiki/extensions/Graph@master] Add $wgGraphAllowHttp

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

Jdlrobson lowered the priority of this task from High to Low.May 4 2023, 12:31 AM

We are making good progress with using https and action=raw.

See this as an example of migrating wikirest to https: https://www.mediawiki.org/w/index.php?title=Template:Graph:PageViews&action=history

I am getting a CORS error on https://mediawiki.org/wiki/Template:Graph:Lines for the first graph. The graph is supposed to get datapoints from Wikimedia Commons using the https method. Browser: Firefox 113.0 on Win10. I am not seeing an error on Template:Graph:PageViews on the same website.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://commons.wikimedia.org/w/index.php?title=Data:bls.gov/US%20Women%27s%20weekly%20earnings%20as%20a%20percent%20of%20men%27s%20by%20age,%20annual%20averages.tab&action=raw&ctype=application/json. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.

I am getting a CORS error on https://mediawiki.org/wiki/Template:Graph:Lines for the first graph. The graph is supposed to get datapoints from Wikimedia Commons using the https method. Browser: Firefox 113.0 on Win10. I am not seeing an error on Template:Graph:PageViews on the same website.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://commons.wikimedia.org/w/index.php?title=Data:bls.gov/US%20Women%27s%20weekly%20earnings%20as%20a%20percent%20of%20men%27s%20by%20age,%20annual%20averages.tab&action=raw&ctype=application/json. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.

Yeah, I think we forgot that you can't do cross domain requests using action=raw... See also origin= param on api.php

Pseudo-protocols and CORS workaround doesn't work on beta.wmflabs for Wikimedia REST API.

Error: The host wikimedia.org is not in the list of trusted domains for the protocol https:

please add wikimedia.org to "GraphAllowedDomains" to "https"