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

warden: do not use refresh tokens as proof of authorization #549

Closed
therebelrobot opened this issue Jul 5, 2017 · 3 comments
Closed

warden: do not use refresh tokens as proof of authorization #549

therebelrobot opened this issue Jul 5, 2017 · 3 comments
Assignees
Labels
bug Something is not working.
Milestone

Comments

@therebelrobot
Copy link
Contributor

Issue: When you validate an access token using the warden/token/allowed endpoint, it returns {allowed: false} if the scopes don't match what is registered in the token. If you pass in a refresh token instead, it returns allowed: true with the entire response, regardless of scopes passed to it.

Expected result: it should either blacklist refresh tokens altogether, or at least validate the scopes passed in.

Hydra version: v0.8.7
Docker Image: oryd/hydra:v0.8.7-http

cc @yields (he's the one who ran into it while consuming the endpoint here at Segment)

@therebelrobot
Copy link
Contributor Author

For context, we're using the warden/token/allowed endpoint to validate external tokens coming into our infrastructure, until #539 is resolved.

@aeneasr aeneasr added the bug Something is not working. label Jul 6, 2017
@aeneasr aeneasr added this to the 1.0.0: stable release milestone Jul 6, 2017
@aeneasr aeneasr self-assigned this Jul 6, 2017
@aeneasr
Copy link
Member

aeneasr commented Jul 6, 2017

The issue is that the warden uses the introspection functionality from fosite, which in turn doesn't really care if it's a refresh or an access token. Actually, the introspection endpoint isn't caring about scopes either, which is a bit weird because fosite does, but only for access tokens, not refresh.

To resolve, I think the following must be done:

  1. Check scopes of refresh tokens in fosite
  2. Return token type in introspect response (fosite)
  3. Only pass warden if token type is access token, not refresh token

aeneasr pushed a commit that referenced this issue Jul 6, 2017
@aeneasr aeneasr changed the title Warden endpoint doesn't validate refresh token scopes warden: do not use refresh tokens as proof of authorization Jul 6, 2017
@aeneasr
Copy link
Member

aeneasr commented Jul 6, 2017

With the new patch you are no longer able to use refresh tokens in the warden endpoint, and the introspect endpoint properly checks refresh tokens for scopes as well. Thanks for the report!

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

No branches or pull requests

2 participants