We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8a2a334 commit 7166d54Copy full SHA for 7166d54
javascript/ql/src/experimental/Security/CWE-347/examples/index.js
@@ -0,0 +1,11 @@
1
+const jwt = require("jsonwebtoken");
2
+
3
+const secret = "buybtc";
4
5
+var token = jwt.sign({ foo: 'bar' }, secret, { algorithm: "HS256" }) // alg:HS256
6
+jwt.verify(token, secret, { algorithms: ["HS256", "none"] }) // pass
7
8
+var token = jwt.sign({ foo: 'bar' }, secret, { algorithm: "none" }) // alg:none (unsafe)
9
+jwt.verify(token, "", { algorithms: ["HS256", "none"] }) // detected
10
+jwt.verify(token, undefined, { algorithms: ["HS256", "none"] }) // detected
11
+jwt.verify(token, false, { algorithms: ["HS256", "none"] }) // detected
0 commit comments