Skip to content

Commit 0584aee

Browse files
authored
Merge pull request #18636 from jbj/diff-informed-java-location-fixups
Java: make diff-informed queries exact
2 parents e39ad94 + 7ad6f13 commit 0584aee

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-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
/**

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ module WebviewDebugEnabledConfig implements DataFlow::ConfigSig {
4646
}
4747

4848
predicate observeDiffInformedIncrementalMode() { any() }
49+
50+
Location getASelectedSourceLocation(DataFlow::Node source) {
51+
// This module is only used in `WebviewDebuggingEnabled.ql`, which doesn't
52+
// select the source in any "$@" column.
53+
none()
54+
}
4955
}
5056

5157
/**

0 commit comments

Comments
 (0)