mirror of
https://github.com/github/codeql.git
synced 2026-04-27 09:45:15 +02:00
JS: Add e2e threat-model test
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
nodes
|
||||
| test.js:4:5:4:29 | temp |
|
||||
| test.js:4:12:4:22 | process.env |
|
||||
| test.js:4:12:4:22 | process.env |
|
||||
| test.js:4:12:4:29 | process.env['foo'] |
|
||||
| test.js:7:14:7:61 | 'SELECT ... + temp |
|
||||
| test.js:7:14:7:61 | 'SELECT ... + temp |
|
||||
| test.js:7:58:7:61 | temp |
|
||||
edges
|
||||
| test.js:4:5:4:29 | temp | test.js:7:58:7:61 | temp |
|
||||
| test.js:4:12:4:22 | process.env | test.js:4:12:4:29 | process.env['foo'] |
|
||||
| test.js:4:12:4:22 | process.env | test.js:4:12:4:29 | process.env['foo'] |
|
||||
| test.js:4:12:4:29 | process.env['foo'] | test.js:4:5:4:29 | temp |
|
||||
| test.js:7:58:7:61 | temp | test.js:7:14:7:61 | 'SELECT ... + temp |
|
||||
| test.js:7:58:7:61 | temp | test.js:7:14:7:61 | 'SELECT ... + temp |
|
||||
#select
|
||||
| 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 |
|
||||
@@ -0,0 +1,6 @@
|
||||
extensions:
|
||||
- addsTo:
|
||||
pack: codeql/threat-models
|
||||
extensible: threatModelConfiguration
|
||||
data:
|
||||
- ["local", true, 0]
|
||||
@@ -0,0 +1 @@
|
||||
Security/CWE-089/SqlInjection.ql
|
||||
@@ -0,0 +1,9 @@
|
||||
const mysql = require('mysql');
|
||||
const pool = mysql.createPool(getConfig());
|
||||
|
||||
let temp = process.env['foo'];
|
||||
pool.getConnection(function(err, connection) {
|
||||
connection.query({
|
||||
sql: 'SELECT * FROM `books` WHERE `author` = ' + temp, // NOT OK
|
||||
}, function(error, results, fields) {});
|
||||
});
|
||||
Reference in New Issue
Block a user