mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
improve performance by using RouteHandlerCandidate
This commit is contained in:
@@ -89,7 +89,7 @@ module Express {
|
|||||||
/**
|
/**
|
||||||
* Holds if a call to `callee` inside `f` forwards all of the parameters from `f` to that call.
|
* Holds if a call to `callee` inside `f` forwards all of the parameters from `f` to that call.
|
||||||
*/
|
*/
|
||||||
private predicate forwardingCall(DataFlow::SourceNode callee, DataFlow::FunctionNode f) {
|
private predicate forwardingCall(DataFlow::SourceNode callee, HTTP::RouteHandlerCandidate f) {
|
||||||
exists(DataFlow::CallNode call | call = callee.getACall() |
|
exists(DataFlow::CallNode call | call = callee.getACall() |
|
||||||
f.getNumParameter() >= 2 and
|
f.getNumParameter() >= 2 and
|
||||||
forall(int arg | arg = [0 .. f.getNumParameter() - 1] |
|
forall(int arg | arg = [0 .. f.getNumParameter() - 1] |
|
||||||
|
|||||||
@@ -574,8 +574,7 @@ module HTTP {
|
|||||||
read = DataFlow::lvalueNode(any(ForOfStmt stmt).getLValue())
|
read = DataFlow::lvalueNode(any(ForOfStmt stmt).getLValue())
|
||||||
or
|
or
|
||||||
// for forwarding calls to an element where the key is determined by the request.
|
// for forwarding calls to an element where the key is determined by the request.
|
||||||
getRequestParameterRead(read.getContainer().(Function).flow())
|
getRequestParameterRead().flowsToExpr(read.getPropertyNameExpr())
|
||||||
.flowsToExpr(read.getPropertyNameExpr())
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -583,12 +582,12 @@ module HTTP {
|
|||||||
/**
|
/**
|
||||||
* Gets a (chained) property-read/method-call on the request parameter of the route-handler `f`.
|
* Gets a (chained) property-read/method-call on the request parameter of the route-handler `f`.
|
||||||
*/
|
*/
|
||||||
private DataFlow::SourceNode getRequestParameterRead(RouteHandlerCandidate f) {
|
private DataFlow::SourceNode getRequestParameterRead() {
|
||||||
result = f.getParameter(0)
|
result = any(RouteHandlerCandidate f).getParameter(0)
|
||||||
or
|
or
|
||||||
result = getRequestParameterRead(f).getAPropertyRead()
|
result = getRequestParameterRead().getAPropertyRead()
|
||||||
or
|
or
|
||||||
result = getRequestParameterRead(f).getAMethodCall()
|
result = getRequestParameterRead().getAMethodCall()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user