@@ -150,20 +150,6 @@ class ParseFunction extends Function {
150150 }
151151}
152152
153- /*
154- * class CreateLSParser extends Function {
155- * CreateLSParser() { this.hasName("createLSParser") }
156- * }
157- *
158- * class SetSecurityManager extends Function {
159- * SetSecurityManager() { this.hasQualifiedName(_, "AbstractDOMParser", "setSecurityManager") }
160- * }
161- *
162- * class SAXParser extends Class {
163- * SAXParser() { this.hasName("SAXParser") }
164- * }
165- */
166-
167153/**
168154 * Configuration for tracking Xerces library XML objects and their states.
169155 */
@@ -179,23 +165,7 @@ class XercesXXEConfiguration extends DataFlow::Configuration {
179165 call .getThisArgument ( ) and
180166 encodeXercesDOMFlowState ( flowstate , 0 , 1 ) // default configuration
181167 )
182- /*
183- * or
184- * exists(Call call |
185- * call.getTarget() instanceof CreateLSParser and
186- * call = node.asExpr() and
187- * flowstate = "XercesDOM"
188- * )
189- * or
190- * exists(CallInstruction call |
191- * node.asInstruction().(WriteSideEffectInstruction).getDestinationAddress() =
192- * call.getThisArgument() and
193- * call.getStaticCallTarget().(Constructor).getDeclaringType() instanceof SAXParser and
194- * flowstate = "SAXParser"
195- * )
196- */
197-
198- }
168+ }
199169
200170 override predicate isSink ( DataFlow:: Node node , string flowstate ) {
201171 // sink is the read of the qualifier of a call to `parse`.
@@ -213,46 +183,15 @@ class XercesXXEConfiguration extends DataFlow::Configuration {
213183 // create additional flow steps for `XXEFlowStateTranformer`s
214184 state2 = node2 .asConvertedExpr ( ) .( XXEFlowStateTranformer ) .transform ( state1 ) and
215185 DataFlow:: simpleLocalFlowStep ( node1 , node2 )
216- /*
217- * exists(CallInstruction call |
218- * node.asInstruction().(WriteSideEffectInstruction).getDestinationAddress() =
219- * call.getThisArgument() and
220- * call.getStaticCallTarget().(Constructor).getDeclaringType() instanceof SAXParser and
221- * flowstate = "SAXParser"
222- * )
223- */
224-
225- }
186+ }
226187
227188 override predicate isBarrierOut ( DataFlow:: Node node , string flowstate ) {
228189 // when the flowstate is transformed at a call node, block the original
229190 // flowstate value.
230191 node .asConvertedExpr ( ) .( XXEFlowStateTranformer ) .transform ( flowstate ) != flowstate
231- /*
232- * or
233- * exists(Call setSecurityManager |
234- * // todo: security manager setup
235- * flowstate = TODO
236- * setSecurityManager.getQualifier() = node.asDefiningArgument() and
237- * setSecurityManager.getTarget() instanceof SetSecurityManager
238- * )
239- */
240-
241- }
192+ }
242193}
243194
244- /*
245- * TODO:
246- * parser created
247- * needs doSchema set?
248- * needs validation set?
249- * needs namespaces?
250- * (
251- * no security manager
252- * OR
253- * no
254- */
255-
256195from XercesXXEConfiguration conf , DataFlow:: PathNode source , DataFlow:: PathNode sink
257196where conf .hasFlowPath ( source , sink )
258197select sink , source , sink ,
0 commit comments