Skip to content

Commit 4360e5d

Browse files
committed
add model of the thenify library
1 parent 61cc415 commit 4360e5d

File tree

4 files changed

+58
-1
lines changed

4 files changed

+58
-1
lines changed

javascript/change-notes/2021-06-21-promisify.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ lgtm,codescanning
22
* Support for libraries modeling `promisify` and `promisifyAll` functions have been improved.
33
Affected packages are
44
[pify](https://www.npmjs.com/package/pify),
5-
[util.promisify](https://www.npmjs.com/package/util.promisify)
5+
[util.promisify](https://www.npmjs.com/package/util.promisify),
6+
[thenify](https://www.npmjs.com/package/thenify)

javascript/ql/src/semmle/javascript/Promises.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,10 @@ module Promisify {
686686
this = DataFlow::moduleImport(["util", "bluebird"]).getAMemberCall("promisify")
687687
or
688688
this = DataFlow::moduleImport(["pify", "util.promisify"]).getACall()
689+
or
690+
this = DataFlow::moduleImport("thenify").getACall()
691+
or
692+
this = DataFlow::moduleMember("thenify", "withCallback").getACall()
689693
}
690694
}
691695
}

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

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2322,6 +2322,23 @@ nodes
23222322
| other-fs-libraries.js:57:46:57:49 | path |
23232323
| other-fs-libraries.js:57:46:57:49 | path |
23242324
| other-fs-libraries.js:57:46:57:49 | path |
2325+
| other-fs-libraries.js:59:39:59:42 | path |
2326+
| other-fs-libraries.js:59:39:59:42 | path |
2327+
| other-fs-libraries.js:59:39:59:42 | path |
2328+
| other-fs-libraries.js:59:39:59:42 | path |
2329+
| other-fs-libraries.js:59:39:59:42 | path |
2330+
| other-fs-libraries.js:59:39:59:42 | path |
2331+
| other-fs-libraries.js:59:39:59:42 | path |
2332+
| other-fs-libraries.js:59:39:59:42 | path |
2333+
| other-fs-libraries.js:59:39:59:42 | path |
2334+
| other-fs-libraries.js:59:39:59:42 | path |
2335+
| other-fs-libraries.js:59:39:59:42 | path |
2336+
| other-fs-libraries.js:59:39:59:42 | path |
2337+
| other-fs-libraries.js:59:39:59:42 | path |
2338+
| other-fs-libraries.js:59:39:59:42 | path |
2339+
| other-fs-libraries.js:59:39:59:42 | path |
2340+
| other-fs-libraries.js:59:39:59:42 | path |
2341+
| other-fs-libraries.js:59:39:59:42 | path |
23252342
| prettier.js:6:11:6:28 | p |
23262343
| prettier.js:6:11:6:28 | p |
23272344
| prettier.js:6:11:6:28 | p |
@@ -6766,6 +6783,38 @@ edges
67666783
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:57:46:57:49 | path |
67676784
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:57:46:57:49 | path |
67686785
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:57:46:57:49 | path |
6786+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6787+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6788+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6789+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6790+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6791+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6792+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6793+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6794+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6795+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6796+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6797+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6798+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6799+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6800+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6801+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6802+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6803+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6804+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6805+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6806+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6807+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6808+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6809+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6810+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6811+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6812+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6813+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6814+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6815+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6816+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
6817+
| other-fs-libraries.js:49:7:49:48 | path | other-fs-libraries.js:59:39:59:42 | path |
67696818
| other-fs-libraries.js:49:14:49:37 | url.par ... , true) | other-fs-libraries.js:49:14:49:43 | url.par ... ).query |
67706819
| other-fs-libraries.js:49:14:49:37 | url.par ... , true) | other-fs-libraries.js:49:14:49:43 | url.par ... ).query |
67716820
| other-fs-libraries.js:49:14:49:37 | url.par ... , true) | other-fs-libraries.js:49:14:49:43 | url.par ... ).query |
@@ -8502,6 +8551,7 @@ edges
85028551
| other-fs-libraries.js:54:36:54:39 | path | other-fs-libraries.js:49:24:49:30 | req.url | other-fs-libraries.js:54:36:54:39 | path | This path depends on $@. | other-fs-libraries.js:49:24:49:30 | req.url | a user-provided value |
85038552
| other-fs-libraries.js:55:36:55:39 | path | other-fs-libraries.js:49:24:49:30 | req.url | other-fs-libraries.js:55:36:55:39 | path | This path depends on $@. | other-fs-libraries.js:49:24:49:30 | req.url | a user-provided value |
85048553
| other-fs-libraries.js:57:46:57:49 | path | other-fs-libraries.js:49:24:49:30 | req.url | other-fs-libraries.js:57:46:57:49 | path | This path depends on $@. | other-fs-libraries.js:49:24:49:30 | req.url | a user-provided value |
8554+
| other-fs-libraries.js:59:39:59:42 | path | other-fs-libraries.js:49:24:49:30 | req.url | other-fs-libraries.js:59:39:59:42 | path | This path depends on $@. | other-fs-libraries.js:49:24:49:30 | req.url | a user-provided value |
85058555
| prettier.js:7:28:7:28 | p | prettier.js:6:13:6:13 | p | prettier.js:7:28:7:28 | p | This path depends on $@. | prettier.js:6:13:6:13 | p | a user-provided value |
85068556
| prettier.js:11:44:11:44 | p | prettier.js:6:13:6:13 | p | prettier.js:11:44:11:44 | p | This path depends on $@. | prettier.js:6:13:6:13 | p | a user-provided value |
85078557
| pupeteer.js:9:28:9:34 | tainted | pupeteer.js:5:28:5:53 | parseTo ... t).name | pupeteer.js:9:28:9:34 | tainted | This path depends on $@. | pupeteer.js:5:28:5:53 | parseTo ... t).name | a user-provided value |

javascript/ql/test/query-tests/Security/CWE-022/TaintedPath/other-fs-libraries.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,6 @@ http.createServer(function(req, res) {
5555
require("pify")(fs).readFileSync(path); // NOT OK
5656

5757
require('util.promisify')(fs.readFileSync)(path); // NOT OK
58+
59+
require("thenify")(fs.readFileSync)(path); // NOT OK
5860
});

0 commit comments

Comments
 (0)