Skip to content

Commit 1726287

Browse files
committed
JS: Add e2e threat-model test
1 parent d3ae4c9 commit 1726287

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
nodes
2+
| test.js:4:5:4:29 | temp |
3+
| test.js:4:12:4:22 | process.env |
4+
| test.js:4:12:4:22 | process.env |
5+
| test.js:4:12:4:29 | process.env['foo'] |
6+
| test.js:7:14:7:61 | 'SELECT ... + temp |
7+
| test.js:7:14:7:61 | 'SELECT ... + temp |
8+
| test.js:7:58:7:61 | temp |
9+
edges
10+
| test.js:4:5:4:29 | temp | test.js:7:58:7:61 | temp |
11+
| test.js:4:12:4:22 | process.env | test.js:4:12:4:29 | process.env['foo'] |
12+
| test.js:4:12:4:22 | process.env | test.js:4:12:4:29 | process.env['foo'] |
13+
| test.js:4:12:4:29 | process.env['foo'] | test.js:4:5:4:29 | temp |
14+
| test.js:7:58:7:61 | temp | test.js:7:14:7:61 | 'SELECT ... + temp |
15+
| test.js:7:58:7:61 | temp | test.js:7:14:7:61 | 'SELECT ... + temp |
16+
#select
17+
| test.js:7:14:7:61 | 'SELECT ... + temp | test.js:4:12:4:22 | process.env | test.js:7:14:7:61 | 'SELECT ... + temp | This query string depends on a $@. | test.js:4:12:4:22 | process.env | user-provided value |
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
extensions:
2+
- addsTo:
3+
pack: codeql/threat-models
4+
extensible: threatModelConfiguration
5+
data:
6+
- ["local", true, 0]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Security/CWE-089/SqlInjection.ql
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const mysql = require('mysql');
2+
const pool = mysql.createPool(getConfig());
3+
4+
let temp = process.env['foo'];
5+
pool.getConnection(function(err, connection) {
6+
connection.query({
7+
sql: 'SELECT * FROM `books` WHERE `author` = ' + temp, // NOT OK
8+
}, function(error, results, fields) {});
9+
});

0 commit comments

Comments
 (0)