Skip to content

Add setting controlling whether kml may come from outside the wiki - #931

Merged
JeroenDeDauw merged 1 commit into
masterfrom
kml-external-source-policy
Jul 31, 2026
Merged

Add setting controlling whether kml may come from outside the wiki#931
JeroenDeDauw merged 1 commit into
masterfrom
kml-external-source-policy

Conversation

@JeroenDeDauw

Copy link
Copy Markdown
Member

The default is true, keeping today's behaviour, since flipping it would break existing wikis on a
minor release. Whether to make false the default is your call, not something this PR decides.

gkml is deliberately left alone: google.maps.KmlLayer documents are fetched and rendered by
Google's servers rather than by the reader's browser, so neither the IP leak nor the NetworkLink
recursion applies to it.

The nesting limit on NetworkLink applies regardless of the setting, since an unbounded fetch loop
is a problem on its own.

AI-authored — Claude Code, Opus 5 (max); detailed spec from @JeroenDeDauw, no revisions; diff not yet human-reviewed; PHPUnit, phpcs and PHPStan run locally, QUnit run in a browser against production ResourceLoader, and each new test confirmed failing without its production change.

KML documents named by the `kml` parameter are fetched by the browser of everyone
viewing the map, so the host they come from learns every reader's IP address and
user agent, and can change what it serves after the edit was reviewed. A KML
document names further documents of its own through `NetworkLink` and `styleUrl`,
so the host need not appear in the wikitext at all.

`$egMapsAllowExternalKml` (and `general.allowExternalKml` on `MediaWiki:Maps`)
drops `kml` values that are not a file on the wiki, and, through the map data,
has geoxml3 fetch only same-origin documents.

It defaults to true, keeping today's behaviour, since changing it would break
existing wikis. Whether to flip that default is a separate decision.

`NetworkLink` elements are now followed at most three levels deep regardless of
the setting. geoxml3 had no limit, so a document linking back to itself made the
browser fetch in an unbounded loop.

`gkml` is left alone: `google.maps.KmlLayer` documents are fetched and rendered
by Google's servers, not by the reader's browser, so neither the IP leak nor the
recursion applies.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@JeroenDeDauw
JeroenDeDauw marked this pull request as ready for review July 31, 2026 00:45
@JeroenDeDauw
JeroenDeDauw merged commit 11a9994 into master Jul 31, 2026
16 checks passed
@JeroenDeDauw
JeroenDeDauw deleted the kml-external-source-policy branch July 31, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant