Skip to content

Commit f48a362

Browse files
committed
Added support for patchForm.
1 parent 7fe943d commit f48a362

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
@@ -106,6 +106,8 @@ test_ClientRequest
106106
| tst.js:344:5:344:37 | axios.p ... config) |
107107
| tst.js:345:5:345:28 | axios.p ... , data) |
108108
| tst.js:346:5:346:36 | axios.p ... config) |
109+
| tst.js:347:5:347:30 | axios.p ... , data) |
110+
| tst.js:348:5:348:38 | axios.p ... config) |
109111
test_getADataNode
110112
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:15:18:15:55 | { 'Cont ... json' } |
111113
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:16:15:16:35 | {x: 'te ... 'test'} |
@@ -152,6 +154,8 @@ test_getADataNode
152154
| tst.js:344:5:344:37 | axios.p ... config) | tst.js:344:25:344:28 | data |
153155
| tst.js:345:5:345:28 | axios.p ... , data) | tst.js:345:24:345:27 | data |
154156
| tst.js:346:5:346:36 | axios.p ... config) | tst.js:346:24:346:27 | data |
157+
| tst.js:347:5:347:30 | axios.p ... , data) | tst.js:347:26:347:29 | data |
158+
| tst.js:348:5:348:38 | axios.p ... config) | tst.js:348:26:348:29 | data |
155159
test_getHost
156160
| tst.js:87:5:87:39 | http.ge ... host}) | tst.js:87:34:87:37 | host |
157161
| tst.js:89:5:89:23 | axios({host: host}) | tst.js:89:18:89:21 | host |
@@ -277,6 +281,8 @@ test_getUrl
277281
| tst.js:344:5:344:37 | axios.p ... config) | tst.js:344:20:344:22 | url |
278282
| tst.js:345:5:345:28 | axios.p ... , data) | tst.js:345:19:345:21 | url |
279283
| tst.js:346:5:346:36 | axios.p ... config) | tst.js:346:19:346:21 | url |
284+
| tst.js:347:5:347:30 | axios.p ... , data) | tst.js:347:21:347:23 | url |
285+
| tst.js:348:5:348:38 | axios.p ... config) | tst.js:348:21:348:23 | url |
280286
test_getAResponseDataNode
281287
| axiosTest.js:4:5:7:6 | axios({ ... \\n }) | axiosTest.js:4:5:7:6 | axios({ ... \\n }) | json | true |
282288
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:12:5:17:6 | axios({ ... \\n }) | json | true |
@@ -366,3 +372,5 @@ test_getAResponseDataNode
366372
| tst.js:344:5:344:37 | axios.p ... config) | tst.js:344:5:344:37 | axios.p ... config) | json | true |
367373
| tst.js:345:5:345:28 | axios.p ... , data) | tst.js:345:5:345:28 | axios.p ... , data) | json | true |
368374
| tst.js:346:5:346:36 | axios.p ... config) | tst.js:346:5:346:36 | axios.p ... config) | json | true |
375+
| tst.js:347:5:347:30 | axios.p ... , data) | tst.js:347:5:347:30 | axios.p ... , data) | json | true |
376+
| tst.js:348:5:348:38 | axios.p ... config) | tst.js:348:5:348: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
@@ -344,7 +344,7 @@ function moreAxiosTests(url, data, config){
344344
axios.postForm(url, data, config);
345345
axios.putForm(url, data);
346346
axios.putForm(url, data, config);
347-
axios.patchForm(url, data); // not flagged
348-
axios.patchForm(url, data, config); // not flagged
347+
axios.patchForm(url, data);
348+
axios.patchForm(url, data, config);
349349
axios.getUri({ url: url }); // not flagged
350350
}

0 commit comments

Comments
 (0)