Skip to content

Allow external kml and geojson files from an allowlist of hosts #945

Open

Description

@kghbln

Since 15.0.0 the kml and geojson parameters load only files that are on the wiki, unless $egMapsAllowExternalDataFiles is set to true, which allows any URL again. Wikis that depend on one or two trusted sources, such as an open-data portal or their own file server, have no middle ground: they either lose those maps or accept every host.

Proposal

A setting that lists the hosts external data files may come from, for example:

$egMapsAllowedDataFileHosts = [ 'data.example.org', '*.geo.example.net' ];
  • A URL in kml or geojson loads if $egMapsAllowExternalDataFiles is true, as now, or if its host matches the list. The default is an empty list, so nothing changes for existing wikis.
  • Entries are host names, and a leading *. covers subdomains.
  • The list applies to both paths: KML fetched by the viewer's browser and GeoJSON fetched by the server. The existing server-side safeguards, blocked private address ranges and pinned DNS, stay in force for listed hosts, and a redirect to a host outside the list is not followed.
  • NetworkLink elements inside a KML document follow the same list.
  • MediaWiki:Maps gets a counterpart, general.allowedDataFileHosts, like the other settings.

MediaWiki core has the same pattern in $wgCopyUploadsDomains for upload by URL, whose matching rules could be reused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions