File tree Expand file tree Collapse file tree 2 files changed +21
-8
lines changed
csharp/ql/src/semmle/code/csharp
security/dataflow/flowsinks Expand file tree Collapse file tree 2 files changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,14 @@ class MicrosoftAspNetCoreMvcViewFeatures extends Namespace {
2727 }
2828}
2929
30+ /** The 'Microsoft.AspNetCore.Mvc.Rendering' namespace. */
31+ class MicrosoftAspNetCoreMvcRendering extends Namespace {
32+ MicrosoftAspNetCoreMvcRendering ( ) {
33+ getParentNamespace ( ) instanceof MicrosoftAspNetCoreMvcNamespace and
34+ hasName ( "Rendering" )
35+ }
36+ }
37+
3038/** An attribute whose type is in the `Microsoft.AspNetCore.Mvc` namespace. */
3139class MicrosoftAspNetCoreMvcAttribute extends Attribute {
3240 MicrosoftAspNetCoreMvcAttribute ( ) {
@@ -191,11 +199,11 @@ class MicrosoftAspNetCoreMvcController extends Class {
191199 }
192200}
193201
194- /** The `Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper` class . */
195- class MicrosoftAspNetCoreMvcHtmlHelperClass extends Class {
196- MicrosoftAspNetCoreMvcHtmlHelperClass ( ) {
197- getNamespace ( ) instanceof MicrosoftAspNetCoreMvcViewFeatures and
198- hasName ( "HtmlHelper " )
202+ /** The `Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper` interface . */
203+ class MicrosoftAspNetCoreMvcRenderingHtmlHelperInterface extends Interface {
204+ MicrosoftAspNetCoreMvcRenderingHtmlHelperInterface ( ) {
205+ getNamespace ( ) instanceof MicrosoftAspNetCoreMvcRendering and
206+ hasName ( "IHtmlHelper " )
199207 }
200208
201209 /** Gets the `Raw` method. */
Original file line number Diff line number Diff line change @@ -176,13 +176,18 @@ class WebPageWriteLiteralToSink extends HtmlSink {
176176abstract class AspNetCoreHtmlSink extends HtmlSink { }
177177
178178/**
179- * An expression that is used as an argument to `HtmlHelper .Raw`, typically in
179+ * An expression that is used as an argument to `IHtmlHelper .Raw`, typically in
180180 * a `.cshtml` file.
181181 */
182182class MicrosoftAspNetCoreMvcHtmlHelperRawSink extends AspNetCoreHtmlSink {
183183 MicrosoftAspNetCoreMvcHtmlHelperRawSink ( ) {
184- this .getExpr ( ) =
185- any ( MicrosoftAspNetCoreMvcHtmlHelperClass h ) .getRawMethod ( ) .getACall ( ) .getAnArgument ( )
184+ exists ( Call c , Callable target |
185+ c .getTarget ( ) = target and
186+ target .hasName ( "Raw" ) and
187+ target .getDeclaringType ( ) .getABaseType * ( ) instanceof
188+ MicrosoftAspNetCoreMvcRenderingHtmlHelperInterface and
189+ this .getExpr ( ) = c .getAnArgument ( )
190+ )
186191 }
187192}
188193
You can’t perform that action at this time.
0 commit comments