@@ -39,10 +39,8 @@ class AllTarfileOpens extends API::CallNode {
39
39
}
40
40
}
41
41
42
- class UnsafeUnpackingConfig extends TaintTracking:: Configuration {
43
- UnsafeUnpackingConfig ( ) { this = "UnsafeUnpackingConfig" }
44
-
45
- override predicate isSource ( DataFlow:: Node source ) {
42
+ private module UnsafeUnpackConfig implements DataFlow:: ConfigSig {
43
+ predicate isSource ( DataFlow:: Node source ) {
46
44
// A source coming from a remote location
47
45
source instanceof RemoteFlowSource
48
46
or
@@ -92,7 +90,7 @@ class UnsafeUnpackingConfig extends TaintTracking::Configuration {
92
90
source .( AttrRead ) .getAttributeName ( ) = "FILES"
93
91
}
94
92
95
- override predicate isSink ( DataFlow:: Node sink ) {
93
+ predicate isSink ( DataFlow:: Node sink ) {
96
94
(
97
95
// A sink capturing method calls to `unpack_archive`.
98
96
sink = API:: moduleImport ( "shutil" ) .getMember ( "unpack_archive" ) .getACall ( ) .getArg ( 0 )
@@ -136,7 +134,7 @@ class UnsafeUnpackingConfig extends TaintTracking::Configuration {
136
134
not sink .getScope ( ) .getLocation ( ) .getFile ( ) .inStdlib ( )
137
135
}
138
136
139
- override predicate isAdditionalTaintStep ( DataFlow:: Node nodeFrom , DataFlow:: Node nodeTo ) {
137
+ predicate isAdditionalFlowStep ( DataFlow:: Node nodeFrom , DataFlow:: Node nodeTo ) {
140
138
// Reading the response
141
139
nodeTo .( MethodCallNode ) .calls ( nodeFrom , "read" )
142
140
or
@@ -211,3 +209,6 @@ class UnsafeUnpackingConfig extends TaintTracking::Configuration {
211
209
)
212
210
}
213
211
}
212
+
213
+ /** Global taint-tracking for detecting "UnsafeUnpacking" vulnerabilities. */
214
+ module UnsafeUnpackFlow = TaintTracking:: Global< UnsafeUnpackConfig > ;
0 commit comments