-
Notifications
You must be signed in to change notification settings - Fork 68
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
--alg
should be required when performing signature validation
#134
Comments
I mostly set a default because it seems like the most common algorithm is Has the industry moved onto a different algorithm by default? Maybe we can error if the algorithm doesn't match, rather than continue to decode? I think that might be a good middle ground solution which helps everyone. What do you think? |
From my experience, asymmetric algorithms like In general, being aware of the choice of algorithms for signature validation is a good thing. However, setting sane defaults is a good thing, too. With #133, the new warning message provides useful feedback when the algorithms didn't match:
Maybe the actual value of this change is the ability to provide a list of algorithms for signature validation. This is very useful when multiple variations of the same algorithm (e.g. To cut a long story short, I think we can also add the HSxxx algorithms as a default choice when #133 is merged. Would that be in your interest? Arg::with_name("algorithms")
.help("a comma-separated list of algorithms to be used for signature validation. All algorithms need to be of the same family (HMAC, RSA, EC).")
+ .default_value("HS512,HS384,HS256")
.takes_value(true)
.long("algs")
.short("A")
.possible_values(&SupportedAlgorithms::variants()) |
@codedust that works for me, I think |
When no algorithm is given during signature validation,
HS256
is used by default. This leads to an error message stating that the JWT has a different algorithm than the one the user provided. PR #133 improves on this by showing the algorithm specified in the JWT and the algorithm used for signature validation (HS256
per default) but still, this is not ideal.I would therefore suggest to require the
--alg
parameter when a secret is given (-S
).Current behavior:
Expected behavior:
Even better, it would be nice to allow for specifying multiple valid algorithms like this:
$ cargo run -- decode -S 1234567890 --algs HS256,HS384,HS512 $JWT
The text was updated successfully, but these errors were encountered: