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

@ prefix to read a binary file cannot be used with HMAC algorithms #109

Closed
jbg opened this issue Jan 6, 2021 · 0 comments · Fixed by #130
Closed

@ prefix to read a binary file cannot be used with HMAC algorithms #109

jbg opened this issue Jan 6, 2021 · 0 comments · Fixed by #130

Comments

@jbg
Copy link

jbg commented Jan 6, 2021

Summary

The help text claims that a value starting with @ can be provided to the -S/--secret parameter in order to read the secret from a binary file. However, this is not implemented for the HMAC algorithms (like HS256) - instead, the string starting with @ provided on the command line is used verbatim as the secret, leading to confusing signature validation issues.

This unfortunately leads this tool to encourage the exclusive use of human-readable strings as JWT secrets when using the HMAC modes, which considerably reduces the size of the keyspace.

Steps to reproduce

jwt encode -S @secret.key -a fake -i fake -p fake -s fake

Expected behavior

The bytes contained in the file secret.key are used as the JWT secret.

Actual behavior

The bytes of the string @secret.key are used as the JWT secret.

lizfeed added a commit to lizfeed/jwt-cli that referenced this issue Jun 16, 2021
lizfeed added a commit to lizfeed/jwt-cli that referenced this issue Jun 16, 2021
mike-engel pushed a commit that referenced this issue Jul 21, 2021
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

Successfully merging a pull request may close this issue.

1 participant