@@ -359,27 +359,21 @@ module AiohttpWebModel {
359359 */
360360 private class AiohttpStreamReaderAdditionalTaintStep extends TaintTracking:: AdditionalTaintStep {
361361 override predicate step ( DataFlow:: Node nodeFrom , DataFlow:: Node nodeTo ) {
362- // Methods
363- //
364- // TODO: When we have tools that make it easy, model these properly to handle
365- // `meth = obj.meth; meth()`. Until then, we'll use this more syntactic approach
366- // (since it allows us to at least capture the most common cases).
367- nodeFrom = StreamReader:: instance ( ) and
368- exists ( DataFlow:: AttrRead attr | attr .getObject ( ) = nodeFrom |
369- // normal methods
370- attr .getAttributeName ( ) in [ "read_nowait" ] and
371- nodeTo .( DataFlow:: CallCfgNode ) .getFunction ( ) = attr
372- or
373- // async methods
374- exists ( Await await , DataFlow:: CallCfgNode call |
375- attr .getAttributeName ( ) in [
376- "read" , "readany" , "readexactly" , "readline" , "readchunk" , "iter_chunked" ,
377- "iter_any" , "iter_chunks"
378- ] and
379- call .getFunction ( ) = attr and
380- await .getValue ( ) = call .asExpr ( ) and
381- nodeTo .asExpr ( ) = await
382- )
362+ // normal (non-async) methods
363+ nodeFrom = instance ( ) and
364+ nodeTo .( DataFlow:: MethodCallNode ) .calls ( nodeFrom , [ "read_nowait" ] )
365+ or
366+ // async methods
367+ exists ( DataFlow:: MethodCallNode call , Await await |
368+ nodeTo .asExpr ( ) = await and
369+ nodeFrom = instance ( )
370+ |
371+ await .getValue ( ) = any ( DataFlow:: Node awaitable | call .flowsTo ( awaitable ) ) .asExpr ( ) and
372+ call .calls ( nodeFrom ,
373+ [
374+ "read" , "readany" , "readexactly" , "readline" , "readchunk" , "iter_chunked" , "iter_any" ,
375+ "iter_chunks"
376+ ] )
383377 )
384378 }
385379 }
@@ -438,24 +432,17 @@ module AiohttpWebModel {
438432 */
439433 private class AiohttpRequestAdditionalTaintStep extends TaintTracking:: AdditionalTaintStep {
440434 override predicate step ( DataFlow:: Node nodeFrom , DataFlow:: Node nodeTo ) {
441- // Methods
442- //
443- // TODO: When we have tools that make it easy, model these properly to handle
444- // `meth = obj.meth; meth()`. Until then, we'll use this more syntactic approach
445- // (since it allows us to at least capture the most common cases).
435+ // normal (non-async) methods
446436 nodeFrom = Request:: instance ( ) and
447- exists ( DataFlow:: AttrRead attr | attr .getObject ( ) = nodeFrom |
448- // normal methods
449- attr .getAttributeName ( ) in [ "clone" , "get_extra_info" ] and
450- nodeTo .( DataFlow:: CallCfgNode ) .getFunction ( ) = attr
451- or
452- // async methods
453- exists ( Await await , DataFlow:: CallCfgNode call |
454- attr .getAttributeName ( ) in [ "read" , "text" , "json" , "multipart" , "post" ] and
455- call .getFunction ( ) = attr and
456- await .getValue ( ) = call .asExpr ( ) and
457- nodeTo .asExpr ( ) = await
458- )
437+ nodeTo .( DataFlow:: MethodCallNode ) .calls ( nodeFrom , [ "clone" , "get_extra_info" ] )
438+ or
439+ // async methods
440+ exists ( DataFlow:: MethodCallNode call , Await await |
441+ nodeTo .asExpr ( ) = await and
442+ nodeFrom = Request:: instance ( )
443+ |
444+ await .getValue ( ) = any ( DataFlow:: Node awaitable | call .flowsTo ( awaitable ) ) .asExpr ( ) and
445+ call .calls ( nodeFrom , [ "read" , "text" , "json" , "multipart" , "post" ] )
459446 )
460447 or
461448 // Attributes
0 commit comments