Commit graph

117 commits

Author SHA1 Message Date
Ladsgroup
1ba0445c12 Changing URLs of mediawiki.org in scripts to the SSL-based website
http://www.mediawiki.org --> https://www.mediawiki.org

Part 2

Change-Id: I3be61fe3dfb502cc20180486eb1a8016eac151df
2014-03-12 23:24:03 +00:00
Aaron Schulz
befff4f2ef SECURITY: Added missing auth check in img_auth.php
For $wgImgAuthUrlPathMap in img_auth.php

Bug: 57016
Change-Id: I874878322a91bf14091500223d3520861a1556bb
2014-01-13 22:07:59 -08:00
Aaron Schulz
0eb5239968 Added support to img_auth.php for non-repo containers
* This adds a new $wgImgAuthUrlPathMap config variable
* Also fixed ImgAuthBeforeStream hook msg formatting

bug: 51136
Change-Id: I77528f92b20670e3b09adc79c49e62060f1614f3
2013-12-04 00:56:03 +00:00
Timo Tijhof
beb1c4a0ec phpcs: More require/include is not a function
Follows-up I1343872de7, Ia533aedf63 and I2df2f80b81.

Also updated usage in text in documentation and the
installer LocalSettingsGenerator.

Most of them were handled by this regex:
- find: (require|include|require_once|include_once)\s*\(\s*(.+?)\s*\)\s*;$
- replace: $1 $2;

Change-Id: I6b38aad9a5149c9c43ce18bd8edbab14b8ce43fa
2013-05-21 23:26:28 +02:00
Yuri Astrakhan
81551c2692 cleanup: variable referenced without initialization
declared so that IDE knows how to use it and initialized

Change-Id: I4841fd3f03220f837c981951f07c1c21ddbd76af
2013-05-15 00:43:00 +00:00
Tim Starling
1fe9340bb3 Remove hphpc support and deprecate related functions
hphpc has been superseded by hhvm, so support for hphpc is no longer
needed.

* Continue to use Preprocessor_Hash under HipHop since it is still
  faster under hhvm
* Keep $wgCompiledFiles for now, so that wikihiero doesn't give an error
  before Ic9d1e795 is merged
* Migrate the run-server script and associated configuration file to
  hhvm. Enable EnableStaticContentFromDisk since it doesn't seem
  ridiculously inefficient at first glance. Run from $IP rather than
  $IP/.. since hhvm is apparently not picky about sourcing files from
  outside of the current directory.

Change-Id: Ic3e769f1fbad4f7ad26dd819406796fee48c6b45
2013-05-09 08:28:05 +10:00
Siebrand Mazeland
655f5c6b48 Update code formatting
Change-Id: I8741b5b979e55f38a666961a16c387586a92410e
2013-02-14 13:38:19 +00:00
Antoine Musso
7006e1df93 style: fix up commas in function arguments
Fix up spaces in our function calls, we do not want spaces before a
comma and try to avoid multiple commas whenever possible.

Errors:

* No space found after comma in function call
* Space found before comma in function call

Change-Id: I51aec02016f742422fa60b92ad35ba3f0ef59ba3
2013-02-06 19:30:39 +01:00
Aaron Schulz
c43deebfd5 Simplified thumb.php for 404 handling.
* Made thumb_handler.php "just work" in a way similar to img_auth.
  It no longer needs any "handlerUrl" setting to be set.

Change-Id: I557ba1f94db3cef0f21f5c0e2b60d8e381ea3f96
2012-11-08 17:31:05 +11:00
jeroendedauw
38c7f444e1 Use __DIR__ instead of dirname( __FILE__ )
We can now do this since we finally switched to PHP 5.3 for MW 1.20 and get rid of the silly dirname(__FILE__) stuff :)

Change-Id: Id9b2c9cd2e678197aa81c78adced5d1d31ff57b1
2012-08-27 21:45:00 +02:00
Siebrand Mazeland
e4321e3e66 Replace deprecated wfMsg* calls with Message class calls.
Doing this in steps of roughly 100 changes per commit, so that it remains
reviewable.

Change-Id: Ie349afa5c809c887c787c7c04c49c9dd3478ccac
2012-08-22 21:04:12 +02:00
Alexandre Emsenhuber
f27ff698fb Added missing GPLv2 headers in some places.
Also made file documentation more consistent.

