r96937 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96936‎ | r96937 | r96938 >
Date:01:53, 13 September 2011
Author:bawolff
Status:ok
Tags:
Comment:
Fix XSS in this extension.

There's more scary looking code in here, but nothing from a (very very very) brief look that's an actual vulnrability that I can see.
Modified paths:
  • /trunk/extensions/Piwik/Piwik.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Piwik/Piwik.php
@@ -51,6 +51,8 @@
5252 } else {
5353 $wgPiwikFinalActionName = $wgPiwikActionName;
5454 }
 55+ // Stop xss since page title's can have " and stuff in them.
 56+ $wgPiwikFinalActionName = Xml::encodeJsVar( $wgPiwikFinalActionName );
5557 $funcOutput = <<<PIWIK
5658 <!-- Piwik -->
5759 <script type="text/javascript">
@@ -63,7 +65,7 @@
6466 /* <![CDATA[ */
6567 try {
6668 var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", {$wgPiwikIDSite});
67 -piwikTracker.setDocumentTitle("{$wgPiwikFinalActionName}");
 69+piwikTracker.setDocumentTitle({$wgPiwikFinalActionName});
6870 piwikTracker.setIgnoreClasses("image");
6971 {$wgPiwikCustomJS}
7072 piwikTracker.trackPageView();

Status & tagging log