@@ -266,6 +266,26 @@ rules:
266266 - pattern : $REQ.Form[...]
267267 - pattern : $REQ.Headers[...]
268268 - pattern : $REQ.Cookies[...]
269+ # ASP.NET Core controller parameter binding
270+ - patterns :
271+ - pattern : $PARAM
272+ - pattern-inside : |
273+ public $RET $METHOD(..., [FromQuery] $TYPE $PARAM, ...) { ... }
274+ - patterns :
275+ - pattern : $PARAM
276+ - pattern-inside : |
277+ public $RET $METHOD(..., [FromBody] $TYPE $PARAM, ...) { ... }
278+ - patterns :
279+ - pattern : $PARAM
280+ - pattern-inside : |
281+ public $RET $METHOD(..., [FromRoute] $TYPE $PARAM, ...) { ... }
282+ - patterns :
283+ - pattern : $PARAM
284+ - pattern-inside : |
285+ public $RET $METHOD(..., [FromForm] $TYPE $PARAM, ...) { ... }
286+ # IFormFile upload sources
287+ - pattern : (IFormFile $F).FileName
288+ - pattern : (IFormFile $F).ContentType
269289 # Network input sources (Juliet-style)
270290 - pattern : (StreamReader $SR).ReadLine()
271291 - pattern : (TextReader $TR).ReadLine()
@@ -283,9 +303,14 @@ rules:
283303 pattern-sinks :
284304 - pattern-either :
285305 - pattern : Response.Write(...)
306+ - pattern : Response.WriteAsync(...)
286307 - pattern : HttpContext.Response.Write(...)
308+ - pattern : HttpContext.Response.WriteAsync(...)
287309 # HttpResponse parameter pattern (Juliet, ASP.NET handlers)
288310 - pattern : $RESP.Write(...)
311+ - pattern : $RESP.WriteAsync(...)
312+ # Razor unencoded output
313+ - pattern : Html.Raw(...)
289314 pattern-sanitizers :
290315 - pattern-either :
291316 - pattern : HttpUtility.HtmlEncode(...)
@@ -321,6 +346,25 @@ rules:
321346 - pattern : $REQ.Query[...]
322347 - pattern : $REQ.Form[...]
323348 - pattern : $REQ.RouteValues[...]
349+ # ASP.NET Core controller parameter binding
350+ - patterns :
351+ - pattern : $PARAM
352+ - pattern-inside : |
353+ public $RET $METHOD(..., [FromQuery] $TYPE $PARAM, ...) { ... }
354+ - patterns :
355+ - pattern : $PARAM
356+ - pattern-inside : |
357+ public $RET $METHOD(..., [FromBody] $TYPE $PARAM, ...) { ... }
358+ - patterns :
359+ - pattern : $PARAM
360+ - pattern-inside : |
361+ public $RET $METHOD(..., [FromRoute] $TYPE $PARAM, ...) { ... }
362+ - patterns :
363+ - pattern : $PARAM
364+ - pattern-inside : |
365+ public $RET $METHOD(..., [FromForm] $TYPE $PARAM, ...) { ... }
366+ # IFormFile upload sources
367+ - pattern : (IFormFile $F).FileName
324368 # Network input sources (Juliet-style)
325369 - pattern : (StreamReader $SR).ReadLine()
326370 - pattern : (TextReader $TR).ReadLine()
@@ -348,6 +392,14 @@ rules:
348392 - pattern : File.OpenWrite(...)
349393 - pattern : File.Exists(...)
350394 - pattern : File.Delete(...)
395+ # Fully-qualified System.IO variants (common in ASP.NET Core)
396+ - pattern : System.IO.File.ReadAllText(...)
397+ - pattern : System.IO.File.ReadAllBytes(...)
398+ - pattern : System.IO.File.WriteAllText(...)
399+ - pattern : System.IO.File.WriteAllBytes(...)
400+ - pattern : System.IO.File.Exists(...)
401+ - pattern : System.IO.File.Open(...)
402+ - pattern : System.IO.File.Delete(...)
351403 - pattern : new FileStream(...)
352404 - pattern : new StreamReader(...)
353405 - pattern : new StreamWriter(...)
0 commit comments