mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Java: cover wrapped constructor taint flow
This commit is contained in:
@@ -697,3 +697,15 @@ predicate summaryStep(Node node1, Node node2, string kind) {
|
||||
interpretOutput(output, 0, ref, TNode(node2))
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `node1` to `node2` is specified as a flow step with the given kind, input and output
|
||||
* in a CSV flow model.
|
||||
*/
|
||||
predicate summaryStep(Node node1, Node node2, string kind, string input, string output) {
|
||||
exists(Top ref |
|
||||
summaryElementRef(ref, input, output, kind) and
|
||||
interpretInput(input, 0, ref, TNode(node1)) and
|
||||
interpretOutput(output, 0, ref, TNode(node2))
|
||||
)
|
||||
}
|
||||
|
||||
@@ -166,6 +166,9 @@ private predicate inputStreamWrapper(Constructor c, int argi) {
|
||||
/** An object construction that preserves the data flow status of any of its arguments. */
|
||||
private predicate constructorStep(Expr tracked, ConstructorCall sink) {
|
||||
exists(int argi | sink.getArgument(argi) = tracked |
|
||||
summaryStep(any(DataFlow::Node n | n.asExpr() = tracked),
|
||||
any(DataFlow::Node n | n.asExpr() = sink), "taint", "Argument(" + argi + ")", "ReturnValue")
|
||||
or
|
||||
// wrappers constructed by extension
|
||||
exists(Constructor c, Parameter p, SuperConstructorInvocationStmt sup |
|
||||
c = sink.getConstructor() and
|
||||
|
||||
Reference in New Issue
Block a user