add class-field flowstep to js/shell-command-constructed-from-input

This commit is contained in:
Erik Krogh Kristensen
2021-01-06 14:30:24 +01:00
parent 5a9e098479
commit f1cee70e82
3 changed files with 35 additions and 1 deletions

View File

@@ -41,5 +41,15 @@ module UnsafeShellCommandConstruction {
mid.getPathSummary().hasReturn() = false
)
}
override predicate isAdditionalTaintStep(DataFlow::Node pred, DataFlow::Node succ) {
// flow-step from a property written in the constructor to a use in an instance method.
// "simulates" client usage of a class, and regains some flow-steps lost by `hasFlowPath` above.
exists(DataFlow::ClassNode clz, string name |
pred =
DataFlow::thisNode(clz.getConstructor().getFunction()).getAPropertyWrite(name).getRhs() and
succ = DataFlow::thisNode(clz.getInstanceMethod(_).getFunction()).getAPropertyRead(name)
)
}
}
}