Skip to content

Commit 7fe943d

Browse files
committed
Added support for putForm.
1 parent 69fe251 commit 7fe943d

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
@@ -104,6 +104,8 @@ test_ClientRequest
104104
| tst.js:337:5:337:20 | jsonClient.get() |
105105
| tst.js:340:5:340:21 | jsonClient2.get() |
106106
| tst.js:344:5:344:37 | axios.p ... config) |
107+
| tst.js:345:5:345:28 | axios.p ... , data) |
108+
| tst.js:346:5:346:36 | axios.p ... config) |
107109
test_getADataNode
108110
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:15:18:15:55 | { 'Cont ... json' } |
109111
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:16:15:16:35 | {x: 'te ... 'test'} |
@@ -148,6 +150,8 @@ test_getADataNode
148150
| tst.js:286:20:286:55 | new Web ... :8080') | tst.js:288:21:288:35 | 'Hello Server!' |
149151
| tst.js:321:5:321:32 | superag ... st(url) | tst.js:321:39:321:42 | data |
150152
| tst.js:344:5:344:37 | axios.p ... config) | tst.js:344:25:344:28 | data |
153+
| tst.js:345:5:345:28 | axios.p ... , data) | tst.js:345:24:345:27 | data |
154+
| tst.js:346:5:346:36 | axios.p ... config) | tst.js:346:24:346:27 | data |
151155
test_getHost
152156
| tst.js:87:5:87:39 | http.ge ... host}) | tst.js:87:34:87:37 | host |
153157
| tst.js:89:5:89:23 | axios({host: host}) | tst.js:89:18:89:21 | host |
@@ -271,6 +275,8 @@ test_getUrl
271275
| tst.js:340:5:340:21 | jsonClient2.get() | tst.js:339:42:339:44 | url |
272276
| tst.js:340:5:340:21 | jsonClient2.get() | tst.js:339:61:339:63 | url |
273277
| tst.js:344:5:344:37 | axios.p ... config) | tst.js:344:20:344:22 | url |
278+
| tst.js:345:5:345:28 | axios.p ... , data) | tst.js:345:19:345:21 | url |
279+
| tst.js:346:5:346:36 | axios.p ... config) | tst.js:346:19:346:21 | url |
274280
test_getAResponseDataNode
275281
| axiosTest.js:4:5:7:6 | axios({ ... \\n }) | axiosTest.js:4:5:7:6 | axios({ ... \\n }) | json | true |
276282
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:12:5:17:6 | axios({ ... \\n }) | json | true |
@@ -358,3 +364,5 @@ test_getAResponseDataNode
358364
| tst.js:337:5:337:20 | jsonClient.get() | tst.js:337:5:337:20 | jsonClient.get() | text | true |
359365
| tst.js:340:5:340:21 | jsonClient2.get() | tst.js:340:5:340:21 | jsonClient2.get() | text | true |
360366
| tst.js:344:5:344:37 | axios.p ... config) | tst.js:344:5:344:37 | axios.p ... config) | json | true |
367+
| tst.js:345:5:345:28 | axios.p ... , data) | tst.js:345:5:345:28 | axios.p ... , data) | json | true |
368+
| tst.js:346:5:346:36 | axios.p ... config) | tst.js:346:5:346: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
@@ -342,8 +342,8 @@ function gotTests(url){
342342

343343
function moreAxiosTests(url, data, config){
344344
axios.postForm(url, data, config);
345-
axios.putForm(url, data); // not flagged
346-
axios.putForm(url, data, config); // not flagged
345+
axios.putForm(url, data);
346+
axios.putForm(url, data, config);
347347
axios.patchForm(url, data); // not flagged
348348
axios.patchForm(url, data, config); // not flagged
349349
axios.getUri({ url: url }); // not flagged

0 commit comments

Comments
 (0)