r24105 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24104‎ | r24105 | r24106 >
Date:04:57, 15 July 2007
Author:amidaniel
Status:old
Tags:
Comment:
Security fix: Previously it was possible to include unprotected and even content pages in site and user jss/css pages via action=raw. Now when requesting a page as text/javascript or text/css, if it should not contain such content, it simply returns '/* EMPTY */'.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/RawPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/RawPage.php
@@ -145,7 +145,14 @@
146146 }
147147
148148 function getRawText() {
149 - global $wgUser, $wgOut, $wgRequest;
 149+ global $wgUser, $wgOut, $wgRequest, $wgJsMimeType;
 150+
 151+ /* Disable retrieving content pages as raw js/css */
 152+ $dangerousTypes = array( $wgJsMimeType, 'text/css' );
 153+ if ( in_array( $this->mContentType, $dangerousTypes ) &&
 154+ !($this->mTitle->isCssOrJsPage() || $this->mTitle->isCssJsSubpage() ) )
 155+ return '/* EMPTY */';
 156+
150157 if($this->mGen) {
151158 $sk = $wgUser->getSkin();
152159 $sk->initPage($wgOut);
Index: trunk/phase3/RELEASE-NOTES
@@ -293,6 +293,8 @@
294294 * Don't show non-functional toolbar buttons on Opera 7 anymore
295295 * (bug 9151) Fix relative subpage links with section fragments
296296 * (bug 10560) Adding a space between category letter heading and "continues"
 297+* Security fix: Disable retrieving pages as raw js/css that should not contain
 298+ such content.
297299
298300 == API changes since 1.10 ==
299301

Follow-up revisions

RevisionCommit summaryAuthorDate
r24202Revert r24105, r24106, r24107 'security fix' forbidden text/css and text/java...brion15:50, 17 July 2007
r24215Merged revisions 24095-24212 via svnmerge from...david21:19, 17 July 2007

Status & tagging log