Skip to content

Commit 6cfc950

Browse files
committed
JS: Model GraphQLObjectType resolve params as sources
1 parent d88bc8e commit 6cfc950

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,8 @@ extensions:
44
extensible: summaryModel
55
data:
66
- ["graphql", "Member[graphql]", "Argument[0].Member[source,variableValues]", "Argument[0].Member[rootValue].AnyMember.Parameter[0]", "taint"]
7+
- addsTo:
8+
pack: codeql/javascript-all
9+
extensible: sourceModel
10+
data:
11+
- ["graphql", "Member[GraphQLObjectType].Argument[0].Member[fields].AnyMember.Member[resolve].Parameter[1]", "remote"]

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
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 |
6565
| 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 |
66+
| graph-ql.js:66:23:66:27 | value | graph-ql.js:65:22:65:30 | { value } | graph-ql.js:66:23:66:27 | value | This code execution depends on a $@. | graph-ql.js:65:22:65:30 | { value } | user-provided value |
6667
| 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 |
6768
| 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 |
6869
| 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 |
@@ -173,6 +174,8 @@ edges
173174
| graph-ql.js:39:19:39:22 | name | graph-ql.js:39:19:39:30 | name + title | provenance | |
174175
| graph-ql.js:39:26:39:30 | title | graph-ql.js:39:19:39:30 | name + title | provenance | |
175176
| graph-ql.js:54:21:54:29 | variables | graph-ql.js:38:13:38:27 | { name, title } | provenance | |
177+
| graph-ql.js:65:22:65:30 | { value } | graph-ql.js:65:24:65:28 | value | provenance | |
178+
| graph-ql.js:65:24:65:28 | value | graph-ql.js:66:23:66:27 | value | provenance | |
176179
| react-native.js:7:7:7:13 | tainted | react-native.js:8:32:8:38 | tainted | provenance | |
177180
| react-native.js:7:7:7:13 | tainted | react-native.js:10:23:10:29 | tainted | provenance | |
178181
| react-native.js:7:17:7:33 | req.param("code") | react-native.js:7:7:7:13 | tainted | provenance | |
@@ -323,6 +326,9 @@ nodes
323326
| graph-ql.js:39:19:39:30 | name + title | semmle.label | name + title |
324327
| graph-ql.js:39:26:39:30 | title | semmle.label | title |
325328
| graph-ql.js:54:21:54:29 | variables | semmle.label | variables |
329+
| graph-ql.js:65:22:65:30 | { value } | semmle.label | { value } |
330+
| graph-ql.js:65:24:65:28 | value | semmle.label | value |
331+
| graph-ql.js:66:23:66:27 | value | semmle.label | value |
326332
| module.js:9:16:9:29 | req.query.code | semmle.label | req.query.code |
327333
| module.js:11:17:11:30 | req.query.code | semmle.label | req.query.code |
328334
| react-native.js:7:7:7:13 | tainted | semmle.label | tainted |

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ edges
7272
| graph-ql.js:39:19:39:22 | name | graph-ql.js:39:19:39:30 | name + title | provenance | |
7373
| graph-ql.js:39:26:39:30 | title | graph-ql.js:39:19:39:30 | name + title | provenance | |
7474
| graph-ql.js:54:21:54:29 | variables | graph-ql.js:38:13:38:27 | { name, title } | provenance | |
75+
| graph-ql.js:65:22:65:30 | { value } | graph-ql.js:65:24:65:28 | value | provenance | |
76+
| graph-ql.js:65:24:65:28 | value | graph-ql.js:66:23:66:27 | value | provenance | |
7577
| react-native.js:7:7:7:13 | tainted | react-native.js:8:32:8:38 | tainted | provenance | |
7678
| react-native.js:7:7:7:13 | tainted | react-native.js:10:23:10:29 | tainted | provenance | |
7779
| react-native.js:7:17:7:33 | req.param("code") | react-native.js:7:7:7:13 | tainted | provenance | |
@@ -224,6 +226,9 @@ nodes
224226
| graph-ql.js:39:19:39:30 | name + title | semmle.label | name + title |
225227
| graph-ql.js:39:26:39:30 | title | semmle.label | title |
226228
| graph-ql.js:54:21:54:29 | variables | semmle.label | variables |
229+
| graph-ql.js:65:22:65:30 | { value } | semmle.label | { value } |
230+
| graph-ql.js:65:24:65:28 | value | semmle.label | value |
231+
| graph-ql.js:66:23:66:27 | value | semmle.label | value |
227232
| module.js:9:16:9:29 | req.query.code | semmle.label | req.query.code |
228233
| module.js:11:17:11:30 | req.query.code | semmle.label | req.query.code |
229234
| 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ app.post('/graphql', async (req, res) => {
6262
args: {
6363
value: { type: GraphQLString }
6464
},
65-
resolve: (_, { value }, context) => { // $ MISSING: Source[js/code-injection]
66-
return eval(value); // $ MISSING: Alert[js/code-injection]
65+
resolve: (_, { value }, context) => { // $ Source[js/code-injection]
66+
return eval(value); // $ Alert[js/code-injection]
6767
}
6868
}
6969
}

0 commit comments

Comments
 (0)