r37713 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r37712‎ | r37713 | r37714 >
Date:21:01, 15 July 2008
Author:catrope
Status:old
Tags:
Comment:
Redircite: Validating $input. This should fix the HTML injection issue.
Modified paths:
  • /trunk/extensions/redircite/redircite.php (modified) (history)

Diff [purge]

Index: trunk/extensions/redircite/redircite.php
@@ -1,7 +1,5 @@
22 <?php
33
4 -die("redircite extension disabled -- contains HTML injection vulnerabilities.");
5 -
64 /**
75 * This program is free software; you can redistribute it and/or modify
86 * it under the terms of the GNU General Public License as published by
@@ -50,11 +48,15 @@
5149 // which will be translated to the HTML stored in $redirciteMarkerList by
5250 // redircite_afterTidy()
5351 global $redirciteMarkerList;
 52+ # Verify that $input is a valid title
 53+ $inputTitle = Title::newFromText($input);
 54+ if(!$inputTitle)
 55+ return $input;
5456 $lparse = clone $parser;
5557 $link1 = $lparse->parse("[[$input]]", $parser->mTitle, $parser->mOptions, false, false);
5658 $link1text = $link1->getText();
5759 $title1 = Title::newFromText($input);
58 - if(!$title1) // Page doesn't exist
 60+ if(!$title1->exists()) // Page doesn't exist
5961 // Just output a normal (red) link
6062 return $link1text;
6163 $articleObj = new Article($title1);

Follow-up revisions

RevisionCommit summaryAuthorDate
r37721Reverting r37713 -- insufficient input validation is not a replacement for pr...brion21:45, 15 July 2008

Status & tagging log