Skip to content

Commit

Permalink
attempt to fix #823 by removing any key using a P-521 curve from the …
Browse files Browse the repository at this point in the history
…discovered keys

Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
julien-nc committed May 14, 2024
1 parent 9cba05b commit 36707a0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Service/DiscoveryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ private function fixJwksAlg(array $jwks, string $jwt): array {
}

foreach ($jwks['keys'] as $index => $key) {
// php-jwt fails in JWK::parseKeySet the keyset contains one key with P-521 curve
// see https://github.com/firebase/php-jwt/blob/main/src/JWK.php#L31
if (isset($key['crv']) && $key['crv'] === 'P-521') {
unset($jwks['keys'][$index]);
}

// Only fix the key being referred to in the JWT.
if ($jwtHeader['kid'] != $key['kid']) {
continue;
Expand Down

0 comments on commit 36707a0

Please sign in to comment.