Improved the security of wfStreamFile():
authorTim Starling <tstarling@users.mediawiki.org>
Tue, 18 Nov 2008 05:07:54 +0000 (05:07 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Tue, 18 Nov 2008 05:07:54 +0000 (05:07 +0000)
commit829f1142b0e834979b3a73a3a1aa6a58347cacf4
treee6ffcd6bea11b4b28472ed0c9537c47592d9d837
parent08fe34b985f224d312d2d3d4d91a30bee406c5fd
Improved the security of wfStreamFile():
* Use the file extension to determine Content-Type, don't look for magic numbers. This makes the attack surface similar to ordinary web server downloads, and avoids problems when MIME type is not checked on upload.
* Use the same restrictions for Content-Type when streaming as for uploading. This closes any vulnerabilities caused by a change to a more secure configuration, post-upload.
* Don't stream out the file after headers are unexpectedly sent (e.g. due to display_errors). The Content-Type will typically be fixed to text/html in this case and so we need to be careful what we send.
includes/StreamFile.php