Last modified: 2014-08-15 23:48:41 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 T71250, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 69250 - Allow adding custom parameters to the callback for OAuth
Allow adding custom parameters to the callback for OAuth
Status: PATCH_TO_REVIEW
Product: MediaWiki extensions
Classification: Unclassified
OAuth (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-08-07 16:38 UTC by Mitar
Modified: 2014-08-15 23:48 UTC (History)
3 users (show)

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


Attachments

Description Mitar 2014-08-07 16:38:01 UTC
Instead of requiring callback to be "oob", OAuth should allow custom parameters to be passed together with a callback, verify that callback URL, but not query string, matches the registered callback, and then allow it. Currently you cannot protect yourself against CSRF attacks. If you would allow callbacks to provide custom query parameters in callback, then developers could pass an unique CSRF token and protect users.

See examples:

https://dev.twitter.com/discussions/19419
Comment 1 Chris Steipp 2014-08-07 18:08:13 UTC
We are probably going to add this at some point (patches welcome!), but just to give the reason for how we currently do it:

We require you to keep track of the request token's secret key (unlike twitter), so clients *must* track state with the user requesting the authorization (like the OAuth 1 spec says you should), and will hopefully prevent csrf. You should keep the key and secret in the user's session, and compare the key returned in the callback to the user's session to make sure this wasn't submitted via csrf.

Twitter lets you do the handshake without keeping any state until the user finishes the authorization (you don't have to sign the access token request with the request token secret), and they pass the state token through to prevent csrf.

So we're probably always going to require signing the access token request with the request token secret, but I agree, we should let you track state with a passed through parameter as well.
Comment 2 Mitar 2014-08-07 23:35:26 UTC
So in the code I am using, state is kept both on the serer side, but also passed through the client, see:

https://github.com/meteor/meteor/blob/devel/packages/oauth1/oauth1_server.js#L43

query.state is what I should get back from the callback from you, this is used to get the tokens stored in the session, which is then compared to what was send along the callback in oauth_token.

So I am OK with requiring state, but I would like to search in state by my own string and not by oauth_token.
Comment 3 Mitar 2014-08-13 23:41:48 UTC
I opened a pull request: https://gerrit.wikimedia.org/r/#/c/153983/
Comment 4 Gerrit Notification Bot 2014-08-15 23:48:38 UTC
Change 153983 had a related patch set uploaded by CSteipp:
Allow adding custom parameters to the callback for OAuth.

https://gerrit.wikimedia.org/r/153983

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


Navigation
Links