Apply suggestions from code review

Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
This commit is contained in:
Alvaro Muñoz
2023-07-13 12:23:00 +02:00
committed by GitHub
parent 7a717555aa
commit 69efddbaef
2 changed files with 8 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
---
category: minorAnalysis
---
* Improvements of the `aiohttp` models including heuristic sources and new path manipulation and SSRF sinks.
* Improvements of the `aiohttp` models including remote-flow-sources from type annotations, new path manipulation, and SSRF sinks.

View File

@@ -477,19 +477,15 @@ module AiohttpWebModel {
DataFlow::ParameterNode, RemoteFlowSource::Range
{
AiohttpHeuristicRequestHandlerRequestParam() {
exists(FunctionExpr fe, int i |
// the API::Node is the annotation (type hint), we need to get the annotated parameter
fe.getArgs().getAnnotation(i) =
API::moduleImport("aiohttp")
.getMember("web")
.getMember("Request")
.getAValueReachableFromSource()
.asExpr() and
fe.getInnerScope().getArg(i) = this.getParameter()
)
this.getParameter().getAnnotation() =
API::moduleImport("aiohttp")
.getMember("web")
.getMember("Request")
.getAValueReachableFromSource()
.asExpr()
}
override string getSourceType() { result = "aiohttp web request parameter" }
override string getSourceType() { result = "aiohttp.web.Request from type-annotation" }
}
/**