-
Bug
-
Resolution: Fixed
-
Critical
-
4.0
-
MOODLE_400_STABLE
-
MOODLE_400_STABLE
-
MDL-74303-master -
-
-
3
-
QA time 2
This is an optional value in the keyset (as per the JWK spec - https://datatracker.ietf.org/doc/html/rfc7517#section-4.4) but firebase/php-jwt (specifically v6.0, which we recently upgraded to) demands this is set (https://github.com/firebase/php-jwt/blob/main/src/JWK.php#L85-L89).
This prevents the correct public key retrieval during launches from platforms - like D2L for example - which omit the alg value in their JWKS JSON.
This kind of dependency on alg has also come up elsewhere - https://github.com/BookStackApp/BookStack/issues/3206. See also the "Similar cases" reported in that issue, which refers to other projects.
We need to solve this in a similar way, perhaps falling back to RS256 in cases where alg isn't present.
To replicate:
- Perform the platform registration steps described above in the testing instructions.
- Publish a resource in the tool site, so it'll be available via deep linking
- Modify the platform's JWKS - in Moodle this is in mod/lti/classes/local/ltiopenid/jwks_helper::get_jwks(). Comment out the line:
$jwks['alg'] = 'RS256'
- In the platform, try to launch a deep linking request (see testing instructions, this is the "select content" button)
- Notice the error stating that it was unable to find the public key.