r37721 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r37720‎ | r37721 | r37722 >
Date:21:45, 15 July 2008
Author:brion
Status:old
Tags:
Comment:
Reverting r37713 -- insufficient input validation is not a replacement for proper output escaping.
";alert(document.cookie);' is a perfectly valid title, but will still inject executable JavaScript into the output.
Modified paths:
  • /trunk/extensions/redircite/redircite.php (modified) (history)

Diff [purge]

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

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r37713Redircite: Validating $input. This should fix the HTML injection issue.catrope21:01, 15 July 2008

Status & tagging log