Page MenuHomePhabricator

Re-enable core's preload feature for certain non-wikitext content types
Closed, ResolvedPublic

Description

Since T297725: <inputbox> extension should not be allowed to touch .js sub-pages MediaWiki core's preload feature can not be used on non-wikitext pages any more. This was intentionally done with a minimal allow-list in mind, for security reasons. Other content types can be added when the need arises.

Comments suggest that doing anything malicious in the Lua/Module namespace is not possible. While rare, useful applications exist. Therefor the two prove-of-concept patches https://gerrit.wikimedia.org/r/752625 and https://gerrit.wikimedia.org/r/752626 suggest to re-enable the feature for pages with the JSON as well as Lua/Module content model.

Possible questions to discuss:

  • Do we have reasons to not allow preloading Lua code?
  • The patches suggest an addition to the ContentHandler interface, which is already quite convoluted. Can we come up with something better?
  • …

Event Timeline

Change 752625 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/core@master] Add new ContentHandler::supportsPreloadContent() feature

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

Change 752626 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Scribunto@master] Add new ContentHandler::supportsPreloadContent() feature

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

Change 752625 merged by jenkins-bot:

[mediawiki/core@master] Add new ContentHandler::supportsPreloadContent() feature

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

Change 752626 merged by jenkins-bot:

[mediawiki/extensions/Scribunto@master] Use new ContentHandler::supportsPreloadContent() feature

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

matmarex assigned this task to thiemowmde.