mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
C#: Consider parameters passed to lambdas in MapGet remote flow sources.
This commit is contained in:
@@ -357,3 +357,15 @@ class MicrosoftAspNetCoreHttpHtmlString extends Class {
|
||||
this.hasQualifiedName("Microsoft.AspNetCore.Html", "HtmlString")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The `Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions` class.
|
||||
*/
|
||||
class MicrosoftAspNetCoreBuilderEndpointRouteBuilderExtensions extends Class {
|
||||
MicrosoftAspNetCoreBuilderEndpointRouteBuilderExtensions() {
|
||||
this.hasQualifiedName("Microsoft.AspNetCore.Builder", "EndpointRouteBuilderExtensions")
|
||||
}
|
||||
|
||||
/** Gets the `UseMap` extension method. */
|
||||
Method getMapGetMethod() { result = this.getAMethod("MapGet") }
|
||||
}
|
||||
|
||||
@@ -171,6 +171,22 @@ class ActionMethodParameter extends RemoteFlowSource, DataFlow::ParameterNode {
|
||||
/** A data flow source of remote user input (ASP.NET Core). */
|
||||
abstract class AspNetCoreRemoteFlowSource extends RemoteFlowSource { }
|
||||
|
||||
/** A parameter to a routing method delegate. */
|
||||
class RoutingMethodParameter extends AspNetCoreRemoteFlowSource, DataFlow::ParameterNode {
|
||||
RoutingMethodParameter() {
|
||||
exists(Parameter p, MethodCall m |
|
||||
p = this.getParameter() and
|
||||
p.fromSource()
|
||||
|
|
||||
m.getTarget() =
|
||||
any(MicrosoftAspNetCoreBuilderEndpointRouteBuilderExtensions c).getMapGetMethod() and
|
||||
p = m.getArgument(2).(AnonymousFunctionExpr).getAParameter()
|
||||
)
|
||||
}
|
||||
|
||||
override string getSourceType() { result = "ASP.NET Core routing endpoint." }
|
||||
}
|
||||
|
||||
/**
|
||||
* Data flow for ASP.NET Core.
|
||||
*
|
||||
|
||||
@@ -2,3 +2,4 @@ remoteFlowSourceMembers
|
||||
| AspRemoteFlowSource.cs:9:23:9:31 | RequestId |
|
||||
remoteFlowSources
|
||||
| AspRemoteFlowSource.cs:19:42:19:50 | viewModel |
|
||||
| AspRemoteFlowSource.cs:34:58:34:63 | newUrl |
|
||||
|
||||
Reference in New Issue
Block a user