Skip to content

Commit 7affcf4

Browse files
committed
JS: Add variableValues to the previous summaryModel to enchance the flow.
1 parent 6c18b4d commit 7affcf4

File tree

4 files changed

+49
-8
lines changed

4 files changed

+49
-8
lines changed

javascript/ql/lib/ext/graph-ql.model.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ extensions:
33
pack: codeql/javascript-all
44
extensible: summaryModel
55
data:
6-
- ["graphql", "Member[graphql]", "Argument[0].Member[source]", "Argument[0].Member[rootValue].AnyMember.Parameter[0].AnyMember", "taint"]
6+
- ["graphql", "Member[graphql]", "Argument[0].Member[source,variableValues]", "Argument[0].Member[rootValue].AnyMember.Parameter[0]", "taint"]

javascript/ql/test/query-tests/Security/CWE-094/CodeInjection/CodeInjection.expected

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
| fastify.js:108:28:108:50 | reply.l ... tedCode | fastify.js:94:29:94:41 | request.query | fastify.js:108:28:108:50 | reply.l ... tedCode | This code execution depends on a $@. | fastify.js:94:29:94:41 | request.query | user-provided value |
6363
| fastify.js:108:28:108:50 | reply.l ... tedCode | fastify.js:94:29:94:51 | request ... plyCode | fastify.js:108:28:108:50 | reply.l ... tedCode | This code execution depends on a $@. | fastify.js:94:29:94:51 | request ... plyCode | user-provided value |
6464
| graph-ql.js:20:19:20:22 | expr | graph-ql.js:28:32:28:39 | req.body | graph-ql.js:20:19:20:22 | expr | This code execution depends on a $@. | graph-ql.js:28:32:28:39 | req.body | user-provided value |
65+
| graph-ql.js:39:19:39:30 | name + title | graph-ql.js:28:32:28:39 | req.body | graph-ql.js:39:19:39:30 | name + title | This code execution depends on a $@. | graph-ql.js:28:32:28:39 | req.body | user-provided value |
6566
| module.js:9:16:9:29 | req.query.code | module.js:9:16:9:29 | req.query.code | module.js:9:16:9:29 | req.query.code | This code execution depends on a $@. | module.js:9:16:9:29 | req.query.code | user-provided value |
6667
| module.js:11:17:11:30 | req.query.code | module.js:11:17:11:30 | req.query.code | module.js:11:17:11:30 | req.query.code | This code execution depends on a $@. | module.js:11:17:11:30 | req.query.code | user-provided value |
6768
| react-native.js:8:32:8:38 | tainted | react-native.js:7:17:7:33 | req.param("code") | react-native.js:8:32:8:38 | tainted | This code execution depends on a $@. | react-native.js:7:17:7:33 | req.param("code") | user-provided value |
@@ -155,12 +156,23 @@ edges
155156
| fastify.js:106:9:106:17 | userInput | fastify.js:107:23:107:31 | userInput | provenance | |
156157
| fastify.js:106:21:106:33 | request.query | fastify.js:106:9:106:17 | userInput | provenance | |
157158
| fastify.js:106:21:106:38 | request.query.code | fastify.js:106:9:106:17 | userInput | provenance | |
158-
| graph-ql.js:18:12:18:15 | expr | graph-ql.js:18:12:18:15 | expr | provenance | |
159+
| graph-ql.js:18:10:18:17 | { expr } | graph-ql.js:18:12:18:15 | expr | provenance | |
159160
| graph-ql.js:18:12:18:15 | expr | graph-ql.js:20:19:20:22 | expr | provenance | |
160161
| graph-ql.js:28:9:28:28 | { query, variables } | graph-ql.js:28:11:28:15 | query | provenance | |
162+
| graph-ql.js:28:9:28:28 | { query, variables } | graph-ql.js:28:18:28:26 | variables | provenance | |
161163
| graph-ql.js:28:11:28:15 | query | graph-ql.js:31:13:31:17 | query | provenance | |
164+
| graph-ql.js:28:18:28:26 | variables | graph-ql.js:33:21:33:29 | variables | provenance | |
165+
| graph-ql.js:28:18:28:26 | variables | graph-ql.js:54:21:54:29 | variables | provenance | |
162166
| graph-ql.js:28:32:28:39 | req.body | graph-ql.js:28:9:28:28 | { query, variables } | provenance | |
163-
| graph-ql.js:31:13:31:17 | query | graph-ql.js:18:12:18:15 | expr | provenance | |
167+
| graph-ql.js:31:13:31:17 | query | graph-ql.js:18:10:18:17 | { expr } | provenance | |
168+
| graph-ql.js:33:21:33:29 | variables | graph-ql.js:18:10:18:17 | { expr } | provenance | |
169+
| graph-ql.js:38:13:38:27 | { name, title } | graph-ql.js:38:15:38:18 | name | provenance | |
170+
| graph-ql.js:38:13:38:27 | { name, title } | graph-ql.js:38:21:38:25 | title | provenance | |
171+
| graph-ql.js:38:15:38:18 | name | graph-ql.js:39:19:39:22 | name | provenance | |
172+
| graph-ql.js:38:21:38:25 | title | graph-ql.js:39:26:39:30 | title | provenance | |
173+
| graph-ql.js:39:19:39:22 | name | graph-ql.js:39:19:39:30 | name + title | provenance | |
174+
| graph-ql.js:39:26:39:30 | title | graph-ql.js:39:19:39:30 | name + title | provenance | |
175+
| graph-ql.js:54:21:54:29 | variables | graph-ql.js:38:13:38:27 | { name, title } | provenance | |
164176
| react-native.js:7:7:7:13 | tainted | react-native.js:8:32:8:38 | tainted | provenance | |
165177
| react-native.js:7:7:7:13 | tainted | react-native.js:10:23:10:29 | tainted | provenance | |
166178
| react-native.js:7:17:7:33 | req.param("code") | react-native.js:7:7:7:13 | tainted | provenance | |
@@ -295,13 +307,22 @@ nodes
295307
| fastify.js:106:21:106:38 | request.query.code | semmle.label | request.query.code |
296308
| fastify.js:107:23:107:31 | userInput | semmle.label | userInput |
297309
| fastify.js:108:28:108:50 | reply.l ... tedCode | semmle.label | reply.l ... tedCode |
298-
| graph-ql.js:18:12:18:15 | expr | semmle.label | expr |
310+
| graph-ql.js:18:10:18:17 | { expr } | semmle.label | { expr } |
299311
| graph-ql.js:18:12:18:15 | expr | semmle.label | expr |
300312
| graph-ql.js:20:19:20:22 | expr | semmle.label | expr |
301313
| graph-ql.js:28:9:28:28 | { query, variables } | semmle.label | { query, variables } |
302314
| graph-ql.js:28:11:28:15 | query | semmle.label | query |
315+
| graph-ql.js:28:18:28:26 | variables | semmle.label | variables |
303316
| graph-ql.js:28:32:28:39 | req.body | semmle.label | req.body |
304317
| graph-ql.js:31:13:31:17 | query | semmle.label | query |
318+
| graph-ql.js:33:21:33:29 | variables | semmle.label | variables |
319+
| graph-ql.js:38:13:38:27 | { name, title } | semmle.label | { name, title } |
320+
| graph-ql.js:38:15:38:18 | name | semmle.label | name |
321+
| graph-ql.js:38:21:38:25 | title | semmle.label | title |
322+
| graph-ql.js:39:19:39:22 | name | semmle.label | name |
323+
| graph-ql.js:39:19:39:30 | name + title | semmle.label | name + title |
324+
| graph-ql.js:39:26:39:30 | title | semmle.label | title |
325+
| graph-ql.js:54:21:54:29 | variables | semmle.label | variables |
305326
| module.js:9:16:9:29 | req.query.code | semmle.label | req.query.code |
306327
| module.js:11:17:11:30 | req.query.code | semmle.label | req.query.code |
307328
| react-native.js:7:7:7:13 | tainted | semmle.label | tainted |

