Last modified: 2010-05-15 15:52:03 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T12756, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 10756 - img_auth.php Does Not Protect Images if $wgWhitelistRead is Undefined
img_auth.php Does Not Protect Images if $wgWhitelistRead is Undefined
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
1.10.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-07-30 18:56 UTC by Norbert Hoeller
Modified: 2010-05-15 15:52 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Norbert Hoeller 2007-07-30 18:56:55 UTC
img_auth.php fails the image request if all of the conditions in the following statement are true.  If any condition is false, then the routine will allow the image to be loaded (unless caught by a later test).  Therefore, if $wgWhitelistRead is NOT defined, all image requests are allowed, even for users that are not logged in.

  if ( is_array( $wgWhitelistRead ) && !in_array( $imageName, $wgWhitelistRead ) && !$wgUser->getID() ) {


I believe the intent was to only check whether the imagename is in the whitelist if the whitelist exists.  The following statement captures this logic:

  if ( !( is_array( $wgWhitelistRead ) && in_array( $imageName, $wgWhitelistRead ) ) && !$wgUser->getID() ) {


I ran into this problem with cgi_img_auth.php, which was derived from img_auth.php, but did not include the comments about setting $wgWhitelistRead.  Although technically the documentation tells the user to create $wgWhitelistRead, accidentally deleting the whitelist array should not result in images being unprotected.
Comment 1 Rob Church 2007-08-06 06:16:43 UTC
Fixed in r24609.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links