r67293 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67292‎ | r67293 | r67294 >
Date:18:57, 3 June 2010
Author:aaron
Status:deferred
Tags:
Comment:
Backported CSRF fix
Modified paths:
  • /branches/REL1_16/extensions/FlaggedRevs/specialpages/RevisionReview_body.php (modified) (history)

Diff [purge]

Index: branches/REL1_16/extensions/FlaggedRevs/specialpages/RevisionReview_body.php
@@ -185,6 +185,7 @@
186186 $tags = FlaggedRevs::getDimensions();
187187 // Make review interface object
188188 $form = new RevisionReview();
 189+ $editToken = ''; // edit token
189190 // Each ajax url argument is of the form param|val.
190191 // This means that there is no ugly order dependance.
191192 foreach ( $args as $x => $arg ) {
@@ -235,9 +236,7 @@
236237 $form->retrieveNotes( $val );
237238 break;
238239 case "wpEditToken":
239 - if ( !$wgUser->matchEditToken( $val ) ) {
240 - return '<err#>' . wfMsgExt( 'sessionfailure', 'parseinline' );
241 - }
 240+ $editToken = $val;
242241 break;
243242 default:
244243 $p = preg_replace( '/^wp/', '', $par ); // kill any "wp" prefix
@@ -254,6 +253,10 @@
255254 if ( !$form->page ) {
256255 return '<err#>' . wfMsgExt( 'revreview-failed', 'parseinline' );
257256 }
 257+ # Check session via user token
 258+ if ( !$wgUser->matchEditToken( $editToken ) ) {
 259+ return '<err#>' . wfMsgExt( 'sessionfailure', 'parseinline' );
 260+ }
258261 // Basic permission check
259262 $permErrors = $form->page->getUserPermissionsErrors( 'review', $wgUser );
260263 if ( !$permErrors ) {

Status & tagging log