@@ -53,6 +53,7 @@ class SettingRevocationCheckerConfig extends DataFlow2::Configuration {
53
53
54
54
override predicate isAdditionalFlowStep ( DataFlow:: Node node1 , DataFlow:: Node node2 ) {
55
55
createSingletonListStep ( node1 , node2 ) or
56
+ createListOfElementsStep ( node1 , node2 ) or
56
57
convertArrayToListStep ( node1 , node2 ) or
57
58
addToListStep ( node1 , node2 )
58
59
}
@@ -99,20 +100,20 @@ predicate createSingletonListStep(DataFlow::Node node1, DataFlow::Node node2) {
99
100
m .getDeclaringType ( ) instanceof Collections and
100
101
m .hasName ( "singletonList" ) and
101
102
ma .getArgument ( 0 ) = node1 .asExpr ( ) and
102
- ( ma = node2 .asExpr ( ) or ma . getQualifier ( ) = node2 . asExpr ( ) )
103
+ ma = node2 .asExpr ( )
103
104
)
104
105
}
105
106
106
107
/**
107
- * Holds if `node1` to `node2` is a dataflow step that converts an array to a list,class
108
+ * Holds if `node1` to `node2` is a dataflow step that converts an array to a list
108
109
* i.e. `Arrays.asList(element)`.
109
110
*/
110
111
predicate convertArrayToListStep ( DataFlow:: Node node1 , DataFlow:: Node node2 ) {
111
112
exists ( StaticMethodAccess ma , Method m | m = ma .getMethod ( ) |
112
113
m .getDeclaringType ( ) instanceof Arrays and
113
114
m .hasName ( "asList" ) and
114
115
ma .getArgument ( 0 ) = node1 .asExpr ( ) and
115
- ( ma = node2 .asExpr ( ) or ma . getQualifier ( ) = node2 . asExpr ( ) )
116
+ ma = node2 .asExpr ( )
116
117
)
117
118
}
118
119
@@ -128,7 +129,20 @@ predicate addToListStep(DataFlow::Node node1, DataFlow::Node node2) {
128
129
m .hasName ( "addAll" )
129
130
) and
130
131
ma .getArgument ( 0 ) = node1 .asExpr ( ) and
131
- ( ma = node2 .asExpr ( ) or ma .getQualifier ( ) = node2 .asExpr ( ) )
132
+ ma .getQualifier ( ) = node2 .asExpr ( )
133
+ )
134
+ }
135
+
136
+ /**
137
+ * Holds if `node1` to `node2` is a dataflow step that creates a list,
138
+ * i.e. `List.of(element)`.
139
+ */
140
+ predicate createListOfElementsStep ( DataFlow:: Node node1 , DataFlow:: Node node2 ) {
141
+ exists ( StaticMethodAccess ma , Method m | m = ma .getMethod ( ) |
142
+ m .getDeclaringType ( ) instanceof List and
143
+ m .hasName ( "of" ) and
144
+ ma .getAnArgument ( ) = node1 .asExpr ( ) and
145
+ ma = node2 .asExpr ( )
132
146
)
133
147
}
134
148
@@ -176,6 +190,9 @@ class Arrays extends RefType {
176
190
Arrays ( ) { hasQualifiedName ( "java.util" , "Arrays" ) }
177
191
}
178
192
179
- class List extends ParameterizedInterface {
180
- List ( ) { getGenericType ( ) .hasQualifiedName ( "java.util" , "List" ) }
193
+ class List extends RefType {
194
+ List ( ) {
195
+ this .hasQualifiedName ( "java.util" , "List<>" ) or
196
+ this .( ParameterizedInterface ) .getGenericType ( ) .hasQualifiedName ( "java.util" , "List" )
197
+ }
181
198
}
0 commit comments