mirror of
https://github.com/github/codeql.git
synced 2026-05-02 12:15:17 +02:00
implement a simple InsufficientKeySize query
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
| tst.js:3:14:3:71 | crypto. ... 1024 }) | Creation of an asymmetric RSA key uses 1024 bits, which is below 2048 and considered breakable. |
|
||||
| tst.js:7:14:7:59 | crypto. ... : 64 }) | Creation of an symmetric key uses 64 bits, which is below 128 and considered breakable. |
|
||||
@@ -0,0 +1 @@
|
||||
Security/CWE-326/InsufficientKeySize.ql
|
||||
9
javascript/ql/test/query-tests/Security/CWE-326/tst.js
Normal file
9
javascript/ql/test/query-tests/Security/CWE-326/tst.js
Normal file
@@ -0,0 +1,9 @@
|
||||
const crypto = require("crypto");
|
||||
|
||||
const bad1 = crypto.generateKeyPairSync("rsa", { modulusLength: 1024 }); // NOT OK
|
||||
|
||||
const good1 = crypto.generateKeyPairSync("rsa", { modulusLength: 4096 }); // OK
|
||||
|
||||
const bad2 = crypto.generateKeySync("hmac", { length: 64 }); // NOT OK
|
||||
|
||||
const good2 = crypto.generateKeySync("aes", { length: 256 }); // OK
|
||||
Reference in New Issue
Block a user