You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The io.jwt.decode_verify implementation should not error if none of the keys can be used to verify the signature. Instead it should simply indicate that the signature is not valid.
Actual Behavior
The io.jwt.decode_verify implementation short-circuits and halts evaluation if a key cannot be used to verify the signature on the token. If the JWKS contains multiple keys with different signing algorithms, e.g., ES256 and RS256, then the built-in will error out if tries to verify with an ES256 signed token with the RS256 key. This depends on the order of the keys in the JWKS (if it tries the ES256 key first in this case, all is good.)
Steps to Reproduce the Problem
Create a JWKS containing two keys with different algorithms
Sign a JWT with with the second key in the JWKS
Call io.jwt.decode_verify on the token with the JWKS as the cert parameter
The text was updated successfully, but these errors were encountered:
The issue right now being that we don't use any of the keys contained in a jwks beyond the first one. We need to parse and try to use the others in the set.
In addition we should not raise an error for incompatible key types, it should just fail to verify if there are not any that work.
We were previously ignoring any keys beyond the first index in a set
of keys contained in a JWKS provided to the JWT builtins. We now will
attempt to use any of the keys found.
In addition we no longer raise an error if the key type doesn't match
the header. We will return the correct result as if the verification
failed (because it did..)
Fixes: open-policy-agent#1901
Signed-off-by: Patrick East <[email protected]>
We were previously ignoring any keys beyond the first index in a set
of keys contained in a JWKS provided to the JWT builtins. We now will
attempt to use any of the keys found.
In addition we no longer raise an error if the key type doesn't match
the header. We will return the correct result as if the verification
failed (because it did..)
Fixes: #1901
Signed-off-by: Patrick East <[email protected]>
Expected Behavior
The
io.jwt.decode_verify
implementation should not error if none of the keys can be used to verify the signature. Instead it should simply indicate that the signature is not valid.Actual Behavior
The
io.jwt.decode_verify
implementation short-circuits and halts evaluation if a key cannot be used to verify the signature on the token. If the JWKS contains multiple keys with different signing algorithms, e.g., ES256 and RS256, then the built-in will error out if tries to verify with an ES256 signed token with the RS256 key. This depends on the order of the keys in the JWKS (if it tries the ES256 key first in this case, all is good.)Steps to Reproduce the Problem
io.jwt.decode_verify
on the token with the JWKS as the cert parameterThe text was updated successfully, but these errors were encountered: