Skip to content

Commit 416c986

Browse files
committed
add support for graphql in @actions/github
1 parent 50d574d commit 416c986

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

javascript/change-notes/2021-06-09-graphql.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ lgtm,codescanning
44
[@octokit/core](https://npmjs.com/package/@octokit/core),
55
[@octokit/rest](https://npmjs.com/package/@octokit/rest),
66
[@octokit/graphql](https://npmjs.com/package/@octokit/graphql),
7-
[@octokit/request](https://npmjs.com/package/@octokit/request), and
7+
[@octokit/request](https://npmjs.com/package/@octokit/request),
8+
[@actions/github](https://npmjs.com/package/@actions/github), and
89
[graphql](https://npmjs.com/package/graphql)

javascript/ql/src/semmle/javascript/frameworks/GraphQL.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ private module Octokit {
2020
private API::Node octokit() {
2121
result =
2222
API::moduleImport(["@octokit/core", "@octokit/rest"]).getMember("Octokit").getInstance()
23+
or
24+
result = API::moduleImport("@actions/github").getMember("getOctokit").getReturn()
2325
}
2426

2527
/**

javascript/ql/test/query-tests/Security/CWE-089/untyped/SqlInjection.expected

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ nodes
4444
| graphql.js:84:14:90:8 | `{\\n ... }` |
4545
| graphql.js:84:14:90:8 | `{\\n ... }` |
4646
| graphql.js:88:13:88:14 | id |
47+
| graphql.js:119:11:119:28 | id |
48+
| graphql.js:119:16:119:28 | req.params.id |
49+
| graphql.js:119:16:119:28 | req.params.id |
50+
| graphql.js:120:38:120:48 | `foo ${id}` |
51+
| graphql.js:120:38:120:48 | `foo ${id}` |
52+
| graphql.js:120:45:120:46 | id |
4753
| json-schema-validator.js:25:15:25:48 | query |
4854
| json-schema-validator.js:25:23:25:48 | JSON.pa ... y.data) |
4955
| json-schema-validator.js:25:34:25:47 | req.query.data |
@@ -417,6 +423,11 @@ edges
417423
| graphql.js:75:56:75:57 | id | graphql.js:75:46:75:64 | "{ foo" + id + " }" |
418424
| graphql.js:88:13:88:14 | id | graphql.js:84:14:90:8 | `{\\n ... }` |
419425
| graphql.js:88:13:88:14 | id | graphql.js:84:14:90:8 | `{\\n ... }` |
426+
| graphql.js:119:11:119:28 | id | graphql.js:120:45:120:46 | id |
427+
| graphql.js:119:16:119:28 | req.params.id | graphql.js:119:11:119:28 | id |
428+
| graphql.js:119:16:119:28 | req.params.id | graphql.js:119:11:119:28 | id |
429+
| graphql.js:120:45:120:46 | id | graphql.js:120:38:120:48 | `foo ${id}` |
430+
| graphql.js:120:45:120:46 | id | graphql.js:120:38:120:48 | `foo ${id}` |
420431
| json-schema-validator.js:25:15:25:48 | query | json-schema-validator.js:33:22:33:26 | query |
421432
| json-schema-validator.js:25:15:25:48 | query | json-schema-validator.js:33:22:33:26 | query |
422433
| json-schema-validator.js:25:15:25:48 | query | json-schema-validator.js:35:18:35:22 | query |
@@ -835,6 +846,7 @@ edges
835846
| graphql.js:58:66:58:76 | `foo ${id}` | graphql.js:55:16:55:28 | req.params.id | graphql.js:58:66:58:76 | `foo ${id}` | This query depends on $@. | graphql.js:55:16:55:28 | req.params.id | a user-provided value |
836847
| graphql.js:75:46:75:64 | "{ foo" + id + " }" | graphql.js:74:14:74:25 | req.query.id | graphql.js:75:46:75:64 | "{ foo" + id + " }" | This query depends on $@. | graphql.js:74:14:74:25 | req.query.id | a user-provided value |
837848
| graphql.js:84:14:90:8 | `{\\n ... }` | graphql.js:74:14:74:25 | req.query.id | graphql.js:84:14:90:8 | `{\\n ... }` | This query depends on $@. | graphql.js:74:14:74:25 | req.query.id | a user-provided value |
849+
| graphql.js:120:38:120:48 | `foo ${id}` | graphql.js:119:16:119:28 | req.params.id | graphql.js:120:38:120:48 | `foo ${id}` | This query depends on $@. | graphql.js:119:16:119:28 | req.params.id | a user-provided value |
838850
| json-schema-validator.js:33:22:33:26 | query | json-schema-validator.js:25:34:25:47 | req.query.data | json-schema-validator.js:33:22:33:26 | query | This query depends on $@. | json-schema-validator.js:25:34:25:47 | req.query.data | a user-provided value |
839851
| json-schema-validator.js:35:18:35:22 | query | json-schema-validator.js:25:34:25:47 | req.query.data | json-schema-validator.js:35:18:35:22 | query | This query depends on $@. | json-schema-validator.js:25:34:25:47 | req.query.data | a user-provided value |
840852
| json-schema-validator.js:55:22:55:26 | query | json-schema-validator.js:50:34:50:47 | req.query.data | json-schema-validator.js:55:22:55:26 | query | This query depends on $@. | json-schema-validator.js:50:34:50:47 | req.query.data | a user-provided value |

javascript/ql/test/query-tests/Security/CWE-089/untyped/graphql.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,11 @@ app.get('/thing/:id', async function(req, res) {
111111
})
112112
})
113113
});
114+
115+
const github = require('@actions/github');
116+
app.get('/event/:id/', async function(req, res) {
117+
const kit = github.getOctokit("foo")
118+
119+
const id = req.params.id;
120+
const result = await kit.graphql(`foo ${id}`); // NOT OK
121+
});

0 commit comments

Comments
 (0)