Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How secret is the oauthTokenSecret? #16

Open
ForbesLindesay opened this issue Dec 7, 2017 · 5 comments
Open

How secret is the oauthTokenSecret? #16

ForbesLindesay opened this issue Dec 7, 2017 · 5 comments

Comments

@ForbesLindesay
Copy link

ForbesLindesay commented Dec 7, 2017

Judging by the name oauthTokenSecret probably shouldn't be shared with the user? Since many people store session data in a cookie, this seems at odds with the default implementation of oauth1. I may be missing something though?

@ForbesLindesay ForbesLindesay changed the title How secret is the tokenSecret? How secret is the oauthTokenSecret? Dec 7, 2017
@jaredhanson
Copy link
Owner

It is a secret that should only be known by the client/application to which the token was issued.

this seems at odds with the default implementation of oauth1

I'm not sure what you mean by "default implementation", and what is at odds. If the client is storing secrets in a way that users can access them, then yes that is at odds. Hopefully it is not the default implementation.

@ForbesLindesay
Copy link
Author

One of the most popular session implementations for express is cookie-session. It stores the session in plain text in a cookie (JSON encoded). By default passport-oauth1 stores the oauth_token_secret in the session.

@jaredhanson
Copy link
Owner

jaredhanson commented Dec 8, 2017 via email

@ForbesLindesay
Copy link
Author

https://www.npmjs.com/package/cookie-session Signs the session data with a secret key, but it does not encrypt the data. A user can still read the contents of the session as plain text.

@jaredhanson
Copy link
Owner

jaredhanson commented Dec 9, 2017

The token secret that is stored in the session is associated with the request token (aka temporary credentials). This request token is a one-time use token and secret exchanged for the final access token. In this sense, it serves a similar purpose to the authorization code in OAuth 2.0, and there's little risk associated with storing it in signed-only cookie. The protocol has other means to authenticate use of the temporary credentials (such as client secrets).

The token secret associated with the access token is handed off to the application by passport-oauth1, and is not stored in the session. I would not advice putting this token or secret in a session whose contents are visible to the user. If client-side cookie storage is needed, I would advise client-sessions, which encrypts the data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants