Skip to content

Commit 4617827

Browse files
authored
Merge pull request #213 from asger-semmle/sendfile
Approved by xiemaisi
2 parents d2f11dc + 6f109a7 commit 4617827

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

javascript/ql/src/semmle/javascript/frameworks/Express.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,8 @@ module Express {
785785
override MethodCallExpr astNode;
786786

787787
ResponseSendFileAsFileSystemAccess() {
788-
asExpr().(MethodCallExpr).calls(any(ResponseExpr res), "sendFile")
788+
exists (string name | name = "sendFile" or name = "sendfile" |
789+
asExpr().(MethodCallExpr).calls(any(ResponseExpr res), name))
789790
}
790791

791792
override DataFlow::Node getAPathArgument() {

javascript/ql/test/query-tests/Security/CWE-022/TaintedPath.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@
2525
| tainted-array-steps.js:15:29:15:43 | parts.join('/') | This path depends on $@. | tainted-array-steps.js:9:24:9:30 | req.url | a user-provided value |
2626
| tainted-require.js:7:19:7:37 | req.param("module") | This path depends on $@. | tainted-require.js:7:19:7:37 | req.param("module") | a user-provided value |
2727
| tainted-sendFile.js:7:16:7:33 | req.param("gimme") | This path depends on $@. | tainted-sendFile.js:7:16:7:33 | req.param("gimme") | a user-provided value |
28+
| tainted-sendFile.js:9:16:9:33 | req.param("gimme") | This path depends on $@. | tainted-sendFile.js:9:16:9:33 | req.param("gimme") | a user-provided value |
2829
| views.js:1:43:1:55 | req.params[0] | This path depends on $@. | views.js:1:43:1:55 | req.params[0] | a user-provided value |

javascript/ql/test/query-tests/Security/CWE-022/tainted-sendFile.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ var app = express();
55
app.get('/some/path', function(req, res) {
66
// BAD: sending a file based on un-sanitized query parameters
77
res.sendFile(req.param("gimme"));
8+
// BAD: same as above
9+
res.sendfile(req.param("gimme"));
810
});

0 commit comments

Comments
 (0)