@@ -66,7 +66,7 @@ private module XmlEtree {
6666
6767 override DataFlow:: Node getAnInput ( ) { result in [ this .getArg ( 0 ) , this .getArgByName ( "data" ) ] }
6868
69- override predicate vulnerableTo ( XML:: XMLVulnerabilityKind kind ) {
69+ override predicate vulnerableTo ( XML:: XMLParsingVulnerabilityKind kind ) {
7070 kind .isBillionLaughs ( ) or kind .isQuadraticBlowup ( )
7171 }
7272 }
@@ -103,7 +103,7 @@ private module XmlEtree {
103103 ]
104104 }
105105
106- override predicate vulnerableTo ( XML:: XMLVulnerabilityKind kind ) {
106+ override predicate vulnerableTo ( XML:: XMLParsingVulnerabilityKind kind ) {
107107 // note: it does not matter what `xml.etree` parser you are using, you cannot
108108 // change the security features anyway :|
109109 kind .isBillionLaughs ( ) or kind .isQuadraticBlowup ( )
@@ -218,7 +218,7 @@ private module SaxBasedParsing {
218218
219219 override DataFlow:: Node getAnInput ( ) { result in [ this .getArg ( 0 ) , this .getArgByName ( "source" ) ] }
220220
221- override predicate vulnerableTo ( XML:: XMLVulnerabilityKind kind ) {
221+ override predicate vulnerableTo ( XML:: XMLParsingVulnerabilityKind kind ) {
222222 // always vuln to these
223223 ( kind .isBillionLaughs ( ) or kind .isQuadraticBlowup ( ) )
224224 or
@@ -251,7 +251,7 @@ private module SaxBasedParsing {
251251 ]
252252 }
253253
254- override predicate vulnerableTo ( XML:: XMLVulnerabilityKind kind ) {
254+ override predicate vulnerableTo ( XML:: XMLParsingVulnerabilityKind kind ) {
255255 // always vuln to these
256256 ( kind .isBillionLaughs ( ) or kind .isQuadraticBlowup ( ) )
257257 or
@@ -290,7 +290,7 @@ private module SaxBasedParsing {
290290
291291 DataFlow:: Node getParserArg ( ) { result in [ this .getArg ( 1 ) , this .getArgByName ( "parser" ) ] }
292292
293- override predicate vulnerableTo ( XML:: XMLVulnerabilityKind kind ) {
293+ override predicate vulnerableTo ( XML:: XMLParsingVulnerabilityKind kind ) {
294294 this .getParserArg ( ) = saxParserWithFeatureExternalGesTurnedOn ( ) and
295295 ( kind .isXxe ( ) or kind .isDtdRetrieval ( ) )
296296 or
@@ -317,7 +317,7 @@ private module Lxml {
317317 */
318318 abstract class InstanceSource extends DataFlow:: LocalSourceNode {
319319 /** Holds if this instance is vulnerable to `kind`. */
320- abstract predicate vulnerableTo ( XML:: XMLVulnerabilityKind kind ) ;
320+ abstract predicate vulnerableTo ( XML:: XMLParsingVulnerabilityKind kind ) ;
321321 }
322322
323323 /**
@@ -331,7 +331,7 @@ private module Lxml {
331331 }
332332
333333 // NOTE: it's not possible to change settings of a parser after constructing it
334- override predicate vulnerableTo ( XML:: XMLVulnerabilityKind kind ) {
334+ override predicate vulnerableTo ( XML:: XMLParsingVulnerabilityKind kind ) {
335335 kind .isXxe ( ) and
336336 (
337337 // resolve_entities has default True
@@ -361,7 +361,7 @@ private module Lxml {
361361 API:: moduleImport ( "lxml" ) .getMember ( "etree" ) .getMember ( "get_default_parser" ) .getACall ( )
362362 }
363363
364- override predicate vulnerableTo ( XML:: XMLVulnerabilityKind kind ) {
364+ override predicate vulnerableTo ( XML:: XMLParsingVulnerabilityKind kind ) {
365365 // as highlighted by
366366 // https://lxml.de/apidoc/lxml.etree.html?highlight=xmlparser#lxml.etree.XMLParser
367367 // by default XXE is allow. so as long as the default parser has not been
@@ -385,7 +385,7 @@ private module Lxml {
385385 }
386386
387387 /** Gets a reference to an `lxml.etree` parser instance, that is vulnerable to `kind`. */
388- DataFlow:: Node instanceVulnerableTo ( XML:: XMLVulnerabilityKind kind ) {
388+ DataFlow:: Node instanceVulnerableTo ( XML:: XMLParsingVulnerabilityKind kind ) {
389389 exists ( InstanceSource origin | result = instance ( origin ) and origin .vulnerableTo ( kind ) )
390390 }
391391
@@ -397,7 +397,7 @@ private module Lxml {
397397
398398 override DataFlow:: Node getAnInput ( ) { result in [ this .getArg ( 0 ) , this .getArgByName ( "data" ) ] }
399399
400- override predicate vulnerableTo ( XML:: XMLVulnerabilityKind kind ) {
400+ override predicate vulnerableTo ( XML:: XMLParsingVulnerabilityKind kind ) {
401401 this .calls ( instanceVulnerableTo ( kind ) , "feed" )
402402 }
403403 }
@@ -436,7 +436,7 @@ private module Lxml {
436436
437437 DataFlow:: Node getParserArg ( ) { result in [ this .getArg ( 1 ) , this .getArgByName ( "parser" ) ] }
438438
439- override predicate vulnerableTo ( XML:: XMLVulnerabilityKind kind ) {
439+ override predicate vulnerableTo ( XML:: XMLParsingVulnerabilityKind kind ) {
440440 this .getParserArg ( ) = XMLParser:: instanceVulnerableTo ( kind )
441441 or
442442 kind .isXxe ( ) and
@@ -456,7 +456,7 @@ private module Xmltodict {
456456 result in [ this .getArg ( 0 ) , this .getArgByName ( "xml_input" ) ]
457457 }
458458
459- override predicate vulnerableTo ( XML:: XMLVulnerabilityKind kind ) {
459+ override predicate vulnerableTo ( XML:: XMLParsingVulnerabilityKind kind ) {
460460 ( kind .isBillionLaughs ( ) or kind .isQuadraticBlowup ( ) ) and
461461 this .getArgByName ( "disable_entities" ) .getALocalSource ( ) .asExpr ( ) = any ( False f )
462462 }
0 commit comments