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 can I check validity of the JWT token? #417

Closed
hauleth opened this issue Aug 17, 2017 · 6 comments
Closed

How can I check validity of the JWT token? #417

hauleth opened this issue Aug 17, 2017 · 6 comments

Comments

@hauleth
Copy link

hauleth commented Aug 17, 2017

From documentation I see that io.jwt.decode accepts only 1 argument however JWT documentation also requires "secret key" required for validation. Is there any way to check if given JWT is valid one or OPA will happily accept everything as valid?

@tsandall
Copy link
Member

The existing io.jwt.decode built-in does not verify the signature cryptographically. Doing so would require having the secret key in OPA which raises security questions.

If offloading signature verification would be helpful, we can add a built-in to do this but it would be on the deployment to ensure that the key doesn't get leaked, gets rotated, etc.

@hauleth
Copy link
Author

hauleth commented Aug 18, 2017

@tsandall it would be great when combined with #416 Vault integration.

I have also mentioned that project as an idea for Hashicorp's Nomad policy management.

@hauleth
Copy link
Author

hauleth commented Aug 18, 2017

@tsandall also if there would be access to environment variables in OPA policy description then this could be place for storing secret key. Because without verification JWT functionality is quite useless as anyone can now check for everything they want.

@tsandall
Copy link
Member

Adding support to access environment vars sounds like a good start.

I'll create two feature issues to track this:

  1. Add support for accessing environment vars in policy under a new root
  2. Add support for cryptographically verifying JWT signatures

@hauleth Do you know which signature scheme would be most useful to support first?

@hauleth
Copy link
Author

hauleth commented Aug 18, 2017

@tsandall I think that HS* family is most popular one, however there are ready to use libraries that allow verification (list on https://jwt.io) and this seems promising https://github.com/dgrijalva/jwt-go

But remember to https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/

@tsandall
Copy link
Member

@hauleth thanks for reaching out. I've created two separate issues to track the improvements required. If you think this should be re-opened for some reason, go ahed and do so or just comment. Thanks!

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