Skip to content

Commit de07546

Browse files
committed
Added support for patchForm.
1 parent ad60662 commit de07546

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ module ClientRequest {
222222
method = "request"
223223
or
224224
this = axios().getMember(method).getACall() and
225-
method = [httpMethodName(), "request", "postForm", "putForm"]
225+
method = [httpMethodName(), "request", "postForm", "putForm", "patchForm"]
226226
}
227227

228228
private int getOptionsArgIndex() {
@@ -254,7 +254,7 @@ module ClientRequest {
254254
method = ["post", "put"] and
255255
result = [this.getArgument(1), this.getOptionArgument(2, "data")]
256256
or
257-
method = ["postForm", "putForm"] and result = this.getArgument(1)
257+
method = ["postForm", "putForm", "patchForm"] and result = this.getArgument(1)
258258
or
259259
result = this.getOptionArgument([0 .. 2], ["headers", "params"])
260260
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ test_ClientRequest
100100
| tst.js:325:5:325:37 | axios.p ... config) |
101101
| tst.js:326:5:326:28 | axios.p ... , data) |
102102
| tst.js:327:5:327:36 | axios.p ... config) |
103+
| tst.js:328:5:328:30 | axios.p ... , data) |
104+
| tst.js:329:5:329:38 | axios.p ... config) |
103105
test_getADataNode
104106
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:15:18:15:55 | { 'Cont ... json' } |
105107
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:16:15:16:35 | {x: 'te ... 'test'} |
@@ -146,6 +148,8 @@ test_getADataNode
146148
| tst.js:325:5:325:37 | axios.p ... config) | tst.js:325:25:325:28 | data |
147149
| tst.js:326:5:326:28 | axios.p ... , data) | tst.js:326:24:326:27 | data |
148150
| tst.js:327:5:327:36 | axios.p ... config) | tst.js:327:24:327:27 | data |
151+
| tst.js:328:5:328:30 | axios.p ... , data) | tst.js:328:26:328:29 | data |
152+
| tst.js:329:5:329:38 | axios.p ... config) | tst.js:329:26:329:29 | data |
149153
test_getHost
150154
| tst.js:87:5:87:39 | http.ge ... host}) | tst.js:87:34:87:37 | host |
151155
| tst.js:89:5:89:23 | axios({host: host}) | tst.js:89:18:89:21 | host |
@@ -263,6 +267,8 @@ test_getUrl
263267
| tst.js:325:5:325:37 | axios.p ... config) | tst.js:325:20:325:22 | url |
264268
| tst.js:326:5:326:28 | axios.p ... , data) | tst.js:326:19:326:21 | url |
265269
| tst.js:327:5:327:36 | axios.p ... config) | tst.js:327:19:327:21 | url |
270+
| tst.js:328:5:328:30 | axios.p ... , data) | tst.js:328:21:328:23 | url |
271+
| tst.js:329:5:329:38 | axios.p ... config) | tst.js:329:21:329:23 | url |
266272
test_getAResponseDataNode
267273
| axiosTest.js:4:5:7:6 | axios({ ... \\n }) | axiosTest.js:4:5:7:6 | axios({ ... \\n }) | json | true |
268274
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:12:5:17:6 | axios({ ... \\n }) | json | true |
@@ -346,3 +352,5 @@ test_getAResponseDataNode
346352
| tst.js:325:5:325:37 | axios.p ... config) | tst.js:325:5:325:37 | axios.p ... config) | json | true |
347353
| tst.js:326:5:326:28 | axios.p ... , data) | tst.js:326:5:326:28 | axios.p ... , data) | json | true |
348354
| tst.js:327:5:327:36 | axios.p ... config) | tst.js:327:5:327:36 | axios.p ... config) | json | true |
355+
| tst.js:328:5:328:30 | axios.p ... , data) | tst.js:328:5:328:30 | axios.p ... , data) | json | true |
356+
| tst.js:329:5:329:38 | axios.p ... config) | tst.js:329:5:329:38 | axios.p ... config) | json | true |

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ function moreAxiosTests(url, data, config){
325325
axios.postForm(url, data, config);
326326
axios.putForm(url, data);
327327
axios.putForm(url, data, config);
328-
axios.patchForm(url, data); // not flagged
329-
axios.patchForm(url, data, config); // not flagged
328+
axios.patchForm(url, data);
329+
axios.patchForm(url, data, config);
330330
axios.getUri({ url: url }); // not flagged
331331
}

0 commit comments

Comments
 (0)