javascript/ql/test/query-tests/Security/CWE-094/CodeInjection/HeuristicSourceCodeInjection.expected

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,23 @@ edges
5555
| fastify.js:106:9:106:17 | userInput | fastify.js:107:23:107:31 | userInput | provenance | |
5656
| fastify.js:106:21:106:33 | request.query | fastify.js:106:9:106:17 | userInput | provenance | |
5757
| fastify.js:106:21:106:38 | request.query.code | fastify.js:106:9:106:17 | userInput | provenance | |
58-
| graph-ql.js:18:12:18:15 | expr | graph-ql.js:18:12:18:15 | expr | provenance | |
58+
| graph-ql.js:18:10:18:17 | { expr } | graph-ql.js:18:12:18:15 | expr | provenance | |
5959
| graph-ql.js:18:12:18:15 | expr | graph-ql.js:20:19:20:22 | expr | provenance | |
6060
| graph-ql.js:28:9:28:28 | { query, variables } | graph-ql.js:28:11:28:15 | query | provenance | |
61+
| graph-ql.js:28:9:28:28 | { query, variables } | graph-ql.js:28:18:28:26 | variables | provenance | |
6162
| graph-ql.js:28:11:28:15 | query | graph-ql.js:31:13:31:17 | query | provenance | |
63+
| graph-ql.js:28:18:28:26 | variables | graph-ql.js:33:21:33:29 | variables | provenance | |
64+
| graph-ql.js:28:18:28:26 | variables | graph-ql.js:54:21:54:29 | variables | provenance | |
6265
| graph-ql.js:28:32:28:39 | req.body | graph-ql.js:28:9:28:28 | { query, variables } | provenance | |
63-
| graph-ql.js:31:13:31:17 | query | graph-ql.js:18:12:18:15 | expr | provenance | |
66+
| graph-ql.js:31:13:31:17 | query | graph-ql.js:18:10:18:17 | { expr } | provenance | |
67+
| graph-ql.js:33:21:33:29 | variables | graph-ql.js:18:10:18:17 | { expr } | provenance | |
68+
| graph-ql.js:38:13:38:27 | { name, title } | graph-ql.js:38:15:38:18 | name | provenance | |
69+
| graph-ql.js:38:13:38:27 | { name, title } | graph-ql.js:38:21:38:25 | title | provenance | |
70+
| graph-ql.js:38:15:38:18 | name | graph-ql.js:39:19:39:22 | name | provenance | |
71+
| graph-ql.js:38:21:38:25 | title | graph-ql.js:39:26:39:30 | title | provenance | |
72+
| graph-ql.js:39:19:39:22 | name | graph-ql.js:39:19:39:30 | name + title | provenance | |
73+
| graph-ql.js:39:26:39:30 | title | graph-ql.js:39:19:39:30 | name + title | provenance | |
74+
| graph-ql.js:54:21:54:29 | variables | graph-ql.js:38:13:38:27 | { name, title } | provenance | |
6475
| react-native.js:7:7:7:13 | tainted | react-native.js:8:32:8:38 | tainted | provenance | |
6576
| react-native.js:7:7:7:13 | tainted | react-native.js:10:23:10:29 | tainted | provenance | |
6677
| react-native.js:7:17:7:33 | req.param("code") | react-native.js:7:7:7:13 | tainted | provenance | |
@@ -197,13 +208,22 @@ nodes
197208
| fastify.js:106:21:106:38 | request.query.code | semmle.label | request.query.code |
198209
| fastify.js:107:23:107:31 | userInput | semmle.label | userInput |
199210
| fastify.js:108:28:108:50 | reply.l ... tedCode | semmle.label | reply.l ... tedCode |
200-
| graph-ql.js:18:12:18:15 | expr | semmle.label | expr |
211+
| graph-ql.js:18:10:18:17 | { expr } | semmle.label | { expr } |
201212
| graph-ql.js:18:12:18:15 | expr | semmle.label | expr |
202213
| graph-ql.js:20:19:20:22 | expr | semmle.label | expr |
203214
| graph-ql.js:28:9:28:28 | { query, variables } | semmle.label | { query, variables } |
204215
| graph-ql.js:28:11:28:15 | query | semmle.label | query |
216+
| graph-ql.js:28:18:28:26 | variables | semmle.label | variables |
205217
| graph-ql.js:28:32:28:39 | req.body | semmle.label | req.body |
206218
| graph-ql.js:31:13:31:17 | query | semmle.label | query |
219+
| graph-ql.js:33:21:33:29 | variables | semmle.label | variables |
220+
| graph-ql.js:38:13:38:27 | { name, title } | semmle.label | { name, title } |
221+
| graph-ql.js:38:15:38:18 | name | semmle.label | name |
222+
| graph-ql.js:38:21:38:25 | title | semmle.label | title |
223+
| graph-ql.js:39:19:39:22 | name | semmle.label | name |
224+
| graph-ql.js:39:19:39:30 | name + title | semmle.label | name + title |
225+
| graph-ql.js:39:26:39:30 | title | semmle.label | title |
226+
| graph-ql.js:54:21:54:29 | variables | semmle.label | variables |
207227
| module.js:9:16:9:29 | req.query.code | semmle.label | req.query.code |
208228
| module.js:11:17:11:30 | req.query.code | semmle.label | req.query.code |
209229
| react-native.js:7:7:7:13 | tainted | semmle.label | tainted |

javascript/ql/test/query-tests/Security/CWE-094/CodeInjection/graph-ql.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ app.post('/graphql', async (req, res) => {
3636

3737
const root1 = {
3838
greet: ({ name, title }) => {
39-
return eval(name + title).toString(); // $ MISSING: Alert[js/code-injection]
39+
return eval(name + title).toString(); // $ Alert[js/code-injection]
4040
}
4141
};
4242
graphql({

0 commit comments

Comments
 (0)