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

Allow separate access/refresh transport #73

Open
kamac opened this issue Jan 12, 2020 · 0 comments
Open

Allow separate access/refresh transport #73

kamac opened this issue Jan 12, 2020 · 0 comments

Comments

@kamac
Copy link

kamac commented Jan 12, 2020

Problem
Currently there the API doesn't support different access and refresh tokens transports (for example one should be stored in a HTTP only cookie, while the other in header).

Motivation
If separate transports were possible, one could store refresh token in a HTTP only cookie, and access token in headers (which would later be saved by the client in localstorage). This approach could yield better security if both tokens were required to generate a new access token:

  • A rouge JS script / XSS attack could only steal access token and use it until it's expiry
  • CSRF wouldn't be an issue when access token was stored in localStorage and both refresh and access (possibly expired, but with valid signature) tokens were required to generate a new access token*
  • If refresh token was to be somehow stolen (via man in the middle attack without HTTPS), an attacker would still need to obtain matching access token.*

*- This would require embedding refresh token selector in JWT to figure out if the two match.

Current workarounds
This can be somewhat mitigated when reading by composing requiredSession(oneOff, usingHeaders) { _ => requiredSession(refreshable, usingCookies) { ..., however this will result in the latter directive never finding our access token, and generating a new one.

For writing with setSession (upon user login with basic credentials), one could work around this by composing setSession calls, and manually removing excess cookies/headers.

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

1 participant