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

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
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