Skip to content

Commit

Permalink
Merge pull request #1769 from gchq/revert-1753-jsonwebtoken-vuln
Browse files Browse the repository at this point in the history
  • Loading branch information
a3957273 committed Apr 2, 2024
2 parents 9448106 + 99efcb5 commit dc8c185
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 40 deletions.
44 changes: 11 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"jsesc": "^3.0.2",
"json5": "^2.2.3",
"jsonpath-plus": "^8.0.0",
"jsonwebtoken": "^9.0.0",
"jsonwebtoken": "8.5.1",
"jsqr": "^1.4.0",
"jsrsasign": "^11.1.0",
"kbpgp": "2.1.15",
Expand Down
7 changes: 1 addition & 6 deletions src/core/operations/JWTSign.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,7 @@ class JWTSign extends Operation {

try {
return jwt.sign(input, key, {
algorithm: algorithm === "None" ? "none" : algorithm,

// To utilize jsonwebtoken 9+ library and maintain backwards compatibility for regression tests
// This could be turned into operation args in a future PR
allowInsecureKeySizes: true,
allowInvalidAsymmetricKeyTypes: true
algorithm: algorithm === "None" ? "none" : algorithm
});
} catch (err) {
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.
Expand Down

0 comments on commit dc8c185

Please sign in to comment.