55private import python
66private import semmle.python.dataflow.new.DataFlow
77private import semmle.python.dataflow.new.TaintTracking
8+ private import semmle.python.ApiGraphs
89
910/**
1011 * Provides models for the `Werkzeug` PyPI package.
@@ -23,6 +24,9 @@ module Werkzeug {
2324 * See https://werkzeug.palletsprojects.com/en/1.0.x/datastructures/#werkzeug.datastructures.MultiDict.
2425 */
2526 module MultiDict {
27+ /** DEPRECATED. Use `InstanceSourceApiNode` instead. */
28+ abstract deprecated class InstanceSource extends DataFlow:: Node { }
29+
2630 /**
2731 * A source of instances of `werkzeug.datastructures.MultiDict`, extend this class to model new instances.
2832 *
@@ -32,37 +36,16 @@ module Werkzeug {
3236 *
3337 * Use the predicate `MultiDict::instance()` to get references to instances of `werkzeug.datastructures.MultiDict`.
3438 */
35- abstract class InstanceSource extends DataFlow:: Node { }
36-
37- /** Gets a reference to an instance of `werkzeug.datastructures.MultiDict`. */
38- private DataFlow:: Node instance ( DataFlow:: TypeTracker t ) {
39- t .start ( ) and
40- result instanceof InstanceSource
41- or
42- exists ( DataFlow:: TypeTracker t2 | result = instance ( t2 ) .track ( t2 , t ) )
43- }
44-
45- /** Gets a reference to an instance of `werkzeug.datastructures.MultiDict`. */
46- DataFlow:: Node instance ( ) { result = instance ( DataFlow:: TypeTracker:: end ( ) ) }
39+ abstract class InstanceSourceApiNode extends API:: Node { }
4740
4841 /**
4942 * Gets a reference to the `getlist` method on an instance of `werkzeug.datastructures.MultiDict`.
5043 *
5144 * See https://werkzeug.palletsprojects.com/en/1.0.x/datastructures/#werkzeug.datastructures.Headers.getlist
5245 */
53- private DataFlow:: Node getlist ( DataFlow:: TypeTracker t ) {
54- t .startInAttr ( "getlist" ) and
55- result = instance ( )
56- or
57- exists ( DataFlow:: TypeTracker t2 | result = getlist ( t2 ) .track ( t2 , t ) )
46+ DataFlow:: Node getlist ( ) {
47+ result = any ( InstanceSourceApiNode a ) .getMember ( "getlist" ) .getAUse ( )
5848 }
59-
60- /**
61- * Gets a reference to the `getlist` method on an instance of `werkzeug.datastructures.MultiDict`.
62- *
63- * See https://werkzeug.palletsprojects.com/en/1.0.x/datastructures/#werkzeug.datastructures.Headers.getlist
64- */
65- DataFlow:: Node getlist ( ) { result = getlist ( DataFlow:: TypeTracker:: end ( ) ) }
6649 }
6750
6851 /**
@@ -71,6 +54,9 @@ module Werkzeug {
7154 * See https://werkzeug.palletsprojects.com/en/1.0.x/datastructures/#werkzeug.datastructures.FileStorage.
7255 */
7356 module FileStorage {
57+ /** DEPRECATED. Use `InstanceSourceApiNode` instead. */
58+ abstract deprecated class InstanceSource extends DataFlow:: Node { }
59+
7460 /**
7561 * A source of instances of `werkzeug.datastructures.FileStorage`, extend this class to model new instances.
7662 *
@@ -80,18 +66,10 @@ module Werkzeug {
8066 *
8167 * Use the predicate `FileStorage::instance()` to get references to instances of `werkzeug.datastructures.FileStorage`.
8268 */
83- abstract class InstanceSource extends DataFlow:: Node { }
84-
85- /** Gets a reference to an instance of `werkzeug.datastructures.FileStorage`. */
86- private DataFlow:: Node instance ( DataFlow:: TypeTracker t ) {
87- t .start ( ) and
88- result instanceof InstanceSource
89- or
90- exists ( DataFlow:: TypeTracker t2 | result = instance ( t2 ) .track ( t2 , t ) )
91- }
69+ abstract class InstanceSourceApiNode extends API:: Node { }
9270
9371 /** Gets a reference to an instance of `werkzeug.datastructures.FileStorage`. */
94- DataFlow:: Node instance ( ) { result = instance ( DataFlow :: TypeTracker :: end ( ) ) }
72+ DataFlow:: Node instance ( ) { result = any ( InstanceSourceApiNode a ) . getAUse ( ) }
9573 }
9674 }
9775 }
0 commit comments