Module: kamailio Branch: master Commit: e90ff1972fe83ad0f4735238debef9a4d26f0436 URL: https://github.com/kamailio/kamailio/commit/e90ff1972fe83ad0f4735238debef9a4d26f0436
Author: Federico Cabiddu <[email protected]> Committer: Federico Cabiddu <[email protected]> Date: 2026-07-06T10:19:01+02:00 jwt3: fall back to first key when kid not found in static JWKS --- Modified: src/modules/jwt3/jwt3_mod.c --- Diff: https://github.com/kamailio/kamailio/commit/e90ff1972fe83ad0f4735238debef9a4d26f0436.diff Patch: https://github.com/kamailio/kamailio/commit/e90ff1972fe83ad0f4735238debef9a4d26f0436.patch --- diff --git a/src/modules/jwt3/jwt3_mod.c b/src/modules/jwt3/jwt3_mod.c index 86dc65beb40..ca305c395cb 100644 --- a/src/modules/jwt3/jwt3_mod.c +++ b/src/modules/jwt3/jwt3_mod.c @@ -928,10 +928,16 @@ static int ki_jwt_verify_key( /* find key item by kid in a JWKS ... */ if(hdr.value) { item = jwks_find_bykid(jwks, hdr.value); + if(item == NULL) { + /* kid present but not found - fall back to first key */ + LM_DBG("kid '%s' not found in JWKS, falling back to first " + "key\n", + hdr.value); + item = jwks_item_get(jwks, 0); + } free(hdr.value); /* clean up */ - } - /* or use the first item */ - if(item == NULL) { + } else { + /* no kid in JWT - use first key */ item = jwks_item_get(jwks, 0); } _______________________________________________ Kamailio - Development Mailing List -- [email protected] To unsubscribe send an email to [email protected] Important: keep the mailing list in the recipients, do not reply only to the sender!
