r86027 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86026‎ | r86027 | r86028 >
Date:07:10, 14 April 2011
Author:tstarling
Status:ok
Tags:
Comment:
(bug 28507) Fix for r85844: that revision was not actually sufficient to fix bug 28235, since URLs can have more than one question mark in them.
Modified paths:
  • /trunk/phase3/images/.htaccess (modified) (history)
  • /trunk/phase3/img_auth.php (modified) (history)
  • /trunk/phase3/includes/WebRequest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/images/.htaccess
@@ -1,6 +1,6 @@
22 # Protect against bug 28235
33 <IfModule rewrite_module>
44 RewriteEngine On
5 - RewriteCond %{QUERY_STRING} \.[a-z]{1,4}$ [nocase]
 5+ RewriteCond %{QUERY_STRING} \.[a-z0-9]{1,4}(#|\?|$) [nocase]
66 RewriteRule . - [forbidden]
77 </IfModule>
Index: trunk/phase3/includes/WebRequest.php
@@ -785,7 +785,7 @@
786786 global $wgScriptExtension;
787787
788788 if ( isset( $_SERVER['QUERY_STRING'] )
789 - && preg_match( '/\.[a-z]{1,4}$/i', $_SERVER['QUERY_STRING'] ) )
 789+ && preg_match( '/\.[a-z0-9]{1,4}(#|\?|$)/i', $_SERVER['QUERY_STRING'] ) )
790790 {
791791 // Bug 28235
792792 // Block only Internet Explorer, and requests with missing UA
Index: trunk/phase3/img_auth.php
@@ -40,7 +40,7 @@
4141
4242 // Check for bug 28235: QUERY_STRING overriding the correct extension
4343 if ( isset( $_SERVER['QUERY_STRING'] )
44 - && preg_match( '/\.[a-z]{1,4}$/i', $_SERVER['QUERY_STRING'] ) )
 44+ && preg_match( '/\.[a-z0-9]{1,4}(#|\?|$)/i', $_SERVER['QUERY_STRING'] ) )
4545 {
4646 wfForbidden( 'img-auth-accessdenied', 'img-auth-bad-query-string' );
4747 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r86028MFT r86027: fix IE6 XSS againtstarling07:12, 14 April 2011
r86030* MFT r86027: fix IE6 XSS again...tstarling07:14, 14 April 2011
r86031MFT r86027: fix IE6 XSS againtstarling07:15, 14 April 2011
r89397(bug 28840) If the query string hits bug 28235, redirect to a safer URL inste...tstarling05:32, 3 June 2011
r89558* Added a REQUEST_URI check to the bug 28235 handling....tstarling11:59, 6 June 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r85844Fix for bug 28235: IE6 looks for the file extension in the query stringtstarling00:55, 12 April 2011
r85845MFT r85844, fix for bug 28235 (IE6 looks for the file extension in the query ...tstarling01:07, 12 April 2011
r85846MFT r85844, fix for bug 28235 (IE6 looks for the file extension in the query ...tstarling01:15, 12 April 2011

Status & tagging log