gateway icon indicating copy to clipboard operation
gateway copied to clipboard

Jwks doesn't have key to match kid or alg from Jwt

Open xmath279 opened this issue 1 year ago • 7 comments

Description:

When OIDC provider rotates the keys, Envoy fails to refetch the keys and returns the following error:

Jwks doesn't have key to match kid or alg from Jwt

Repro steps:

Create a security policy with JWKS using a provider that rotates keys (for example, Zitadel). Wait for the key to expire and try the route associated with the security policy.

Environment:

Envoy Gateway 1.1.0 Envoy 1.31.0

Notes

The OpenID Connect spec specifies that the verifier should try to refetch the keys if it encounters an unknown key, see: https://openid.net/specs/openid-connect-core-1_0.html#RotateSigKeys

xmath279 avatar Sep 07 '24 23:09 xmath279

cc @zhaohuabing @denniskniep

arkodg avatar Sep 09 '24 19:09 arkodg

This issue has been automatically marked as stale because it has not had activity in the last 30 days.

github-actions[bot] avatar Nov 07 '24 12:11 github-actions[bot]

If I understand correctly, this needs to be addressed in the Envoy jwt authn filter - the jwt authn filter needs to re-retrieve the keys when it sees an unfamiliar kid value.

zhaohuabing avatar May 27 '25 06:05 zhaohuabing

This issue has been automatically marked as stale because it has not had activity in the last 30 days.

github-actions[bot] avatar Jun 26 '25 08:06 github-actions[bot]

@zhaohuabing Experiencing the same issue after key rollover, as the new kid is not in the envoy gateway cache. Any chance to implement the cacheDuration, asyncFetch from envoy core as the jwt authn filter issue got closed?

dlange82 avatar Jul 14 '25 15:07 dlange82

This issue has been automatically marked as stale because it has not had activity in the last 30 days.

github-actions[bot] avatar Dec 05 '25 04:12 github-actions[bot]

Still relevant

denniskniep avatar Dec 05 '25 22:12 denniskniep