mirror of
https://github.com/github/codeql.git
synced 2026-05-04 05:05:12 +02:00
add sort-keys as a clone call
This commit is contained in:
@@ -183,7 +183,8 @@ private import semmle.javascript.dataflow.internal.PreCallGraphStep
|
||||
private class CloneStep extends PreCallGraphStep {
|
||||
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
|
||||
exists(DataFlow::CallNode call |
|
||||
call = DataFlow::moduleImport(["clone", "fclone"]).getACall()
|
||||
// `camelcase-keys` isn't quite a cloning library. But it's pretty close.
|
||||
call = DataFlow::moduleImport(["clone", "fclone", "sort-keys", "camelcase-keys"]).getACall()
|
||||
or
|
||||
call = DataFlow::moduleMember("json-cycle", ["decycle", "retrocycle"]).getACall()
|
||||
|
|
||||
|
||||
@@ -72,6 +72,19 @@ app.get('/baz', function(req, res) {
|
||||
obj.p = p;
|
||||
var other = jc.retrocycle(jc.decycle(obj));
|
||||
|
||||
res.send(p); // NOT OK
|
||||
res.send(other.p); // NOT OK
|
||||
});
|
||||
|
||||
const sortKeys = require('sort-keys');
|
||||
|
||||
app.get('/baz', function(req, res) {
|
||||
let { p } = req.params;
|
||||
|
||||
var obj = {};
|
||||
obj.p = p;
|
||||
var other = sortKeys(obj);
|
||||
|
||||
res.send(p); // NOT OK
|
||||
res.send(other.p); // NOT OK
|
||||
});
|
||||
Reference in New Issue
Block a user