mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
add a taint-step for require("bluebird").mapSeries()
This commit is contained in:
@@ -440,6 +440,18 @@ predicate promiseTaintStep(DataFlow::Node pred, DataFlow::Node succ) {
|
||||
pred.getEnclosingExpr() = await.getOperand() and
|
||||
succ.getEnclosingExpr() = await
|
||||
)
|
||||
or
|
||||
exists(DataFlow::CallNode mapSeries |
|
||||
mapSeries = DataFlow::moduleMember("bluebird", "mapSeries").getACall()
|
||||
|
|
||||
// from `xs` to `x` in `require("bluebird").mapSeries(xs, (x) => {...})`.
|
||||
pred = mapSeries.getArgument(0) and
|
||||
succ = mapSeries.getABoundCallbackParameter(1, 0)
|
||||
or
|
||||
// from `y` to `require("bluebird").mapSeries(x, x => y)`.
|
||||
pred = mapSeries.getCallback(1).getAReturn() and
|
||||
succ = mapSeries
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -154,4 +154,15 @@
|
||||
} catch (e) {
|
||||
sink(e); // NOT OK
|
||||
}
|
||||
})();
|
||||
})();
|
||||
|
||||
(function () {
|
||||
var source = "source";
|
||||
|
||||
var bluebird = require("bluebird");
|
||||
|
||||
bluebird.mapSeries(source, x => sink(x)); // NOT OK (for taint-tracking configs)
|
||||
|
||||
const foo = bluebird.mapSeries(source, x => x);
|
||||
sink(foo); // NOT OK (for taint-tracking configs)
|
||||
})
|
||||
@@ -237,6 +237,8 @@ flow
|
||||
exclusiveTaintFlow
|
||||
| flow2.js:2:15:2:22 | "source" | flow2.js:20:7:20:14 | tainted3 |
|
||||
| flow.js:136:15:136:22 | "source" | flow.js:141:7:141:13 | async() |
|
||||
| flow.js:160:15:160:22 | "source" | flow.js:164:39:164:39 | x |
|
||||
| flow.js:160:15:160:22 | "source" | flow.js:167:7:167:9 | foo |
|
||||
| interflow.js:3:18:3:25 | "source" | interflow.js:18:10:18:14 | error |
|
||||
typetrack
|
||||
| flow2.js:4:2:4:31 | Promise ... lean"]) | flow2.js:4:14:4:30 | [source, "clean"] | copy $PromiseResolveField$ |
|
||||
|
||||
Reference in New Issue
Block a user