Skip to content

Commit

Permalink
Merge pull request #1753 from chriswhite199/jsonwebtoken-vuln
Browse files Browse the repository at this point in the history
  • Loading branch information
a3957273 committed Mar 29, 2024
2 parents 6fd00e2 + ef5ff5b commit 6edf731
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 13 deletions.
44 changes: 33 additions & 11 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 @@ -134,7 +134,7 @@
"jsesc": "^3.0.2",
"json5": "^2.2.3",
"jsonpath-plus": "^8.0.0",
"jsonwebtoken": "8.5.1",
"jsonwebtoken": "^9.0.0",
"jsqr": "^1.4.0",
"jsrsasign": "^11.1.0",
"kbpgp": "2.1.15",
Expand Down
7 changes: 6 additions & 1 deletion src/core/operations/JWTSign.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ class JWTSign extends Operation {

try {
return jwt.sign(input, key, {
algorithm: algorithm === "None" ? "none" : algorithm
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
});
} 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 6edf731

Please sign in to comment.