@@ -39,10 +39,8 @@ class AllTarfileOpens extends API::CallNode {
3939 }
4040}
4141
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 ) {
4644 // A source coming from a remote location
4745 source instanceof RemoteFlowSource
4846 or
@@ -92,7 +90,7 @@ class UnsafeUnpackingConfig extends TaintTracking::Configuration {
9290 source .( AttrRead ) .getAttributeName ( ) = "FILES"
9391 }
9492
95- override predicate isSink ( DataFlow:: Node sink ) {
93+ predicate isSink ( DataFlow:: Node sink ) {
9694 (
9795 // A sink capturing method calls to `unpack_archive`.
9896 sink = API:: moduleImport ( "shutil" ) .getMember ( "unpack_archive" ) .getACall ( ) .getArg ( 0 )
@@ -136,7 +134,7 @@ class UnsafeUnpackingConfig extends TaintTracking::Configuration {
136134 not sink .getScope ( ) .getLocation ( ) .getFile ( ) .inStdlib ( )
137135 }
138136
139- override predicate isAdditionalTaintStep ( DataFlow:: Node nodeFrom , DataFlow:: Node nodeTo ) {
137+ predicate isAdditionalFlowStep ( DataFlow:: Node nodeFrom , DataFlow:: Node nodeTo ) {
140138 // Reading the response
141139 nodeTo .( MethodCallNode ) .calls ( nodeFrom , "read" )
142140 or
@@ -211,3 +209,6 @@ class UnsafeUnpackingConfig extends TaintTracking::Configuration {
211209 )
212210 }
213211}
212+
213+ /** Global taint-tracking for detecting "UnsafeUnpacking" vulnerabilities. */
214+ module UnsafeUnpackFlow = TaintTracking:: Global< UnsafeUnpackConfig > ;
0 commit comments