r87484 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87483‎ | r87484 | r87485 >
Date:05:33, 5 May 2011
Author:tstarling
Status:ok
Tags:
Comment:
* Fix for bug 28534: IE 6 content type detection again
* Fix for bug 28639: user object instance cache pollution
* Updates for release of 1.16.5
Modified paths:
  • /branches/REL1_16/phase3/RELEASE-NOTES (modified) (history)
  • /branches/REL1_16/phase3/images/.htaccess (modified) (history)
  • /branches/REL1_16/phase3/img_auth.php (modified) (history)
  • /branches/REL1_16/phase3/includes/DefaultSettings.php (modified) (history)
  • /branches/REL1_16/phase3/includes/User.php (modified) (history)
  • /branches/REL1_16/phase3/includes/WebRequest.php (modified) (history)

Diff [purge]

Index: branches/REL1_16/phase3/images/.htaccess
@@ -1,6 +1,6 @@
22 # Protect against bug 28235
33 <IfModule rewrite_module>
44 RewriteEngine On
5 - RewriteCond %{QUERY_STRING} \.[a-z0-9]{1,4}(#|\?|$) [nocase]
 5+ RewriteCond %{QUERY_STRING} \.[^\\/:*?\x22<>|%]+(#|\?|$) [nocase]
66 RewriteRule . - [forbidden]
77 </IfModule>
Index: branches/REL1_16/phase3/includes/User.php
@@ -897,24 +897,25 @@
898898 }
899899
900900 $passwordCorrect = FALSE;
901 - $this->mId = $sId;
902 - if ( !$this->loadFromId() ) {
903 - # Not a valid ID, loadFromId has switched the object to anon for us
 901+ $proposedUser = User::newFromId( $sId );
 902+ if ( !$proposedUser->isLoggedIn() ) {
 903+ # Not a valid ID
 904+ $this->loadDefaults();
904905 return false;
905906 }
906907
907908 global $wgBlockDisablesLogin;
908 - if( $wgBlockDisablesLogin && $this->isBlocked() ) {
 909+ if( $wgBlockDisablesLogin && $proposedUser->isBlocked() ) {
909910 # User blocked and we've disabled blocked user logins
910911 $this->loadDefaults();
911912 return false;
912913 }
913914
914915 if ( isset( $_SESSION['wsToken'] ) ) {
915 - $passwordCorrect = $_SESSION['wsToken'] == $this->mToken;
 916+ $passwordCorrect = $proposedUser->getToken() === $_SESSION['wsToken'];
916917 $from = 'session';
917918 } else if ( isset( $_COOKIE["{$wgCookiePrefix}Token"] ) ) {
918 - $passwordCorrect = $this->mToken == $_COOKIE["{$wgCookiePrefix}Token"];
 919+ $passwordCorrect = $proposedUser->getToken() === $_COOKIE["{$wgCookiePrefix}Token"];
919920 $from = 'cookie';
920921 } else {
921922 # No session or persistent login cookie
@@ -922,7 +923,8 @@
923924 return false;
924925 }
925926
926 - if ( ( $sName == $this->mName ) && $passwordCorrect ) {
 927+ if ( ( $sName === $proposedUser->getName() ) && $passwordCorrect ) {
 928+ $this->loadFromUserObject( $proposedUser );
927929 $_SESSION['wsToken'] = $this->mToken;
928930 wfDebug( "Logged in from $from\n" );
929931 return true;
@@ -935,6 +937,18 @@
936938 }
937939
938940 /**
 941+ * Load the data for this user object from another user object.
 942+ */
 943+ protected function loadFromUserObject( $user ) {
 944+ $user->load();
 945+ $user->loadGroups();
 946+ $user->loadOptions();
 947+ foreach ( self::$mCacheVars as $var ) {
 948+ $this->$var = $user->$var;
 949+ }
 950+ }
 951+
 952+ /**
939953 * Load user and user_group data from the database.
940954 * $this::mId must be set, this is how the user is identified.
941955 *
Index: branches/REL1_16/phase3/includes/WebRequest.php
@@ -697,7 +697,7 @@
698698 global $wgScriptExtension;
699699
700700 if ( isset( $_SERVER['QUERY_STRING'] )
701 - && preg_match( '/\.[a-z0-9]{1,4}(#|\?|$)/i', $_SERVER['QUERY_STRING'] ) )
 701+ && preg_match( '/\.[^\\/:*?"<>|%]+(#|\?|$)/i', $_SERVER['QUERY_STRING'] ) )
702702 {
703703 // Bug 28235
704704 // Block only Internet Explorer, and requests with missing UA
Index: branches/REL1_16/phase3/includes/DefaultSettings.php
@@ -33,7 +33,7 @@
3434 }
3535
3636 /** MediaWiki version number */
37 -$wgVersion = '1.16.4';
 37+$wgVersion = '1.16.5';
3838
3939 /** Name of the site. It must be changed in LocalSettings.php */
4040 $wgSitename = 'MediaWiki';
Index: branches/REL1_16/phase3/img_auth.php
@@ -39,7 +39,7 @@
4040
4141 // Check for bug 28235: QUERY_STRING overriding the correct extension
4242 if ( isset( $_SERVER['QUERY_STRING'] )
43 - && preg_match( '/\.[a-z0-9]{1,4}(#|\?|$)/i', $_SERVER['QUERY_STRING'] ) )
 43+ && preg_match( '/\.[^\\/:*?"<>|%]+(#|\?|$)/i', $_SERVER['QUERY_STRING'] ) )
4444 {
4545 wfForbidden( 'img-auth-accessdenied', 'img-auth-bad-query-string' );
4646 }
Index: branches/REL1_16/phase3/RELEASE-NOTES
@@ -1,10 +1,10 @@
22 = MediaWiki release notes =
33
4 -== MediaWiki 1.16.4 ==
 4+== MediaWiki 1.16.5 ==
55
6 -2011-04-14
 6+2011-05-05
77
8 -This is a security and maintenance release of the MediaWiki 1.16 branch.
 8+This is a security release of the MediaWiki 1.16 branch.
99
1010 === Summary of selected changes in 1.16 ===
1111
@@ -44,6 +44,13 @@
4545 you have the DBA extension for PHP installed, this will improve performance
4646 further.
4747
 48+== Changes since 1.16.4
 49+
 50+* (bug 28534) Fixed XSS vulnerability for IE 6 clients. This is the third
 51+ attempt at fixing bug 28235.
 52+* (bug 28639) Fixed potential privilege escalation when $wgBlockDisablesLogin
 53+ is enabled.
 54+
4855 == Changes since 1.16.3 ==
4956
5057 * (bug 28507) The change we made in 1.16.3 to fix bug 28235 (XSS for IE 6

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r87482* Fix for bug 28534: IE 6 content type detection again...tstarling05:29, 5 May 2011
r87483* Fix for bug 28534: IE 6 content type detection again...tstarling05:31, 5 May 2011

Status & tagging log