File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
python/ql/src/experimental/Security/CWE-022bis Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -50,17 +50,9 @@ class UnsafeUnpackingConfig extends TaintTracking::Configuration {
50
50
)
51
51
)
52
52
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
59
54
// 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"
64
56
}
65
57
66
58
override predicate isSink ( DataFlow:: Node sink ) {
@@ -107,6 +99,12 @@ class UnsafeUnpackingConfig extends TaintTracking::Configuration {
107
99
nodeFrom = cn .getArg ( 0 )
108
100
)
109
101
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
110
108
// Accessing the name or raw content
111
109
exists ( AttrRead ar | ar .accesses ( nodeFrom , [ "name" , "raw" ] ) and ar .flowsTo ( nodeTo ) )
112
110
or
You can’t perform that action at this time.
0 commit comments