Skip to content

Commit

Permalink
refactor!: RSA1_5 JWE encryption algorithm is no longer supported
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The RSA1_5 JWE Key Management Algorithm, which was previously disabled by default, is now completely removed.
  • Loading branch information
panva committed Dec 1, 2022
1 parent 3575584 commit a967a4e
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 67 deletions.
12 changes: 6 additions & 6 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1807,7 +1807,7 @@ async function getResourceServerInfo(ctx, resourceIndicator, client) {
},
// Tokens will be encrypted
encrypt?: {
alg: string, // 'dir' | 'RSA-OAEP' | 'RSA-OAEP-256' | 'RSA-OAEP-384' | 'RSA-OAEP-512' | 'RSA1_5' | 'ECDH-ES' | 'ECDH-ES+A128KW' | 'ECDH-ES+A192KW' | 'ECDH-ES+A256KW' | 'A128KW' | 'A192KW' | 'A256KW' | 'A128GCMKW' | 'A192GCMKW' | 'A256GCMKW'
alg: string, // 'dir' | 'RSA-OAEP' | 'RSA-OAEP-256' | 'RSA-OAEP-384' | 'RSA-OAEP-512' | 'ECDH-ES' | 'ECDH-ES+A128KW' | 'ECDH-ES+A192KW' | 'ECDH-ES+A256KW' | 'A128KW' | 'A192KW' | 'A256KW' | 'A128GCMKW' | 'A192GCMKW' | 'A256GCMKW'
enc: string, // 'A128CBC-HS256' | 'A128GCM' | 'A192CBC-HS384' | 'A192GCM' | 'A256CBC-HS512' | 'A256GCM'
key: crypto.KeyObject | Buffer, // public key or shared symmetric secret to encrypt the JWT token with
kid?: string, // OPTIONAL `kid` JOSE Header Parameter to put in the token's JWE Header
Expand Down Expand Up @@ -3024,7 +3024,7 @@ _**default value**_:
```js
[
// asymmetric RSAES based
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'RSA1_5',
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512',
// asymmetric ECDH-ES based
'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW', 'ECDH-ES+A256KW',
// symmetric AES key wrapping
Expand Down Expand Up @@ -3170,7 +3170,7 @@ _**default value**_:
```js
[
// asymmetric RSAES based
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'RSA1_5',
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512',
// asymmetric ECDH-ES based
'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW', 'ECDH-ES+A256KW',
// symmetric AES key wrapping
Expand Down Expand Up @@ -3258,7 +3258,7 @@ _**default value**_:
```js
[
// asymmetric RSAES based
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'RSA1_5',
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512',
// asymmetric ECDH-ES based
'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW', 'ECDH-ES+A256KW',
// symmetric AES key wrapping
Expand Down Expand Up @@ -3346,7 +3346,7 @@ _**default value**_:
```js
[
// asymmetric RSAES based
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'RSA1_5',
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512',
// asymmetric ECDH-ES based
'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW', 'ECDH-ES+A256KW',
// symmetric AES key wrapping
Expand Down Expand Up @@ -3435,7 +3435,7 @@ _**default value**_:
```js
[
// asymmetric RSAES based
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'RSA1_5',
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512',
// asymmetric ECDH-ES based
'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW', 'ECDH-ES+A256KW',
// symmetric AES key wrapping
Expand Down
1 change: 0 additions & 1 deletion lib/consts/jwa.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const encryptionAlgValues = [
// asymmetric
'RSA-OAEP',
'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512',
'RSA1_5',
'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW', 'ECDH-ES+A256KW',
// symmetric
'A128GCMKW', 'A192GCMKW', 'A256GCMKW', 'A128KW', 'A192KW', 'A256KW',
Expand Down
12 changes: 6 additions & 6 deletions lib/helpers/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -1697,7 +1697,7 @@ function makeDefaults() {
* },
* // Tokens will be encrypted
* encrypt?: {
* alg: string, // 'dir' | 'RSA-OAEP' | 'RSA-OAEP-256' | 'RSA-OAEP-384' | 'RSA-OAEP-512' | 'RSA1_5' | 'ECDH-ES' | 'ECDH-ES+A128KW' | 'ECDH-ES+A192KW' | 'ECDH-ES+A256KW' | 'A128KW' | 'A192KW' | 'A256KW' | 'A128GCMKW' | 'A192GCMKW' | 'A256GCMKW'
* alg: string, // 'dir' | 'RSA-OAEP' | 'RSA-OAEP-256' | 'RSA-OAEP-384' | 'RSA-OAEP-512' | 'ECDH-ES' | 'ECDH-ES+A128KW' | 'ECDH-ES+A192KW' | 'ECDH-ES+A256KW' | 'A128KW' | 'A192KW' | 'A256KW' | 'A128GCMKW' | 'A192GCMKW' | 'A256GCMKW'
* enc: string, // 'A128CBC-HS256' | 'A128GCM' | 'A192CBC-HS384' | 'A192GCM' | 'A256CBC-HS512' | 'A256GCM'
* key: crypto.KeyObject | Buffer, // public key or shared symmetric secret to encrypt the JWT token with
* kid?: string, // OPTIONAL `kid` JOSE Header Parameter to put in the token's JWE Header
Expand Down Expand Up @@ -2476,7 +2476,7 @@ function makeDefaults() {
* ```js
* [
* // asymmetric RSAES based
* 'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'RSA1_5',
* 'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512',
* // asymmetric ECDH-ES based
* 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW', 'ECDH-ES+A256KW',
* // symmetric AES key wrapping
Expand All @@ -2499,7 +2499,7 @@ function makeDefaults() {
* ```js
* [
* // asymmetric RSAES based
* 'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'RSA1_5',
* 'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512',
* // asymmetric ECDH-ES based
* 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW', 'ECDH-ES+A256KW',
* // symmetric AES key wrapping
Expand All @@ -2522,7 +2522,7 @@ function makeDefaults() {
* ```js
* [
* // asymmetric RSAES based
* 'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'RSA1_5',
* 'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512',
* // asymmetric ECDH-ES based
* 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW', 'ECDH-ES+A256KW',
* // symmetric AES key wrapping
Expand All @@ -2546,7 +2546,7 @@ function makeDefaults() {
* ```js
* [
* // asymmetric RSAES based
* 'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'RSA1_5',
* 'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512',
* // asymmetric ECDH-ES based
* 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW', 'ECDH-ES+A256KW',
* // symmetric AES key wrapping
Expand All @@ -2570,7 +2570,7 @@ function makeDefaults() {
* ```js
* [
* // asymmetric RSAES based
* 'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'RSA1_5',
* 'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512',
* // asymmetric ECDH-ES based
* 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW', 'ECDH-ES+A256KW',
* // symmetric AES key wrapping
Expand Down
2 changes: 1 addition & 1 deletion lib/helpers/initialize_keystore.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const jwkEncryptionAlgorithms = (jwk) => {

switch (jwk.kty) {
case 'RSA':
available = ['RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'RSA1_5'];
available = ['RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512'];
break;
case 'EC':
switch (jwk.crv) {
Expand Down
52 changes: 26 additions & 26 deletions test/configuration/client_metadata.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ describe('Client metadata validation', () => {
}));
allows(this.title, 'dir', undefined, configuration);
[
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'RSA1_5', 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW',
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW',
'ECDH-ES+A256KW', 'A128GCMKW', 'A192GCMKW', 'A256GCMKW', 'A128KW', 'A192KW', 'A256KW',
].forEach((value) => {
allows(this.title, value, {
Expand All @@ -752,26 +752,26 @@ describe('Client metadata validation', () => {
context('id_token_encrypted_response_enc', function () {
defaultsTo(this.title, undefined);
defaultsTo(this.title, 'A128CBC-HS256', {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
jwks: { keys: [sigKey] },
}, configuration);
mustBeString(this.title, undefined, {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
jwks: { keys: [sigKey] },
}, configuration);
[
'A128CBC-HS256', 'A128GCM', 'A192CBC-HS384', 'A192GCM', 'A256CBC-HS512', 'A256GCM',
].forEach((value) => {
allows(this.title, value, {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
jwks: { keys: [sigKey] },
}, configuration);
allows(this.title, value, {
[this.title.replace(/(enc$)/, 'alg')]: 'dir',
}, configuration);
});
rejects(this.title, 'not-an-enc', undefined, {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
jwks: { keys: [sigKey] },
}, configuration);
});
Expand All @@ -791,7 +791,7 @@ describe('Client metadata validation', () => {
}));
allows(this.title, 'dir', undefined, configuration);
[
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'RSA1_5', 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW',
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW',
'ECDH-ES+A256KW', 'A128GCMKW', 'A192GCMKW', 'A256GCMKW', 'A128KW', 'A192KW', 'A256KW',
].forEach((value) => {
allows(this.title, value, {
Expand All @@ -806,26 +806,26 @@ describe('Client metadata validation', () => {
defaultsTo(this.title, undefined);
defaultsTo(this.title, undefined, undefined, configuration);
defaultsTo(this.title, 'A128CBC-HS256', {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
jwks: { keys: [sigKey] },
}, configuration);
mustBeString(this.title, undefined, {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
jwks: { keys: [sigKey] },
}, configuration);
[
'A128CBC-HS256', 'A128GCM', 'A192CBC-HS384', 'A192GCM', 'A256CBC-HS512', 'A256GCM',
].forEach((value) => {
allows(this.title, value, {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
jwks: { keys: [sigKey] },
}, configuration);
allows(this.title, value, {
[this.title.replace(/(enc$)/, 'alg')]: 'dir',
}, configuration);
});
rejects(this.title, 'not-an-enc', undefined, {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
jwks: { keys: [sigKey] },
}, configuration);
});
Expand All @@ -845,7 +845,7 @@ describe('Client metadata validation', () => {
}));
allows(this.title, 'dir', undefined, configuration);
[
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'RSA1_5', 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW',
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW',
'ECDH-ES+A256KW', 'A128GCMKW', 'A192GCMKW', 'A256GCMKW', 'A128KW', 'A192KW', 'A256KW',
].forEach((value) => {
allows(this.title, value, {
Expand All @@ -860,26 +860,26 @@ describe('Client metadata validation', () => {
defaultsTo(this.title, undefined);
defaultsTo(this.title, undefined, undefined, configuration);
defaultsTo(this.title, 'A128CBC-HS256', {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
jwks: { keys: [sigKey] },
}, configuration);
mustBeString(this.title, undefined, {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
jwks: { keys: [sigKey] },
}, configuration);
[
'A128CBC-HS256', 'A128GCM', 'A192CBC-HS384', 'A192GCM', 'A256CBC-HS512', 'A256GCM',
].forEach((value) => {
allows(this.title, value, {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
jwks: { keys: [sigKey] },
}, configuration);
allows(this.title, value, {
[this.title.replace(/(enc$)/, 'alg')]: 'dir',
}, configuration);
});
rejects(this.title, 'not-an-enc', undefined, {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
jwks: { keys: [sigKey] },
}, configuration);
});
Expand All @@ -899,7 +899,7 @@ describe('Client metadata validation', () => {
}));
allows(this.title, 'dir', undefined, configuration);
[
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'RSA1_5', 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW',
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW',
'ECDH-ES+A256KW', 'A128GCMKW', 'A192GCMKW', 'A256GCMKW', 'A128KW', 'A192KW', 'A256KW',
].forEach((value) => {
allows(this.title, value, {
Expand All @@ -914,26 +914,26 @@ describe('Client metadata validation', () => {
defaultsTo(this.title, undefined);
defaultsTo(this.title, undefined, undefined, configuration);
defaultsTo(this.title, 'A128CBC-HS256', {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
jwks: { keys: [sigKey] },
}, configuration);
mustBeString(this.title, undefined, {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
jwks: { keys: [sigKey] },
}, configuration);
[
'A128CBC-HS256', 'A128GCM', 'A192CBC-HS384', 'A192GCM', 'A256CBC-HS512', 'A256GCM',
].forEach((value) => {
allows(this.title, value, {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
jwks: { keys: [sigKey] },
}, configuration);
allows(this.title, value, {
[this.title.replace(/(enc$)/, 'alg')]: 'dir',
}, configuration);
});
rejects(this.title, 'not-an-enc', undefined, {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
jwks: { keys: [sigKey] },
}, configuration);
});
Expand All @@ -959,7 +959,7 @@ describe('Client metadata validation', () => {
}));
allows(this.title, 'dir', undefined, configuration);
[
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'RSA1_5', 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW',
'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512', 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW',
'ECDH-ES+A256KW', 'A128GCMKW', 'A192GCMKW', 'A256GCMKW', 'A128KW', 'A192KW', 'A256KW',
].forEach((value) => {
allows(this.title, value, undefined, configuration);
Expand All @@ -972,23 +972,23 @@ describe('Client metadata validation', () => {
defaultsTo(this.title, undefined);
defaultsTo(this.title, undefined, undefined, configuration);
defaultsTo(this.title, 'A128CBC-HS256', {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
}, configuration);
mustBeString(this.title, undefined, {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
}, configuration);
[
'A128CBC-HS256', 'A128GCM', 'A192CBC-HS384', 'A192GCM', 'A256CBC-HS512', 'A256GCM',
].forEach((value) => {
allows(this.title, value, {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
}, configuration);
allows(this.title, value, {
[this.title.replace(/(enc$)/, 'alg')]: 'dir',
}, configuration);
});
rejects(this.title, 'not-an-enc', undefined, {
[this.title.replace(/(enc$)/, 'alg')]: 'RSA1_5',
[this.title.replace(/(enc$)/, 'alg')]: 'RSA-OAEP',
}, configuration);
});
});
Expand Down Expand Up @@ -1173,7 +1173,7 @@ describe('Client metadata validation', () => {
'introspection_encrypted_response_alg',
].forEach((prop) => {
[
'RSA-OAEP', 'RSA1_5',
'RSA-OAEP',
'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW', 'ECDH-ES+A256KW',
].forEach((alg) => {
rejects(this.title, undefined, 'jwks or jwks_uri is mandatory for this client', {
Expand Down
8 changes: 4 additions & 4 deletions test/encryption/encryption.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ merge(config.features, {
pushedAuthorizationRequests: { enabled: true },
});

pull(config.enabledJWA.requestObjectEncryptionAlgValues, 'RSA-OAEP');
pull(config.enabledJWA.requestObjectEncryptionAlgValues, 'RSA-OAEP-512');
pull(config.enabledJWA.requestObjectEncryptionEncValues, 'A192CBC-HS384');

const k = jose.JWK.generateSync('RSA', 2048);
Expand All @@ -38,11 +38,11 @@ export default {
response_types: ['id_token token', 'code'],
grant_types: ['implicit', 'authorization_code'],
jwks: pubKey,
id_token_encrypted_response_alg: 'RSA1_5',
id_token_encrypted_response_alg: 'RSA-OAEP',
// id_token_encrypted_response_enc: 'A128CBC-HS256',
request_object_encryption_alg: 'RSA1_5',
request_object_encryption_alg: 'RSA-OAEP',
// request_object_encryption_enc: 'A128CBC-HS256',
userinfo_encrypted_response_alg: 'RSA1_5',
userinfo_encrypted_response_alg: 'RSA-OAEP',
// userinfo_encrypted_response_enc: 'A128CBC-HS256',
},
{
Expand Down
Loading

0 comments on commit a967a4e

Please sign in to comment.