r1230 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r1229‎ | r1230 | r1231 >
Date:15:54, 13 March 2003
Author:vibber
Status:old
Tags:
Comment:
Fix XSS bugs in sql access (if you trust your sysops -- and they never accidentally follow links -- no prob
Modified paths:
  • /trunk/phpwiki/newcodebase/OutputPage.php (modified) (history)
  • /trunk/phpwiki/newcodebase/SpecialAsksql.php (modified) (history)

Diff [purge]

Index: trunk/phpwiki/newcodebase/SpecialAsksql.php
@@ -84,7 +84,7 @@
8585
8686 $r = "<table border=1 bordercolor=black cellspacing=0 " .
8787 "cellpadding=2><tr>\n";
88 - foreach ( $k as $x ) $r .= "<th>{$x}</th>";
 88+ foreach ( $k as $x ) $r .= "<th>" . htmlspecialchars( $x ) . "</th>";
8989 $r .= "</tr>\n";
9090
9191 foreach ( $a as $y ) {
@@ -92,8 +92,11 @@
9393 foreach ( $k as $x ) {
9494 $o = $y->$x ;
9595 if ( $x == "cur_title" or $x == "old_title" ) {
96 - $o = str_replace ( "$1" , $o , $wgArticlePath ) ;
97 - $o = "<a href=\"{$o}\" class='internal'>{$y->$x}</a>" ;
 96+ $o = str_replace ( "$1" , rawurlencode( $o ) , $wgArticlePath ) ;
 97+ $o = "<a href=\"{$o}\" class='internal'>" .
 98+ htmlspecialchars( $y->$x ) . "</a>" ;
 99+ } else {
 100+ $o = htmlspecialchars( $o );
98101 }
99102 $r .= "<td>" . $o . "</td>\n";
100103 }
Index: trunk/phpwiki/newcodebase/OutputPage.php
@@ -528,10 +528,10 @@
529529 $this->setRobotpolicy( "noindex,nofollow" );
530530 $this->setArticleFlag( false );
531531
532 - $msg = str_replace( "$1", wfLastDBquery(), wfMsg( "dberrortext" ) );
533 - $msg = str_replace( "$2", $fname, $msg );
 532+ $msg = str_replace( "$1", htmlspecialchars( wfLastDBquery() ), wfMsg( "dberrortext" ) );
 533+ $msg = str_replace( "$2", htmlspecialchars( $fname ), $msg );
534534 $msg = str_replace( "$3", wfLastErrno(), $msg );
535 - $msg = str_replace( "$4", wfLastError(), $msg );
 535+ $msg = str_replace( "$4", htmlspecialchars( wfLastError() ), $msg );
536536
537537 $sk = $wgUser->getSkin();
538538 $shlink = $sk->makeKnownLink( wfMsg( "searchhelppage" ),

Status & tagging log