Skip to content

Commit ffb2679

Browse files
Jami CogswellJami Cogswell
authored andcommitted
Java: add endsWith additionalTaintStep to ConditionalBypassFlowConfig
1 parent e044444 commit ffb2679

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ predicate conditionControlsMethod(MethodAccess ma, Expr e) {
2323
)
2424
}
2525

26+
/**
27+
* Holds if `node1` to `node2` is a dataflow step through the
28+
* `endsWith` method of the `java.lang.String` class.
29+
*/
30+
private predicate endsWithStep(DataFlow::Node node1, DataFlow::Node node2) {
31+
exists(MethodAccess ma |
32+
ma.getMethod().getDeclaringType() instanceof TypeString and
33+
ma.getMethod().getName() = "endsWith" and
34+
ma.getQualifier() = node1.asExpr() and
35+
ma = node2.asExpr()
36+
)
37+
}
38+
2639
/**
2740
* A taint tracking configuration for untrusted data flowing to sensitive conditions.
2841
*/
@@ -32,4 +45,8 @@ class ConditionalBypassFlowConfig extends TaintTracking::Configuration {
3245
override predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
3346

3447
override predicate isSink(DataFlow::Node sink) { conditionControlsMethod(_, sink.asExpr()) }
48+
49+
override predicate isAdditionalTaintStep(DataFlow::Node node1, DataFlow::Node node2) {
50+
endsWithStep(node1, node2)
51+
}
3552
}

0 commit comments

Comments
 (0)