Skip to content

Commit 650c4f1

Browse files
committed
Java: More qldoc.
1 parent 922b421 commit 650c4f1

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

java/ql/src/semmle/code/java/dataflow/internal/ContainerFlow.qll

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,11 @@ predicate containerStep(Expr n1, Expr n2) {
710710
containerUpdateStep(n1, n2)
711711
}
712712

713+
/**
714+
* Holds if the step from `node1` to `node2` stores a value in an array.
715+
* This covers array assignments and initializers as well as implicit array
716+
* creations for varargs.
717+
*/
713718
predicate arrayStoreStep(Node node1, Node node2) {
714719
exists(Argument arg |
715720
node1.asExpr() = arg and
@@ -734,6 +739,11 @@ private predicate enhancedForStmtStep(Node node1, Node node2, Type containerType
734739
)
735740
}
736741

742+
/**
743+
* Holds if the step from `node1` to `node2` reads a value from an array.
744+
* This covers ordinary array reads as well as array iteration through enhanced
745+
* `for` statements.
746+
*/
737747
predicate arrayReadStep(Node node1, Node node2, Type elemType) {
738748
exists(ArrayAccess aa |
739749
aa.getArray() = node1.asExpr() and
@@ -747,6 +757,10 @@ predicate arrayReadStep(Node node1, Node node2, Type elemType) {
747757
)
748758
}
749759

760+
/**
761+
* Holds if the step from `node1` to `node2` reads a value from a collection.
762+
* This only covers iteration through enhanced `for` statements.
763+
*/
750764
predicate collectionReadStep(Node node1, Node node2) {
751765
enhancedForStmtStep(node1, node2, any(Type t | not t instanceof Array))
752766
}

java/ql/src/semmle/code/java/dataflow/internal/TaintTrackingUtil.qll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,17 @@ private module Cached {
9898

9999
import Cached
100100

101+
/**
102+
* These configurations add a number of configuration-dependent additional taint
103+
* steps to all taint configurations. For each sink or additional step provided
104+
* by a given configuration the types are inspected to find those implicit
105+
* collection or array read steps that might be required at the sink or step
106+
* input. The corresponding store steps are then added as additional taint steps
107+
* to provide backwards-compatible taint flow to such sinks and steps.
108+
*
109+
* This is a temporary measure until support is added for such sinks that
110+
* require implicit read steps.
111+
*/
101112
private module StoreTaintSteps {
102113
private import semmle.code.java.dataflow.TaintTracking
103114
private import semmle.code.java.dataflow.TaintTracking2

0 commit comments

Comments
 (0)