Skip to content

Commit 73fa680

Browse files
committed
Add support for CSV-specified flow to or from fields.
1 parent 200126b commit 73fa680

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,23 @@ predicate summaryElement(DataFlowCallable c, string input, string output, string
7070
)
7171
}
7272

73+
bindingset[name]
74+
private FieldContent interpretField(string name) {
75+
exists(string splitRegex, string package, string className, string fieldName |
76+
splitRegex = "^(.*)\\.([^.]+)\\.([^.]+)$" and
77+
package = name.regexpCapture(splitRegex, 1) and
78+
className = name.regexpCapture(splitRegex, 2) and
79+
fieldName = name.regexpCapture(splitRegex, 3)
80+
|
81+
result.getField().hasQualifiedName(package, className, fieldName)
82+
)
83+
}
84+
7385
/** Gets the summary component for specification component `c`, if any. */
7486
bindingset[c]
7587
SummaryComponent interpretComponentSpecific(string c) {
88+
c.matches("Field %") and result = SummaryComponent::content(interpretField(c.splitAt(" ", 1)))
89+
or
7690
c = "ArrayElement" and result = SummaryComponent::content(any(ArrayContent c0))
7791
or
7892
c = "Element" and result = SummaryComponent::content(any(CollectionContent c0))

0 commit comments

Comments
 (0)