Skip to content

Commit ad60662

Browse files
committed
Added support for putForm.
1 parent 0f9e1bf commit ad60662

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"]
225+
method = [httpMethodName(), "request", "postForm", "putForm"]
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"] and result = this.getArgument(1)
257+
method = ["postForm", "putForm"] 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
@@ -98,6 +98,8 @@ test_ClientRequest
9898
| tst.js:320:5:320:23 | superagent.del(url) |
9999
| tst.js:321:5:321:32 | superag ... st(url) |
100100
| tst.js:325:5:325:37 | axios.p ... config) |
101+
| tst.js:326:5:326:28 | axios.p ... , data) |
102+
| tst.js:327:5:327:36 | axios.p ... config) |
101103
test_getADataNode
102104
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:15:18:15:55 | { 'Cont ... json' } |
103105
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:16:15:16:35 | {x: 'te ... 'test'} |
@@ -142,6 +144,8 @@ test_getADataNode
142144
| tst.js:286:20:286:55 | new Web ... :8080') | tst.js:288:21:288:35 | 'Hello Server!' |
143145
| tst.js:321:5:321:32 | superag ... st(url) | tst.js:321:39:321:42 | data |
144146
| tst.js:325:5:325:37 | axios.p ... config) | tst.js:325:25:325:28 | data |
147+
| tst.js:326:5:326:28 | axios.p ... , data) | tst.js:326:24:326:27 | data |
148+
| tst.js:327:5:327:36 | axios.p ... config) | tst.js:327:24:327:27 | data |
145149
test_getHost
146150
| tst.js:87:5:87:39 | http.ge ... host}) | tst.js:87:34:87:37 | host |
147151
| tst.js:89:5:89:23 | axios({host: host}) | tst.js:89:18:89:21 | host |
@@ -257,6 +261,8 @@ test_getUrl
257261
| tst.js:320:5:320:23 | superagent.del(url) | tst.js:320:20:320:22 | url |
258262
| tst.js:321:5:321:32 | superag ... st(url) | tst.js:321:29:321:31 | url |
259263
| tst.js:325:5:325:37 | axios.p ... config) | tst.js:325:20:325:22 | url |
264+
| tst.js:326:5:326:28 | axios.p ... , data) | tst.js:326:19:326:21 | url |
265+
| tst.js:327:5:327:36 | axios.p ... config) | tst.js:327:19:327:21 | url |
260266
test_getAResponseDataNode
261267
| axiosTest.js:4:5:7:6 | axios({ ... \\n }) | axiosTest.js:4:5:7:6 | axios({ ... \\n }) | json | true |
262268
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:12:5:17:6 | axios({ ... \\n }) | json | true |
@@ -338,3 +344,5 @@ test_getAResponseDataNode
338344
| tst.js:320:5:320:23 | superagent.del(url) | tst.js:320:5:320:23 | superagent.del(url) | stream | true |
339345
| tst.js:321:5:321:32 | superag ... st(url) | tst.js:321:5:321:32 | superag ... st(url) | stream | true |
340346
| tst.js:325:5:325:37 | axios.p ... config) | tst.js:325:5:325:37 | axios.p ... config) | json | true |
347+
| tst.js:326:5:326:28 | axios.p ... , data) | tst.js:326:5:326:28 | axios.p ... , data) | json | true |
348+
| tst.js:327:5:327:36 | axios.p ... config) | tst.js:327:5:327:36 | 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
@@ -323,8 +323,8 @@ function useSuperagent(url){
323323

324324
function moreAxiosTests(url, data, config){
325325
axios.postForm(url, data, config);
326-
axios.putForm(url, data); // not flagged
327-
axios.putForm(url, data, config); // not flagged
326+
axios.putForm(url, data);
327+
axios.putForm(url, data, config);
328328
axios.patchForm(url, data); // not flagged
329329
axios.patchForm(url, data, config); // not flagged
330330
axios.getUri({ url: url }); // not flagged

0 commit comments

Comments
 (0)