MediaWiki has already a framework for whitelists for image urls via MediaWiki system pages.
/** If $wgAllowExternalImages is false, you can allow an on-wiki
- whitelist of regular expression fragments to match the image URL
- against. If the image matches one of the regular expression fragments,
- The image will be displayed. *
- Set this to true to enable the on-wiki whitelist (MediaWiki:External image whitelist)
- Or false to disable it */
$wgEnableImageWhitelist = true;
Version: master
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=45857