Skip to content

Commit dc8c185

Browse files
authored
Merge pull request #1769 from gchq/revert-1753-jsonwebtoken-vuln
2 parents 9448106 + 99efcb5 commit dc8c185

File tree

3 files changed

+13
-40
lines changed

3 files changed

+13
-40
lines changed

package-lock.json

+11-33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
"jsesc": "^3.0.2",
136136
"json5": "^2.2.3",
137137
"jsonpath-plus": "^8.0.0",
138-
"jsonwebtoken": "^9.0.0",
138+
"jsonwebtoken": "8.5.1",
139139
"jsqr": "^1.4.0",
140140
"jsrsasign": "^11.1.0",
141141
"kbpgp": "2.1.15",

src/core/operations/JWTSign.mjs

+1-6
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,7 @@ class JWTSign extends Operation {
5050

5151
try {
5252
return jwt.sign(input, key, {
53-
algorithm: algorithm === "None" ? "none" : algorithm,
54-
55-
// To utilize jsonwebtoken 9+ library and maintain backwards compatibility for regression tests
56-
// This could be turned into operation args in a future PR
57-
allowInsecureKeySizes: true,
58-
allowInvalidAsymmetricKeyTypes: true
53+
algorithm: algorithm === "None" ? "none" : algorithm
5954
});
6055
} catch (err) {
6156
throw new OperationError(`Error: Have you entered the key correctly? The key should be either the secret for HMAC algorithms or the PEM-encoded private key for RSA and ECDSA.

0 commit comments

Comments
 (0)