@@ -17,19 +17,19 @@ module Fasthttp {
17
17
string packagePath ( ) { result = package ( v1modulePath ( ) , "" ) }
18
18
19
19
/**
20
- * Provide models for sanitizer/Dangerous Functions of fasthttp
20
+ * Provide models for sanitizer/Dangerous Functions of fasthttp.
21
21
*/
22
22
module Functions {
23
23
/**
24
- * A function that doesn't sanitize user-provided file paths
24
+ * A function that doesn't sanitize user-provided file paths.
25
25
*/
26
26
class FileSystemAccess extends FileSystemAccess:: Range , DataFlow:: CallNode {
27
27
FileSystemAccess ( ) {
28
28
exists ( Function f |
29
29
f .hasQualifiedName ( packagePath ( ) ,
30
30
[
31
- "ServeFile " , "ServeFileUncompressed " , "ServeFileBytes" , "ServeFileBytesUncompressed" ,
32
- "SaveMultipartFile "
31
+ "SaveMultipartFile " , "ServeFile " , "ServeFileBytes" , "ServeFileBytesUncompressed" ,
32
+ "ServeFileUncompressed "
33
33
] ) and
34
34
this = f .getACall ( )
35
35
)
@@ -39,7 +39,7 @@ module Fasthttp {
39
39
}
40
40
41
41
/**
42
- * A function that can be used as a sanitizer for XSS
42
+ * A function that can be used as a sanitizer for XSS.
43
43
*/
44
44
class HtmlQuoteSanitizer extends SharedXss:: Sanitizer {
45
45
HtmlQuoteSanitizer ( ) {
@@ -75,13 +75,13 @@ module Fasthttp {
75
75
76
76
/**
77
77
* A function that create initial connection to a TCP address.
78
- * Following Functions only accept TCP address + Port in their first argument
78
+ * Following Functions only accept TCP address + Port in their first argument.
79
79
*/
80
80
class RequestForgerySinkDial extends RequestForgery:: Sink {
81
81
RequestForgerySinkDial ( ) {
82
82
exists ( Function f |
83
83
f .hasQualifiedName ( packagePath ( ) ,
84
- [ "DialDualStack " , "Dial " , "DialTimeout " , "DialDualStackTimeout " ] ) and
84
+ [ "Dial " , "DialDualStack " , "DialDualStackTimeout " , "DialTimeout " ] ) and
85
85
this = f .getACall ( ) .getArgument ( 0 )
86
86
)
87
87
}
@@ -93,57 +93,57 @@ module Fasthttp {
93
93
}
94
94
95
95
/**
96
- * Provide modeling for fasthttp.URI Type
96
+ * Provide modeling for fasthttp.URI Type.
97
97
*/
98
98
module URI {
99
99
/**
100
- * The methods as Remote user controllable source which are part of the incoming URL
100
+ * The methods as Remote user controllable source which are part of the incoming URL.
101
101
*/
102
102
class UntrustedFlowSource extends UntrustedFlowSource:: Range instanceof DataFlow:: Node {
103
103
UntrustedFlowSource ( ) {
104
104
exists ( Method m |
105
105
m .hasQualifiedName ( packagePath ( ) , "URI" ,
106
- [ "Path " , "PathOriginal " , "LastPathSegment " , "FullURI " , "QueryString" , "String" ] ) and
107
- this = m .getACall ( )
106
+ [ "FullURI " , "LastPathSegment " , "Path " , "PathOriginal " , "QueryString" , "String" ] ) and
107
+ this = m .getACall ( ) . getResult ( 0 )
108
108
)
109
109
}
110
110
}
111
111
}
112
112
113
113
/**
114
- * Provide modeling for fasthttp.Args Type
114
+ * Provide modeling for fasthttp.Args Type.
115
115
*/
116
116
module Args {
117
117
/**
118
118
* The methods as Remote user controllable source which are part of the incoming URL Parameters.
119
119
*
120
- * When support for lambdas has been implemented we should model "VisitAll"
120
+ * When support for lambdas has been implemented we should model "VisitAll".
121
121
*/
122
122
class UntrustedFlowSource extends UntrustedFlowSource:: Range instanceof DataFlow:: Node {
123
123
UntrustedFlowSource ( ) {
124
124
exists ( Method m |
125
125
m .hasQualifiedName ( packagePath ( ) , "Args" ,
126
126
[ "Peek" , "PeekBytes" , "PeekMulti" , "PeekMultiBytes" , "QueryString" , "String" ] ) and
127
- this = m .getACall ( )
127
+ this = m .getACall ( ) . getResult ( 0 )
128
128
)
129
129
}
130
130
}
131
131
}
132
132
133
133
/**
134
- * Provide modeling for fasthttp.TCPDialer Type
134
+ * Provide modeling for fasthttp.TCPDialer Type.
135
135
*/
136
136
module TcpDialer {
137
137
/**
138
138
* A method that create initial connection to a TCP address.
139
139
* Provide Methods which can be used as dangerous RequestForgery Sinks.
140
- * Following Methods only accept TCP address + Port in their first argument
140
+ * Following Methods only accept TCP address + Port in their first argument.
141
141
*/
142
142
class RequestForgerySinkDial extends RequestForgery:: Sink {
143
143
RequestForgerySinkDial ( ) {
144
144
exists ( Method m |
145
145
m .hasQualifiedName ( packagePath ( ) , "TCPDialer" ,
146
- [ "Dial" , "DialTimeout " , "DialDualStack " , "DialDualStackTimeout " ] ) and
146
+ [ "Dial" , "DialDualStack " , "DialDualStackTimeout " , "DialTimeout " ] ) and
147
147
this = m .getACall ( ) .getArgument ( 0 )
148
148
)
149
149
}
@@ -155,7 +155,7 @@ module Fasthttp {
155
155
}
156
156
157
157
/**
158
- * Provide modeling for fasthttp.Client Type
158
+ * Provide modeling for fasthttp.Client Type.
159
159
*/
160
160
module Client {
161
161
/**
@@ -179,7 +179,7 @@ module Fasthttp {
179
179
}
180
180
181
181
/**
182
- * Provide modeling for fasthttp.HostClient Type
182
+ * Provide modeling for fasthttp.HostClient Type.
183
183
*/
184
184
module HostClient {
185
185
/**
@@ -204,11 +204,12 @@ module Fasthttp {
204
204
}
205
205
206
206
/**
207
- * Provide modeling for fasthttp.Response Type
207
+ * Provide modeling for fasthttp.Response Type.
208
208
*/
209
209
module Response {
210
210
/**
211
- * A Method That send files from its input and it does not check input path against path traversal attacks, so it is a dangerous method
211
+ * A Method That send files from its input.
212
+ * It does not check the input path against path traversal attacks, So it is a dangerous method.
212
213
*/
213
214
class FileSystemAccess extends FileSystemAccess:: Range , DataFlow:: CallNode {
214
215
FileSystemAccess ( ) {
@@ -230,8 +231,8 @@ module Fasthttp {
230
231
exists ( Method m |
231
232
m .hasQualifiedName ( packagePath ( ) , "Response" ,
232
233
[
233
- "AppendBody" , "AppendBodyString" , "SetBody" , "SetBodyString " , "SetBodyRaw " ,
234
- "SetBodyStream "
234
+ "AppendBody" , "AppendBodyString" , "SetBody" , "SetBodyRaw " , "SetBodyStream " ,
235
+ "SetBodyString "
235
236
] ) and
236
237
this = m .getACall ( ) .getArgument ( 0 )
237
238
)
@@ -240,21 +241,21 @@ module Fasthttp {
240
241
}
241
242
242
243
/**
243
- * Provide modeling for fasthttp.Request Type
244
+ * Provide modeling for fasthttp.Request Type.
244
245
*/
245
246
module Request {
246
247
/**
247
- * The methods as Remote user controllable source which can be many part of request
248
+ * The methods as Remote user controllable source which can be many part of request.
248
249
*/
249
250
class UntrustedFlowSource extends UntrustedFlowSource:: Range instanceof DataFlow:: Node {
250
251
UntrustedFlowSource ( ) {
251
252
exists ( Method m |
252
253
m .hasQualifiedName ( packagePath ( ) , "Request" ,
253
254
[
254
- "Host " , "RequestURI " , "Body " , "BodyGunzip " , "BodyInflate " , "BodyUnbrotli " ,
255
- "BodyStream " , "BodyUncompressed "
255
+ "Body " , "BodyGunzip " , "BodyInflate " , "BodyStream " , "BodyUnbrotli " , "BodyUncompressed " ,
256
+ "Host " , "RequestURI "
256
257
] ) and
257
- this = m .getACall ( )
258
+ this = m .getACall ( ) . getResult ( 0 )
258
259
)
259
260
}
260
261
}
@@ -269,7 +270,7 @@ module Fasthttp {
269
270
RequestForgerySink ( ) {
270
271
exists ( Method m |
271
272
m .hasQualifiedName ( packagePath ( ) , "Request" ,
272
- [ "SetRequestURI " , "SetRequestURIBytes " , "SetURI " , "SetHost " , "SetHostBytes " ] ) and
273
+ [ "SetHost " , "SetHostBytes " , "SetRequestURI " , "SetRequestURIBytes " , "SetURI " ] ) and
273
274
this = m .getACall ( ) .getArgument ( 0 )
274
275
)
275
276
}
@@ -281,16 +282,16 @@ module Fasthttp {
281
282
}
282
283
283
284
/**
284
- * Provide modeling for fasthttp.RequestCtx Type
285
+ * Provide modeling for fasthttp.RequestCtx Type.
285
286
*/
286
287
module RequestCtx {
287
288
/**
288
- * The Methods that don't sanitize user provided file paths
289
+ * The Methods that don't sanitize user provided file paths.
289
290
*/
290
291
class FileSystemAccess extends FileSystemAccess:: Range , DataFlow:: CallNode {
291
292
FileSystemAccess ( ) {
292
293
exists ( Method mcn |
293
- mcn .hasQualifiedName ( packagePath ( ) , "RequestCtx" , [ "SendFileBytes " , "SendFile " ] ) and
294
+ mcn .hasQualifiedName ( packagePath ( ) , "RequestCtx" , [ "SendFile " , "SendFileBytes " ] ) and
294
295
this = mcn .getACall ( )
295
296
)
296
297
}
@@ -299,7 +300,7 @@ module Fasthttp {
299
300
}
300
301
301
302
/**
302
- * The Methods that can be dangerous if they take user controlled URL as their first argument
303
+ * The Methods that can be dangerous if they take user controlled URL as their first argument.
303
304
*/
304
305
class Redirect extends Http:: Redirect:: Range , DataFlow:: CallNode {
305
306
Redirect ( ) {
@@ -317,17 +318,17 @@ module Fasthttp {
317
318
/**
318
319
* The methods as Remote user controllable source which are generally related to HTTP request.
319
320
*
320
- * When support for lambdas has been implemented we should model "VisitAll", "VisitAllCookie", "VisitAllInOrder", "VisitAllTrailer"
321
+ * When support for lambdas has been implemented we should model "VisitAll", "VisitAllCookie", "VisitAllInOrder", "VisitAllTrailer".
321
322
*/
322
323
class UntrustedFlowSource extends UntrustedFlowSource:: Range instanceof DataFlow:: Node {
323
324
UntrustedFlowSource ( ) {
324
325
exists ( Method m |
325
326
m .hasQualifiedName ( packagePath ( ) , "RequestCtx" ,
326
327
[
327
- "Path " , "Referer " , "PostBody" , "RequestBodyStream " , "RequestURI " , "UserAgent " , "Host " ,
328
- "String "
328
+ "Host " , "Path " , "PostBody" , "Referer " , "RequestBodyStream " , "RequestURI " , "String " ,
329
+ "UserAgent "
329
330
] ) and
330
- this = m .getACall ( )
331
+ this = m .getACall ( ) . getResult ( 0 )
331
332
)
332
333
}
333
334
}
@@ -347,24 +348,25 @@ module Fasthttp {
347
348
}
348
349
349
350
/**
350
- * Provide Methods of fasthttp.RequestHeader which mostly used as remote user controlled sources
351
+ * Provide Methods of fasthttp.RequestHeader which mostly used as remote user controlled sources.
351
352
*/
352
353
module RequestHeader {
353
354
/**
354
355
* The methods as Remote user controllable source which are mostly related to HTTP Request Headers.
355
356
*
356
- * When support for lambdas has been implemented we should model "VisitAll", "VisitAllCookie", "VisitAllInOrder", "VisitAllTrailer"
357
+ * When support for lambdas has been implemented we should model "VisitAll", "VisitAllCookie", "VisitAllInOrder", "VisitAllTrailer".
357
358
*/
358
359
class UntrustedFlowSource extends UntrustedFlowSource:: Range instanceof DataFlow:: Node {
359
360
UntrustedFlowSource ( ) {
360
361
exists ( Method m |
361
362
m .hasQualifiedName ( packagePath ( ) , "RequestHeader" ,
362
363
[
363
- "Header" , "TrailerHeader" , "RequestURI" , "Host" , "UserAgent" , "ContentEncoding" ,
364
- "ContentType" , "Cookie" , "CookieBytes" , "MultipartFormBoundary" , "Peek" , "PeekAll" ,
365
- "PeekBytes" , "PeekKeys" , "PeekTrailerKeys" , "Referer" , "RawHeaders" , "String"
364
+ "ContentEncoding" , "ContentType" , "Cookie" , "CookieBytes" , "Header" , "Host" ,
365
+ "MultipartFormBoundary" , "Peek" , "PeekAll" , "PeekBytes" , "PeekKeys" ,
366
+ "PeekTrailerKeys" , "RawHeaders" , "Referer" , "RequestURI" , "String" , "TrailerHeader" ,
367
+ "UserAgent"
366
368
] ) and
367
- this = m .getACall ( )
369
+ this = m .getACall ( ) . getResult ( 0 )
368
370
)
369
371
}
370
372
}
0 commit comments