@@ -52,16 +52,35 @@ private module Flask {
5252 }
5353
5454 private module FlaskRequestTracking {
55- private DataFlow :: Node tainted_methods ( string attr_name , DataFlow :: TypeTracker t ) {
56- attr_name in [ " get_data" , "get_json" ] and
57- t .startInAttr ( attr_name ) and
55+ /** Gets a reference to the `get_data` attribute of a Flask request. */
56+ private DataFlow :: Node get_data ( DataFlow :: TypeTracker t ) {
57+ t .startInAttr ( "get_data" ) and
5858 result = flask:: request ( )
5959 or
60- exists ( DataFlow:: TypeTracker t2 | result = tainted_methods ( attr_name , t2 ) .track ( t2 , t ) )
60+ exists ( DataFlow:: TypeTracker t2 | result = get_data ( t2 ) .track ( t2 , t ) )
6161 }
6262
63+ /** Gets a reference to the `get_data` attribute of a Flask request. */
64+ DataFlow:: Node get_data ( ) { result = get_data ( DataFlow:: TypeTracker:: end ( ) ) }
65+
66+ /** Gets a reference to the `get_json` attribute of a Flask request. */
67+ private DataFlow:: Node get_json ( DataFlow:: TypeTracker t ) {
68+ t .startInAttr ( "get_json" ) and
69+ result = flask:: request ( )
70+ or
71+ exists ( DataFlow:: TypeTracker t2 | result = get_json ( t2 ) .track ( t2 , t ) )
72+ }
73+
74+ /** Gets a reference to the `get_json` attribute of a Flask request. */
75+ DataFlow:: Node get_json ( ) { result = get_json ( DataFlow:: TypeTracker:: end ( ) ) }
76+
77+ /** Gets a reference to either of the `get_json` or `get_data` attributes of a Flask request. */
6378 DataFlow:: Node tainted_methods ( string attr_name ) {
64- result = tainted_methods ( attr_name , DataFlow:: TypeTracker:: end ( ) )
79+ result = get_data ( ) and
80+ attr_name = "get_data"
81+ or
82+ result = get_json ( ) and
83+ attr_name = "get_json"
6584 }
6685 }
6786
0 commit comments