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
Allow the use of all appropriate crypto algorithms that match the JWK retrieved from the URL (#1613)
### What
This PR changes the behaviour of JWT validation when the user has
configured getting their JWK from a URL in the AuthConfig.
Previously we used the algorithm specified on the JWK and only validated
the JWT if it was signed with that algorithm. However, in HGE v2, we did
not look at this field, and instead validated the JWT with the algorithm
it was signed with (so long as that algorithm was compatible with the
key). This is better behaviour, IMHO, because the algorithm field on the
JWK is optional (and customers often don't set it), plus I suspect it is
more useful to specify which algorithm to use when _signing_ a JWT with
that JWK, rather than _validating_ an existing signature.
In this PR, we widen the acceptable algorithms to validate a JWT with to
be all algorithms compatible with the JWK. However, this behaviour only
applies to JWKs retrieved from a URL. For inline JWTs, we currently
provide an `algorithm` property in the AuthConfig that specifies a
single algorithm to use. I think this should be widened into a list to
allow for multiple algorithms (and JWKs from a URL should also be able
to optionally specify a list of acceptable algorithms), but that can be
left to another PR.
### How
There is a new function `get_acceptable_algorithms_for_key` that returns
all acceptable algorithms for the specific JWK key type. It is used to
set the acceptable algorithms to use during validation.
V3_GIT_ORIGIN_REV_ID: 3c37a45b37611593b41b31968726923f45336bde
0 commit comments