Stop messages like
<!-- Saved in parser cache with key wiki:pcache:idhash:9999-0!*!0!!en!*!* and timestamp 20180627230404 and revision id 9999
-->
from appearing in the rendered page source for your MediaWiki articles.
This was identified as a potential liability during an internal security review within my organization, and we were asked to suppress this output if possible.
As there is no LocalSettings.php
option (similar to
$wgEnableParserLimitReporting
for the NewPP parser report which is
also rendered as an HTML comment), patching the source was the only option
I could figure out.
THIS_GIST=https://gist.githubusercontent.com/ernstki/1c897946cfa6dd84065e1e313a9f6376
cd /path/to/where/your/mediawiki/installation/is
curl -sLOJ $THIS_GIST/raw/parsercache-disable-pcache-key-in-html-source.diff
patch -p0 <parsercache-disable-pcache-key-in-html-source.diff
Then keep that parsercache-disable-pcache-key-in-html-source.diff
file
around, because you're going to have to re-apply this patch every time you
update to a new MediaWiki release (or file a bug report so that there's
a config setting for it).
If (or when) the patch file stops working in the future, you'll get a message
from patch
about some number of "hunks" being
rejected. If this happens, you can make a backup copy of the original, modify
the source manually by looking at includes/parser/ParserCache.php
(around
line 297), then recreate the patch file like so:
cd /path/to/your/mediawiki
cp includes/parser/ParserCache.php includes/parser/ParserCache.php.orig
vim includes/parser/ParserCache.php # or your editor of choice
diff -u includes/parser/ParserCache.php.orig \
includes/parser/ParserCache.php >disable-pcache-key-in-html-source.diff