Skip to content

Commit cf8637f

Browse files
committed
Added support for axios.create.
1 parent df32215 commit cf8637f

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

javascript/ql/lib/semmle/javascript/frameworks/ClientRequests.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ module ClientRequest {
223223
or
224224
this = axios().getMember(method).getACall() and
225225
method = [httpMethodName(), "request", "postForm", "putForm", "patchForm", "getUri"]
226+
or
227+
this = axios().getMember("create").getReturn().getACall() and
228+
method = "request"
226229
}
227230

228231
private int getOptionsArgIndex() {

javascript/ql/test/library-tests/frameworks/ClientRequests/ClientRequests.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ test_ClientRequest
103103
| tst.js:328:5:328:30 | axios.p ... , data) |
104104
| tst.js:329:5:329:38 | axios.p ... config) |
105105
| tst.js:330:5:330:30 | axios.g ... url }) |
106+
| tst.js:333:5:333:66 | axiosIn ... text"}) |
106107
test_getADataNode
107108
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:15:18:15:55 | { 'Cont ... json' } |
108109
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:16:15:16:35 | {x: 'te ... 'test'} |
@@ -271,6 +272,8 @@ test_getUrl
271272
| tst.js:328:5:328:30 | axios.p ... , data) | tst.js:328:21:328:23 | url |
272273
| tst.js:329:5:329:38 | axios.p ... config) | tst.js:329:21:329:23 | url |
273274
| tst.js:330:5:330:30 | axios.g ... url }) | tst.js:330:18:330:29 | { url: url } |
275+
| tst.js:333:5:333:66 | axiosIn ... text"}) | tst.js:333:19:333:65 | {method ... "text"} |
276+
| tst.js:333:5:333:66 | axiosIn ... text"}) | tst.js:333:40:333:42 | url |
274277
test_getAResponseDataNode
275278
| axiosTest.js:4:5:7:6 | axios({ ... \\n }) | axiosTest.js:4:5:7:6 | axios({ ... \\n }) | json | true |
276279
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:12:5:17:6 | axios({ ... \\n }) | json | true |
@@ -357,3 +360,4 @@ test_getAResponseDataNode
357360
| tst.js:328:5:328:30 | axios.p ... , data) | tst.js:328:5:328:30 | axios.p ... , data) | json | true |
358361
| tst.js:329:5:329:38 | axios.p ... config) | tst.js:329:5:329:38 | axios.p ... config) | json | true |
359362
| tst.js:330:5:330:30 | axios.g ... url }) | tst.js:330:5:330:30 | axios.g ... url }) | json | true |
363+
| tst.js:333:5:333:66 | axiosIn ... text"}) | tst.js:333:5:333:66 | axiosIn ... text"}) | text | true |

javascript/ql/test/library-tests/frameworks/ClientRequests/tst.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,5 +330,5 @@ function moreAxiosTests(url, data, config){
330330
axios.getUri({ url: url });
331331

332332
const axiosInstance = axios.create({});
333-
axiosInstance({method: "get", url: url, responseType: "text"}); // Not flagged
333+
axiosInstance({method: "get", url: url, responseType: "text"});
334334
}

0 commit comments

Comments
 (0)