Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .changeset/asap-jsonwebtoken-9.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"@ordermentum/asap-core": patch
"@ordermentum/express-asap": patch
"@ordermentum/hapi-asap": patch
---

Bump `jsonwebtoken` dependency from ^8.5.1 to ^9.0.0 to remediate CVE-2022-23539 (unrestricted key type could lead to legacy keys usage) and cascade fixes for `jws` and `semver` transitives.

Test-only changes required by jsonwebtoken@9:
- `internal/test-helpers`: swap the inline 1024-bit RSA test key pair for a 2048-bit pair (v9 enforces a minimum key size of 2048 bits for RS256).
- `packages/asap-core/test/generate_test.ts`: update the invalid-private-key assertion regex to match v9's new error message `secretOrPrivateKey must be an asymmetric key`.

No production API changes; sign/verify call sites already pass explicit `algorithm`/`algorithms` so v9 remains behaviour-compatible.
6 changes: 3 additions & 3 deletions internal/test-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"devDependencies": {
"@types/chai": "4.3.0",
"@types/express": "4.17.13",
"@types/jsonwebtoken": "8.5.8",
"@types/jsonwebtoken": "9.0.9",
"@types/mocha": "9.1.0",
"@types/node": "17.0.21",
"@types/sinon": "10.0.11",
Expand All @@ -38,6 +38,6 @@
"typecheck": "yarn tsc --noEmit"
},
"dependencies": {
"jsonwebtoken": "^8.5.1"
"jsonwebtoken": "^9.0.0"
}
}
}
49 changes: 32 additions & 17 deletions internal/test-helpers/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,43 @@ import jsonWebToken from 'jsonwebtoken';

export const privateKeyPem = `
-----BEGIN RSA PRIVATE KEY-----
MIICXgIBAAKBgQDPpV0EjiFQ0ZEJ3m7Nyz+pmY+t2t2aqUe/uqW6PLvePe7b9/I0
7Znz65koGidfmsZxy88waj1GO0y9nGw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3oaSmKHXavZZeEtg0t3qdt0CAHyMIZd
sH4loQKBgQCxaivRc49nAllNNOuWe3boyLu/F2Zv5UeCiMEJoZzJdVSClH2kjFVN
5//SHG5wRiehqchG1YORwsMRCS8Y7m6swVmrdNn342sWYx+Fli6onoDcs7oDMUoX
jMuHygne+o1xEJFG77Hq9eFogWvTAxqA6hdTRdJOqfA587pwCezeaA==
-----END RSA PRIVATE KEY-----
`.trim();

export const publicKey = `
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDPpV0EjiFQ0ZEJ3m7Nyz+pmY+t
2t2aqUe/uqW6PLvePe7b9/I07Znz65koGidfmsZxy88waj1GO0y9nGwvZ5yicE8d
fDId2GruMzgcSWJCmgJ/2/OH53KaYd9AXLI1ynl5rjwWy8KPrX8XhpTrlEo+Pu57
Kc/LHlXL9ubs1sW6ZQIDAQAB
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv3WB7FfYHj1eCZ+lH3cw
KnnhjVnzugM8E2LqdCzM7RYNsjM0Znw1J4PNx3Fo79EAvgs9tK3SxHo9jcX/RcnA
3CrdWjpJTJ/cTUemWyj9jy5Xi2g4NQ8UhnlrYt+iygG2j2hthULdX8zaCQGnuyP7
ugZchaj9+pRo7IrNZ0a1SKyk5gnwLKCiwxnmCnUg6/Ige+ZJNHYJzxKmTtvMFDpW
NeWiFhTAmVDc/R8Wu5+hLL7GCAcDiiA9xQ1MC19lIliXKvcgpVIQ46a9qdBAJ5Y9
4ncqiIGNUR0jVTht49k+/7LIN/Vo5N2pieugmGN7tVrHndrqsU62jgKMUdQJLP0h
AwIDAQAB
-----END PUBLIC KEY-----
`.trim();

