Page MenuHomePhabricator

Manage OAuth1 request token secrets in core OAuth1 workflow
ClosedPublic

Authored by epriestley on Jun 28 2014, 3:27 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 22, 9:41 AM
Unknown Object (File)
Fri, Apr 19, 3:40 AM
Unknown Object (File)
Fri, Apr 19, 3:40 AM
Unknown Object (File)
Fri, Apr 19, 3:40 AM
Unknown Object (File)
Sun, Apr 14, 9:14 PM
Unknown Object (File)
Thu, Apr 11, 4:53 AM
Unknown Object (File)
Sat, Apr 6, 3:52 PM
Unknown Object (File)
Sun, Mar 31, 9:46 AM
Subscribers

Details

Summary

Ref T5096. Ref T4251. See D9202 for discussion.

  • Twitter seems to accept either one (?!?!?!??).
  • JIRA uses RSA-SHA1, which does not depend on the token secret.
  • This change makes Bitbucket work.
Test Plan
  • OAuthed with Twitter.
  • OAuthed with JIRA.
  • OAuthed with some Bitbucket code I had partially laying around in a partial state, which works after this change.

Diff Detail

Repository
rP Phabricator
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

epriestley retitled this revision from to Manage OAuth1 request token secrets in core OAuth1 workflow.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added reviewers: 20after4, csteipp, btrahan.
20after4 edited edge metadata.

This looks really good. So it looks like we can drop the cookies and use this instead?

This revision is now accepted and ready to land.Jun 28 2014, 11:57 AM

Yeah, this should just automatically take care of storing the request secret and then providing it to the Adapter before it finishes the handshake, so you can remove the cookie stuff. Let me know if it doesn't work with the Mediawiki stuff, I still need to do a local install so I haven't been able to actually test in live code yet.

epriestley updated this revision to Diff 23443.

Closed by commit rP2d36afeaab7c (authored by @epriestley).

src/applications/auth/provider/PhabricatorAuthProviderOAuth1.php
79

@epriestley I can't get it to work for me unless I override verifyAuthCSRFCode in my subclass with an empty method.

Isn't the CSRF check redundant now that we save and check the token secret?

I think it's not redundant for JIRA, which uses RSA-SHA1 without the secret being part of the signature.

Let's add a method like shouldAddCSRFTokenToCallbackURI() to the base OAuth1 adapter in libphutil, default it to return true;, have it return false; for MW, and then do the CSRF token parts here conditionally (marked inline)?

src/applications/auth/provider/PhabricatorAuthProviderOAuth1.php
55–57

This, and..

79

...this.

Well, I guess it's sort of redundant since we always require the token to load from the DB, but I still think we should retain it for providers which support it. I think it raises enough barriers that it's worth the modest increase in complexity.

I think it's not redundant for JIRA, which uses RSA-SHA1 without the secret being part of the signature.

Let's add a method like shouldAddCSRFTokenToCallbackURI() to the base OAuth1 adapter in libphutil, default it to return true;, have it return false; for MW, and then do the CSRF token parts here conditionally (marked inline)?

Ok I've made the suggested changes in D9202