5
5
private import python
6
6
private import semmle.python.dataflow.new.DataFlow
7
7
private import semmle.python.dataflow.new.TaintTracking
8
+ private import semmle.python.ApiGraphs
8
9
9
10
/**
10
11
* Provides models for the `Werkzeug` PyPI package.
@@ -23,6 +24,9 @@ module Werkzeug {
23
24
* See https://werkzeug.palletsprojects.com/en/1.0.x/datastructures/#werkzeug.datastructures.MultiDict.
24
25
*/
25
26
module MultiDict {
27
+ /** DEPRECATED. Use `InstanceSourceApiNode` instead. */
28
+ abstract deprecated class InstanceSource extends DataFlow:: Node { }
29
+
26
30
/**
27
31
* A source of instances of `werkzeug.datastructures.MultiDict`, extend this class to model new instances.
28
32
*
@@ -32,37 +36,16 @@ module Werkzeug {
32
36
*
33
37
* Use the predicate `MultiDict::instance()` to get references to instances of `werkzeug.datastructures.MultiDict`.
34
38
*/
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 { }
47
40
48
41
/**
49
42
* Gets a reference to the `getlist` method on an instance of `werkzeug.datastructures.MultiDict`.
50
43
*
51
44
* See https://werkzeug.palletsprojects.com/en/1.0.x/datastructures/#werkzeug.datastructures.Headers.getlist
52
45
*/
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 ( )
58
48
}
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 ( ) ) }
66
49
}
67
50
68
51
/**
@@ -71,6 +54,9 @@ module Werkzeug {
71
54
* See https://werkzeug.palletsprojects.com/en/1.0.x/datastructures/#werkzeug.datastructures.FileStorage.
72
55
*/
73
56
module FileStorage {
57
+ /** DEPRECATED. Use `InstanceSourceApiNode` instead. */
58
+ abstract deprecated class InstanceSource extends DataFlow:: Node { }
59
+
74
60
/**
75
61
* A source of instances of `werkzeug.datastructures.FileStorage`, extend this class to model new instances.
76
62
*
@@ -80,18 +66,10 @@ module Werkzeug {
80
66
*
81
67
* Use the predicate `FileStorage::instance()` to get references to instances of `werkzeug.datastructures.FileStorage`.
82
68
*/
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 { }
92
70
93
71
/** 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 ( ) }
95
73
}
96
74
}
97
75
}
0 commit comments