Expand Down
4 changes: 2 additions & 2 deletions packages/asap-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@ordermentum/asap-test-helpers": "*",
"@types/chai": "4.3.0",
"@types/express": "4.17.13",
"@types/jsonwebtoken": "8.5.8",
"@types/jsonwebtoken": "9.0.9",
"@types/mocha": "9.1.0",
"@types/node": "^20.0.0",
"@types/node-cache": "4.2.5",
Expand All @@ -40,7 +40,7 @@
"dependencies": {
"axios": "^1.19.0",
"express": "^4.17.3",
"jsonwebtoken": "^8.5.1",
"jsonwebtoken": "^9.0.0",
"node-cache": "^5.1.2"
}
}
2 changes: 1 addition & 1 deletion packages/asap-core/test/generate_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ describe('createAuthHeaderGenerator', () => {
jwtConfig.privateKey = 'this is not a valid key';

expect(() => createAuthHeaderGenerator(jwtConfig)()).to.throw(
/DECODER routines::unsupported/
/secretOrPrivateKey must be an asymmetric key/
);
});

Expand Down
4 changes: 2 additions & 2 deletions packages/express-asap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@ordermentum/asap-test-helpers": "*",
"@types/chai": "4.3.0",
"@types/express": "4.17.13",
"@types/jsonwebtoken": "8.5.8",
"@types/jsonwebtoken": "9.0.9",
"@types/mocha": "9.1.0",
"@types/node": "^20.0.0",
"@types/sinon": "10.0.11",
Expand All @@ -41,6 +41,6 @@
"dependencies": {
"@ordermentum/asap-core": "*",
"express": "^4.17.3",
"jsonwebtoken": "^8.5.1"
"jsonwebtoken": "^9.0.0"
}
}
4 changes: 2 additions & 2 deletions packages/hapi-asap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@ordermentum/asap-test-helpers": "*",
"@types/chai": "^4.3.0",
"@types/hapi__hapi": "^20.0.10",
"@types/jsonwebtoken": "^8.5.8",
"@types/jsonwebtoken": "^9.0.9",
"@types/mocha": "^9.1.0",
"@types/node": "^20.0.0",
"@types/sinon": "^10.0.11",
Expand Down Expand Up @@ -43,6 +43,6 @@
"@hapi/hapi": "^20.2.2",
"@ordermentum/asap-core": "*",
"express": "^4.17.3",
"jsonwebtoken": "^8.5.1"
"jsonwebtoken": "^9.0.0"
}
}
64 changes: 45 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -974,13 +974,29 @@
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4=

"@types/jsonwebtoken@8.5.8", "@types/jsonwebtoken@^8.5.8":
"@types/jsonwebtoken@8.5.8":
version "8.5.8"
resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-8.5.8.tgz#01b39711eb844777b7af1d1f2b4cf22fda1c0c44"
integrity sha512-zm6xBQpFDIDM6o9r6HSgDeIcLy82TKWctCXEPbJJcXb5AKmi5BNNdLXneixK4lplX3PqIVcwLBCGE/kAGnlD4A==
dependencies:
"@types/node" "*"

"@types/jsonwebtoken@9.0.9":
version "9.0.9"
resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-9.0.9.tgz#a4c3a446c0ebaaf467a58398382616f416345fb3"
integrity sha512-uoe+GxEuHbvy12OUQct2X9JenKM3qAscquYymuQN4fMWG9DBQtykrQEFcAbVACF7qaLw9BePSodUL0kquqBJpQ==
dependencies:
"@types/ms" "*"
"@types/node" "*"

"@types/jsonwebtoken@^9.0.9":
version "9.0.10"
resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-9.0.10.tgz#a7932a47177dcd4283b6146f3bd5c26d82647f09"
integrity sha512-asx5hIG9Qmf/1oStypjanR7iKTv0gXQ1Ov/jfrX6kS/EO0OFni8orbmGCn0672NHR3kXHwpAwR+B368ZGN/2rA==
dependencies:
"@types/ms" "*"
"@types/node" "*"

