Last modified: 2012-06-19 20:43:26 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T37727, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 35727 - mw.Api ajax() should put token parameter last
mw.Api ajax() should put token parameter last
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.19
All All
: Low minor (vote)
: 1.20.0 release
Assigned To: Krinkle
: patch, patch-reviewed
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-05 14:26 UTC by Russell Blau
Modified: 2012-06-19 20:43 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
patch to mediawiki.api.js to handle edit tokens (1.06 KB, patch)
2012-04-05 14:26 UTC, Russell Blau
Details

Description Russell Blau 2012-04-05 14:26:24 UTC
Created attachment 10381 [details]
patch to mediawiki.api.js to handle edit tokens

It is recommended at [[mw:API:Edit#Token]] that the "token" parameter in an edit request should be passed to the server last. This is a safety measure in case transmission of the HTML request to the server is interrupted; the server will not process an incomplete request because there will be no token.  (Conversely, if the "text=" parameter were last, the server would have no way of knowing whether the complete text had been received.)  Presumably the same thing is necessary for action=email, since the request may include text of arbitrary length.

The attached patch (not tested) moves any parameter named "token" to the end of the request; this is possibly over-inclusive (it will apply to things like "action=watch" where there is no text field in the request) but I can't see how it can do any harm.
Comment 1 Sumana Harihareswara 2012-04-06 20:51:23 UTC
Thanks for the patch, Russell!

Just so you know, you can get developer access easily

https://www.mediawiki.org/wiki/Developer_access

and then submit the patch right into our Git source control system:

https://www.mediawiki.org/wiki/Git/Workflow
Comment 2 Brad Jorsch 2012-06-16 00:03:05 UTC
+1, patch looks good to me, and seems to work as advertised in a quick test.
Comment 3 Sumana Harihareswara 2012-06-16 00:05:44 UTC
Brad, since Russell hasn't responded, want to put it in Gerrit on his behalf?
Comment 4 Krinkle 2012-06-16 02:14:38 UTC
+2 (not tested though)
Comment 5 Brad Jorsch 2012-06-17 02:06:03 UTC
(In reply to comment #4)
> +2 (not tested though)

Does that mean you committed it already?

(In reply to comment #3)
> Brad, since Russell hasn't responded, want to put it in Gerrit on his behalf?

Sure, I can do that if Krinkle hasn't committed it already.
Comment 6 Krinkle 2012-06-17 04:06:15 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > +2 (not tested though)
> 
> Does that mean you committed it already?

No, I did not.

> 
> (In reply to comment #3)
> > Brad, since Russell hasn't responded, want to put it in Gerrit on his behalf?
> 
> Sure, I can do that if Krinkle hasn't committed it already.

Please do :)
Comment 7 Brad Jorsch 2012-06-17 04:20:05 UTC
Gerrit change #11738

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links