r67282 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67281‎ | r67282 | r67283 >
Date:16:48, 3 June 2010
Author:platonides
Status:resolved (Comments)
Tags:
Comment:
It would be pretty bad if a coder browser was abused to change all subversion account linking.
Modified paths:
  • /trunk/extensions/CodeReview/CodeReview.i18n.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionAuthorLink.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeReview.i18n.php
@@ -43,6 +43,7 @@
4444 'code-author-link' => 'link?',
4545 'code-author-unlink' => 'unlink?',
4646 'code-author-unlinksuccess' => 'Author $1 has been unlinked',
 47+ 'code-author-badtoken' => 'Session error trying to perform the action.',
4748 'code-browsing-path' => "Browsing revisions in '''$1'''",
4849 'code-field-id' => 'Revision',
4950 'code-field-author' => 'Author',
Index: trunk/extensions/CodeReview/ui/CodeRevisionAuthorLink.php
@@ -29,10 +29,12 @@
3030 }
3131
3232 function doForm() {
33 - global $wgOut;
 33+ global $wgOut, $wgUser;
3434 $form = Xml::openElement( 'form', array( 'method' => 'post',
3535 'action' => $this->getTitle()->getLocalUrl(),
3636 'name' => 'uluser', 'id' => 'mw-codeauthor-form1' ) );
 37+
 38+ $form .= Html::hidden( 'linktoken', $wgUser->getToken() );
3739 $form .= Xml::openElement( 'fieldset' );
3840
3941 $additional = '';
@@ -57,8 +59,14 @@
5860 }
5961
6062 function doSubmit() {
61 - global $wgOut, $wgRequest;
 63+ global $wgOut, $wgRequest, $wgUser;
6264 // Link an author to a wiki user
 65+
 66+ if ( $wgRequest->getVal( 'linktoken') != $wgUser->getToken() ) {
 67+ $wgOut->addWikiMsg( 'code-author-badtoken' );
 68+ return;
 69+ }
 70+
6371 if ( strlen( $this->mTarget ) && $wgRequest->getCheck( 'newname' ) ) {
6472 $user = User::newFromName( $this->mTarget, false );
6573 if ( !$user || !$user->getId() ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r67286Follow up r67282. This time using the right functions....platonides17:35, 3 June 2010

Comments

#Comment by Nikerabbit (talk | contribs)   17:31, 3 June 2010

Shouldn't this use User::matchEditToken and User::editToken?

#Comment by Catrope (talk | contribs)   17:32, 3 June 2010

Yes, it should.

#Comment by Platonides (talk | contribs)   17:32, 3 June 2010

Sure it should.

Status & tagging log