"@types/mime-db@*":
version "1.43.1"
resolved "https://registry.yarnpkg.com/@types/mime-db/-/mime-db-1.43.1.tgz#c2a0522453bb9b6e84ee48b7eef765d19bcd519e"
Expand All @@ -1001,6 +1017,11 @@
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-9.1.1.tgz#e7c4f1001eefa4b8afbd1eee27a237fee3bf29c4"
integrity sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==

"@types/ms@*":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@types/ms/-/ms-2.1.0.tgz#052aa67a48eccc4309d7f0191b7e41434b90bb78"
integrity sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==

"@types/node-cache@4.2.5":
version "4.2.5"
resolved "https://registry.yarnpkg.com/@types/node-cache/-/node-cache-4.2.5.tgz#dac6be8bf8f486db4eef66f52f7bb9e90b65d2c1"
Expand Down Expand Up @@ -1475,7 +1496,7 @@ browserslist@^4.17.5:
node-releases "^2.0.2"
picocolors "^1.0.0"

buffer-equal-constant-time@1.0.1:
buffer-equal-constant-time@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819"
integrity sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=
Expand Down Expand Up @@ -3146,12 +3167,12 @@ jsonfile@^4.0.0:
optionalDependencies:
graceful-fs "^4.1.6"

jsonwebtoken@^8.5.1:
version "8.5.1"
resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz#00e71e0b8df54c2121a1f26137df2280673bcc0d"
integrity sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==
jsonwebtoken@^9.0.0:
version "9.0.3"
resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz#6cd57ab01e9b0ac07cb847d53d3c9b6ee31f7ae2"
integrity sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==
dependencies:
jws "^3.2.2"
jws "^4.0.1"
lodash.includes "^4.3.0"
lodash.isboolean "^3.0.3"
lodash.isinteger "^4.0.4"
Expand All @@ -3160,7 +3181,7 @@ jsonwebtoken@^8.5.1:
lodash.isstring "^4.0.1"
lodash.once "^4.0.0"
ms "^2.1.1"
semver "^5.6.0"
semver "^7.5.4"

"jsx-ast-utils@^2.4.1 || ^3.0.0", jsx-ast-utils@^3.1.0:
version "3.2.1"
Expand All @@ -3175,21 +3196,21 @@ just-extend@^4.0.2:
resolved "https://registry.yarnpkg.com/just-extend/-/just-extend-4.2.1.tgz#ef5e589afb61e5d66b24eca749409a8939a8c744"
integrity sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==

jwa@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/jwa/-/jwa-1.4.1.tgz#743c32985cb9e98655530d53641b66c8645b039a"
integrity sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==
jwa@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/jwa/-/jwa-2.0.1.tgz#bf8176d1ad0cd72e0f3f58338595a13e110bc804"
integrity sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==
dependencies:
buffer-equal-constant-time "1.0.1"
buffer-equal-constant-time "^1.0.1"
ecdsa-sig-formatter "1.0.11"
safe-buffer "^5.0.1"

jws@^3.2.2:
version "3.2.2"
resolved "https://registry.yarnpkg.com/jws/-/jws-3.2.2.tgz#001099f3639468c9414000e99995fa52fb478304"
integrity sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==
jws@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/jws/-/jws-4.0.1.tgz#07edc1be8fac20e677b283ece261498bd38f0690"
integrity sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==
dependencies:
jwa "^1.4.1"
jwa "^2.0.1"
safe-buffer "^5.0.1"

language-subtag-registry@~0.3.2:
Expand Down Expand Up @@ -4285,7 +4306,7 @@ safe-regex@^2.1.1:
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==

"semver@2 || 3 || 4 || 5", semver@^5.6.0:
"semver@2 || 3 || 4 || 5":
version "5.7.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
Expand Down Expand Up @@ -4314,6 +4335,11 @@ semver@^7.5.3:
resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143"
integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==

semver@^7.5.4:
version "7.8.5"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.8.5.tgz#39b646037dd50c14fb451e7e4cac58ed8b863f69"
integrity sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==

send@0.17.2:
version "0.17.2"
resolved "https://registry.yarnpkg.com/send/-/send-0.17.2.tgz#926622f76601c41808012c8bf1688fe3906f7820"
Expand Down
Loading