Skip to content

Commit 7ad6f13

Browse files
committed
Java: adjust CommandLineQuery locations
It turns out these locations need to be precise.
1 parent eacc600 commit 7ad6f13

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

java/ql/lib/semmle/code/java/security/CommandLineQuery.qll

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,15 @@ module InputToArgumentToExecFlowConfig implements DataFlow::ConfigSig {
5959
any(CommandInjectionAdditionalTaintStep s).step(n1, n2)
6060
}
6161

62-
// It's valid to use diff-informed data flow for this configuration because
63-
// the location of the selected element in the query is contained inside the
64-
// location of the sink. The query, as a predicate, is used negated in
65-
// another query, but that's only to prevent overlapping results between two
66-
// queries.
62+
// The query, as a predicate, is used negated in another query, but that's
63+
// only to prevent overlapping results between two queries.
6764
predicate observeDiffInformedIncrementalMode() { any() }
65+
66+
// All queries use the argument as the primary location and do not use the
67+
// sink as an associated location.
68+
Location getASelectedSinkLocation(DataFlow::Node sink) {
69+
exists(Expr argument | argumentToExec(argument, sink) | result = argument.getLocation())
70+
}
6871
}
6972

7073
/**

0 commit comments

Comments
 (0)