File tree Expand file tree Collapse file tree
python/ql/src/experimental/Security/CWE-022bis Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,17 +50,9 @@ class UnsafeUnpackingConfig extends TaintTracking::Configuration {
5050 )
5151 )
5252 or
53- // catch the uploaded files as a source
54- exists ( Subscript s , Attribute at |
55- at = s .getObject ( ) and at .getAttr ( ) = "FILES" and source .asExpr ( ) = s
56- )
57- or
58- // Retrieve Django uploaded files
53+ // catch the Django uploaded files as a source
5954 // see HttpRequest.FILES: https://docs.djangoproject.com/en/4.1/ref/request-response/#django.http.HttpRequest.FILES
60- exists ( Node obj , AttrRead ar |
61- ar .getAMethodCall ( [ "getlist" , "get" ] ) .flowsTo ( source ) and
62- ar .accesses ( obj , "FILES" )
63- )
55+ source .( AttrRead ) .getAttributeName ( ) = "FILES"
6456 }
6557
6658 override predicate isSink ( DataFlow:: Node sink ) {
@@ -107,6 +99,12 @@ class UnsafeUnpackingConfig extends TaintTracking::Configuration {
10799 nodeFrom = cn .getArg ( 0 )
108100 )
109101 or
102+ // Retrieve Django uploaded files
103+ // see HttpRequest.FILES.getlist(): https://docs.djangoproject.com/en/4.1/ref/request-response/#django.http.QueryDict.getlist
104+ exists ( MethodCallNode mc |
105+ nodeFrom = mc .getObject ( ) and mc .getMethodName ( ) = [ "getlist" , "get" ] and nodeTo = mc
106+ )
107+ or
110108 // Accessing the name or raw content
111109 exists ( AttrRead ar | ar .accesses ( nodeFrom , [ "name" , "raw" ] ) and ar .flowsTo ( nodeTo ) )
112110 or
You can’t perform that action at this time.
0 commit comments