@@ -171,16 +171,30 @@ class ActionMethodParameter extends RemoteFlowSource, DataFlow::ParameterNode {
171171/** A data flow source of remote user input (ASP.NET Core). */
172172abstract class AspNetCoreRemoteFlowSource extends RemoteFlowSource { }
173173
174+ private predicate reachesMapGetArg ( DataFlow:: Node n ) {
175+ exists ( MethodCall mc |
176+ mc .getTarget ( ) =
177+ any ( MicrosoftAspNetCoreBuilderEndpointRouteBuilderExtensions c ) .getMapGetMethod ( ) and
178+ n .asExpr ( ) = mc .getArgument ( 2 )
179+ )
180+ or
181+ exists ( DataFlow:: Node mid | reachesMapGetArg ( mid ) |
182+ DataFlow:: localFlowStep ( n , mid ) or
183+ n .asExpr ( ) = mid .asExpr ( ) .( DelegateCreation ) .getArgument ( )
184+ )
185+ }
186+
174187/** A parameter to a routing method delegate. */
175- class RoutingMethodParameter extends AspNetCoreRemoteFlowSource , DataFlow:: ParameterNode {
176- RoutingMethodParameter ( ) {
177- exists ( Parameter p , MethodCall m |
178- p = this .getParameter ( ) and
179- p .fromSource ( )
188+ class AspNetCoreRoutingMethodParameter extends AspNetCoreRemoteFlowSource , DataFlow:: ParameterNode {
189+ AspNetCoreRoutingMethodParameter ( ) {
190+ exists ( DataFlow:: Node n , Callable c |
191+ reachesMapGetArg ( n ) and
192+ c .getAParameter ( ) = this .asParameter ( ) and
193+ c .isSourceDeclaration ( )
180194 |
181- m . getTarget ( ) =
182- any ( MicrosoftAspNetCoreBuilderEndpointRouteBuilderExtensions c ) . getMapGetMethod ( ) and
183- p = m . getArgument ( 2 ) .( AnonymousFunctionExpr ) . getAParameter ( )
195+ n . asExpr ( ) = c
196+ or
197+ n . asExpr ( ) .( CallableAccess ) . getTarget ( ) . getUnboundDeclaration ( ) = c
184198 )
185199 }
186200
0 commit comments