Skip to content

Commit

Permalink
Merge pull request #323 from jumbojett/fix/harden-self-signed-jwk-header
Browse files Browse the repository at this point in the history
fix: harden self signed JWK header
  • Loading branch information
DeepDiver1975 authored Sep 27, 2022
2 parents 3c896de + ed0e30a commit 7672086
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [unreleased]

## Fixed

* Harden self-signed JWK header usage. #323

## [0.9.8]

## Fixed
Expand Down
9 changes: 9 additions & 0 deletions src/OpenIDConnectClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,7 @@ public function verifyJWTsignature($jwt) {

if (isset($header->jwk)) {
$jwk = $header->jwk;
$this->verifyJWKHeader($jwk);
} else {
$jwks = json_decode($this->fetchURL($this->getProviderConfigValue('jwks_uri')));
if ($jwks === NULL) {
Expand Down Expand Up @@ -1942,4 +1943,12 @@ public function getCodeChallengeMethod() {
public function setCodeChallengeMethod($codeChallengeMethod) {
$this->codeChallengeMethod = $codeChallengeMethod;
}

/**
* @throws OpenIDConnectClientException
*/
protected function verifyJWKHeader($jwk)
{
throw new OpenIDConnectClientException('Self signed JWK header is not valid');
}
}

0 comments on commit 7672086

Please sign in to comment.