File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
python/ql/src/experimental/Security Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ class UnsafeUnpackingConfig extends TaintTracking::Configuration {
190
190
or
191
191
// Go through an Open for a Tarfile
192
192
nodeTo = tarfileOpen ( ) .getACall ( ) and nodeFrom = nodeTo .( MethodCallNode ) .getArg ( 0 )
193
- or
193
+ or
194
194
// Handle the case where the getmembers is used.
195
195
nodeTo .( MethodCallNode ) .calls ( nodeFrom , "getmembers" ) and
196
196
nodeFrom instanceof AllTarfileOpens
@@ -201,5 +201,17 @@ class UnsafeUnpackingConfig extends TaintTracking::Configuration {
201
201
nodeTo = API:: moduleImport ( "contextlib" ) .getMember ( "closing" ) .getACall ( ) and
202
202
nodeFrom = nodeTo .( API:: CallNode ) .getArg ( 0 ) and
203
203
nodeFrom = tarfileOpen ( ) .getReturn ( ) .getAValueReachableFromSource ( )
204
+ or
205
+ // see Path : https://docs.python.org/3/library/pathlib.html#pathlib.Path
206
+ nodeTo = API:: moduleImport ( "pathlib" ) .getMember ( "Path" ) .getACall ( ) and
207
+ nodeFrom = nodeTo .( API:: CallNode ) .getArg ( 0 )
208
+ or
209
+ // Use of absolutepath
210
+ // see absolute : https://docs.python.org/3/library/pathlib.html#pathlib.Path.absolute
211
+ exists ( API:: CallNode mcn |
212
+ mcn = API:: moduleImport ( "pathlib" ) .getMember ( "Path" ) .getACall ( ) and
213
+ nodeTo = mcn .getAMethodCall ( "absolute" ) and
214
+ nodeFrom = mcn .getArg ( 0 )
215
+ )
204
216
}
205
217
}
You can’t perform that action at this time.
0 commit comments