Skip to content

Commit

Permalink
fix: reject client JSON Web Key Set null value (#1237)
Browse files Browse the repository at this point in the history
Co-authored-by: Filip Skokan <panva.ip@gmail.com>
  • Loading branch information
KalleV and panva authored Dec 1, 2023
1 parent a0af4c4 commit cce6d43
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/models/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const fingerprint = (properties) => hash(properties, {

const validateJWKS = (jwks) => {
if (jwks !== undefined) {
if (!Array.isArray(jwks.keys) || !jwks.keys.every(isPlainObject)) {
if (!Array.isArray(jwks?.keys) || !jwks.keys.every(isPlainObject)) {
throw new InvalidClientMetadata('client JSON Web Key Set is invalid');
}
}
Expand Down
1 change: 1 addition & 0 deletions test/configuration/client_metadata.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1749,6 +1749,7 @@ describe('Client metadata validation', () => {
rejects(this.title, { keys: [value] }, 'client JSON Web Key Set is invalid');
});
rejects('jwks', 'string', 'client JSON Web Key Set is invalid');
rejects('jwks', null, 'client JSON Web Key Set is invalid');
rejects(this.title, {}, 'client JSON Web Key Set is invalid');
rejects(this.title, 1, 'client JSON Web Key Set is invalid');
rejects(this.title, 0, 'client JSON Web Key Set is invalid');
Expand Down

0 comments on commit cce6d43

Please sign in to comment.