Raise an error when JWK::Set::Fetcher fetches something that's not a JWKS #125
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using the
JSON::JWK::Set::Fetcher
, if a JWKS endpoint returns nothing but a string in double quotes, the contents of those double quotes will be interpreted as a symmetric JWK. As a minimal reproduction:This is pretty unexpected behaviour, but it's also a little worrying in that the RFC enforces that JWKSes have a certain format, but also in that advanced attackers could potentially force a key verification to use a symmetric key that they control.
So, with all that said, this PR makes the
JWK::Set::Fetcher
do a sense check or two on the structure of the JWKSes it fetches -- basically just ensuring that they're hashes, that they have akeys
key, and that the value ofkeys
is an array.