Change-Id: I30e124514396f110a572467b94ca06cefd5f7b46
2012-05-23 13:41:30 +02:00
Aaron
779f2243db Fixed use of undefined FILES_ONLY constant.
Change-Id: Icc924785cdb394adc723666bf9f6a67e9d6a4d0d
2012-04-11 11:47:15 -07:00
Platonides
9951f9f9ae trunk/phase3 is now mediawiki/core
Change-Id: Ief2721ee6573a5e54a276c91de636d9e1a678b8b
2012-03-23 17:19:22 +01:00
Sam Reed
8e78fbe32b Cleanup a few unused globals 2012-02-16 02:35:48 +00:00
Mark A. Hershberger
2d72930472 w/s 2012-02-07 13:05:31 +00:00
Tim Starling
d74aac3510 * Fix for r81363: instead of giving a PHP notice when PATH_INFO is missing, show the informative error message used before that revision.
* Revert the change to the relevant message made in r102612: it is plain text, not wikitext, a format which does not support protocol-relative URLs.
2012-02-07 03:43:23 +00:00
Aaron Schulz
5275f9b097 Merged FileBackend branch. Manually avoiding merging the many prop-only changes SVN likes to sprinkle in (easy to spot from the change list). Did not add SwiftFileBackend.php as it still is in development. 2011-12-20 03:52:06 +00:00
Robin Pepermans
be2de16942 update all core usage of deprecated Title::userCanRead() 2011-12-13 11:05:30 +00:00
Aaron Schulz
cb399e076d Reverted r105208 per CR 2011-12-06 18:48:48 +00:00
Aaron Schulz
f8d6b31bee FU r104216: keep the r103738 regex check for thumbnails but use the parent directory as the source file name. This avoids the assumption that the thumb URL starts with /thumb. 2011-12-05 19:17:44 +00:00
Aaron Schulz
22c5655da3 FU r103738: redid the method of getting the source file name for thumbnails altogether, using suggestion per CR. 2011-11-25 02:21:46 +00:00
Daniel Friesen
ae1d5aefbf Update img_auth.php and WebRequest code to handle non index.php scripts like img_auth.php better.
Also update img_auth.php so it's abuse of $wg variables is done in a way that doesn't let "/*" action paths clobber it's handling.
This should theoretically fix bug 32486.
2011-11-24 09:55:33 +00:00
Aaron Schulz
e0da5c113c image_auth.php cleanups:
* Factored main code into wfImageAuthMain()
* Made preg_match() for $name account for "page3-" type specifiers in the thumb name
* Code style cleanups
2011-11-20 08:50:13 +00:00
Sam Reed
d90b987ade Fix whitespace, braces
Fix return items
2011-10-15 22:58:42 +00:00
Chad Horohoe
1a1e917c86 Move wfStreamFile() into a class, update all callers in core (only 3 extensions use it afaict), leave wfStreamFile() as a b/c alias for now.
Yay less global functions, autoloading and less manual require()s.
2011-08-13 19:03:51 +00:00
Sam Reed
6ab399208a * (bug 29531) r89628 breaks img_auth.php
Apply Tims strpos -> strrpos fix, confirmed to work by bug reporter
2011-06-30 01:44:11 +00:00
Tim Starling
f3f1fcdc2c * Added a REQUEST_URI check to the bug 28235 handling.
* Moved most of the bug 28235 code out to a separate library class, since I was running out of distinct function names. 
* Merged the QUERY_STRING and PATH_INFO security checks, since they are dealing with the exact same problem. Removed WebRequest::isQueryStringBad(). 
* Deal with img_auth.php by having it specify what extension it expects to be streaming out. This extension can then be compared with the extension that IE might detect.
2011-06-06 11:59:20 +00:00
Tim Starling
a9b9efecb4 * Only blacklist query string extensions which match /^[a-zA-Z0-9_-]+$/. This avoids blacklisting pretty much every api.php URL with a dot in it, due to extensions like "webm&smaxage=3600&maxage=3600&format=jsonfm" being detected. Such an extension is unlikely to be registered to a dangerous file type. The proposed regex matches all extensions registered in HKEY_CLASSES_ROOT on my Windows XP VM, but does not include the ampersand, so avoids matching multiple URL parameters.
* Fixed a logic error in WebRequest::isPathInfoBad() from r88883, which caused dangerous PATH_INFO strings to be allowed as long as QUERY_STRING was set.
* Refactored the query string checks in WebRequest and img_auth.php into a single new function: isQueryStringBad().
2011-06-01 02:01:59 +00:00
Tim Starling
ff1dc8a175 HipHop improvements:
* Added the ability to compile extensions. The build process is bootstrapped by running MediaWiki in interpreted mode. Extension setup file inclusions are slightly modified in a way that makes them register themselves for compilation. Then the same LocalSettings.php uses the compiled extension setup file when the compiled binary runs.
* Tested with Cite and ParserFunctions. The code which lets you have an extensions directory in a place other than $IP/../extensions is untested.
* Simplified WebStart.php slightly by using a custom $_SERVER variable to mark compiled mode. It will break if you don't use the supplied server.conf, but that will break a lot of things so don't do that.
* Fixed the core web entry points to include WebStart.php in compiled mode instead of interpreted.
* Made the build directory configurable. This is mostly so that I can grep the source tree without seeing loads of generated C++.
* In server.conf, added a rewrite rule allowing a /wiki/$1 article path.
* Removed server.conf log file location "/dev/stdout", breaks when you switch user
* Disable static content cache, breaks horribly when you set SourceRoot to a directory containing 7GB of files.
* Rewrote the run-server script in PHP, mostly to support the configurable build directory feature.
* Added an option to the run-server script to allow running in interpreted (hphpi) mode.
2011-05-30 13:49:09 +00:00
Tim Starling
1db9197660 * Fix for bug 28534: IE 6 content type detection again
* Fix for bug 28639: user object instance cache pollution
* Release notes formatting tweak.
2011-05-05 05:29:50 +00:00
Tim Starling
7aeb423a6e (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. 2011-04-14 07:10:59 +00:00
Tim Starling
3ef857fe4d Fix for bug 28235: IE6 looks for the file extension in the query string 2011-04-12 00:55:10 +00:00
Mark A. Hershberger
9de57fff82 * Remove last bit of code that uses PATH_INFO from img_auth.php so that people who want to use protected images on hosts with sadly mis-shapen PHPs (e.g. GoDaddy) can.
* Mangle PATH_INFO handler in WebRequest so that all the relevant bits are in a (couple of) static functions.
2011-02-02 01:08:15 +00:00
Mark A. Hershberger
a2ec67cfb5 Whitespace cleanup 2011-02-01 23:08:10 +00:00
Bryan Tong Minh
8008372fc6 Follow-up r65652: Do not double-slash the path if it came from PATH_INFO 2010-12-12 15:50:25 +00:00
Chad Horohoe
5fde23e6ac Use WebRequest here too 2010-08-11 12:21:49 +00:00
Daniel Kinzler
f493b02c61 allow img_auth.php to use path= in place of PATH_INFO, so it can be used in CGI mode. Use with RewriteRule ^/w/images/(.*)$ /w/img_auth.php?path=bell-style 2010-04-29 10:32:18 +00:00
Tim Starling
83793144b4 Don't call User::getGroupPermissions() unless $wgImgAuthPublicTest==true. Efficiency measure suggested by ans-fox. 2009-10-14 06:54:21 +00:00
Jack D. Pond
5b11841d48 Cleaned up img_auth code and re-integrated core img-auth- messages. 2009-09-10 21:12:55 +00:00
Brion Vibber
2f86970bd3 Revert r55800 "bug 19646 Localization of img_auth.php - with enhancements"
The localization code here is really ugly with weird things like call_user_func_array() all over the place, and there are bugs with escaping for log entries and such.

Tried to rebuild all the localization files, but rebuildLanguage.php doesn't seem to consider the messages as "unknown". Have removed from English and qqq.
2009-09-08 18:07:29 +00:00
Jack D. Pond
81fad6027c bug 19646 Localization of img_auth.php - with enhancements
https://bugzilla.wikimedia.org/show_bug.cgi?id=19646

1. Localize img_auth.php using core messages
2. Reorder checks to make sense (and eliminate redundancy)n
3. Add hook 'ImgAuthBeforeStream' to allow custom checking
4. Add globals wgImgAuthDetails, 
5. Move all "wfDebugLog" into the rejection functions
2009-09-04 02:44:05 +00:00
Chad Horohoe
7003558057 (bug 18394) img_auth.php now respects userCan 2009-07-03 20:06:01 +00:00
Alexandre Emsenhuber
ce9c8bf686 Same as r48631; added "@file" when needed, also added doc in redirect.php and install-utils.inc 2009-03-21 16:48:09 +00:00
Ilmari Karonen
34fb6297cd Step 2 in NS_IMAGE -> NS_FILE transition (bug 44) (WARNING: huge commit).
This is a global search and replace of NS_IMAGE and NS_IMAGE_TALK with NS_FILE and NS_FILE_TALK respectively in all core files, excluding those already updated in step 1 (r44004).
2008-12-01 17:14:30 +00:00
Andrew Garrett
c06afd56b3 Revert "Follow up on r43982. Reduce dirname(__FILE__) calls in core and extensions."
Uses $dir in extension files, and assumes that it remains unchanged in require_once( 'maintenance/commandLine.inc' ).
In fact, it is likely that '$dir' will be set when setting up command-line, as some extensions will use the same var.

Recommended fix: Use $CentralAuth_dir, $EmailPage_dir, etc.
2008-11-30 03:15:22 +00:00
Siebrand Mazeland
daaa7f37a1 Follow up on r43982. Reduce dirname(__FILE__) calls in core and extensions. 2008-11-26 23:17:15 +00:00
Tim Starling
6b5143fd2c Protect users from attacks against their browsers via malicious script-containing uploads, by:
1) Requiring a session token before streaming files out via Special:Undelete
2) Restricting img_auth.php to private wikis only (its intended use case)
2008-11-18 05:57:08 +00:00
Tim Starling
6b5e2f5f0b Send Cache-Control: private and Vary headers in img_auth.php. 2007-11-03 02:38:40 +00:00
Rob Church
2062e9508f * Fix img_auth.php image name extraction for whitelist checking
* (bug 10756) img_auth.php will now refuse logged-out requests when there is no whitelist, rather than allowing them through
2007-08-06 06:15:21 +00:00
Aryeh Gregor
a15c419b3d Remove ?>'s from files. They're pointless, and just asking for people to mess with the files and add trailing whitespace. (Yes, I looked over every one and reverted those that were bogus. Slash-enter a million times in less worked well enough, although it was a bit mind-numbing.) 2007-06-29 01:19:14 +00:00
Brion Vibber
2d5ac3c276 * Add 'charset' to Content-Type headers on various HTTP error responses
to forestall additional UTF-7-autodetect XSS issues. Probably not an
  issue on Apache 2.0+, but most servers send only 'text/html' by default
  when the script didn't specify more details.
    This fixes an issue with the Ajax interface error message on MSIE when
  $wgUseAjax is enabled (not default configuration); this UTF-7 variant
  on a previously fixed attack vector was discovered by Moshe BA from BugSec:
  http://www.bugsec.com/articles.php?Security=24

* Trackback responses now specify XML content type
2007-02-21 01:02:47 +00:00
Tim Starling
28dc3ec888 * Moved the main ob_start() from the default LocalSettings.php to WebStart.php.
The ob_start() section should preferably be removed from older 
  LocalSettings.php files.
* Give Content-Length header for HTTP/1.0 clients.
* Partial support for Flash cross-domain-policy filtering. Text entry points should be protected, but uploads are not.
2007-02-19 23:03:37 +00:00
Brion Vibber
c3343c0f1a add some debugging output to img_auth.php 2006-11-16 12:26:34 +00:00
Brion Vibber
cbb9596427 * (bug 7279) Use wfBaseName in place of basename() in more places 2006-09-10 12:11:36 +00:00
Tim Starling
c447831419 wrong language object 2006-07-16 04:07:01 +00:00
Tim Starling
3ea576aa25 Consolidated web initialisation code into includes/WebStart.php. Moved profiling setup to a hook file "StartProfiler.php", following Brion's suggestion to merge Wikimedia's early profiling patch into subversion. Renamed Profiling.php and logProfilingData(), removed unnecessary wfProfileClose() calls. 2006-07-14 05:35:31 +00:00
Brion Vibber
266d41f165 * Added wfDie() wrapper, and some manual die(-1), to force the return code
to the shell to return nonzero when we crap out with an error.
2006-01-14 02:49:43 +00:00
Ævar Arnfjörð Bjarmason
7bbe971aec * s~ +$~~ 2006-01-07 13:09:30 +00:00
Tim Starling
239ba39261 workaround for any current or future exploit of the $GLOBALS overwrite vulnerability 2005-10-31 21:14:07 +00:00
Tim Starling
9411d91b49 Optional thumbnail generation by client request, using thumb.php. This removes any need for access to image files on page view. Experimental, some aspects still haven't been tested. 2005-04-16 04:33:34 +00:00
Brion Vibber
b090ca3fd5 * (bug 1642) fix a mime type typo in img_auth.php 2005-03-07 06:34:46 +00:00
Antoine Musso
773f135ab1 * phpdoc for file description
* single quotes
2005-01-27 04:30:18 +00:00
Brion Vibber
53856406a6 Clean up a few scriptlets 2004-10-14 02:13:12 +00:00
Tim Starling
cd2e8170d2 Ahh, so that's what that does 2004-08-12 06:54:58 +00:00
Tim Starling
24babf696a Output actual content with the error message, better usage of $wgWhitelistRead, explanation of how to use 2004-06-10 11:52:04 +00:00
Tim Starling
0655c03974 Script to allow MediaWiki-based authentication for downloading items from the upload directory. To use, deny access to the actual directory, and set $wgUploadPath to this script. Image URLs will be of the form "http://server.com/wiki/img_auth.php/0/00/Image.png". The script checks the cookies and the session data, and if everything is OK, streams out the named file. 2004-06-07 06:57:53 +00:00