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 {
27
27
}
28
28
}
29
29
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
+
30
38
/** An attribute whose type is in the `Microsoft.AspNetCore.Mvc` namespace. */
31
39
class MicrosoftAspNetCoreMvcAttribute extends Attribute {
32
40
MicrosoftAspNetCoreMvcAttribute ( ) {
@@ -191,11 +199,11 @@ class MicrosoftAspNetCoreMvcController extends Class {
191
199
}
192
200
}
193
201
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 MicrosoftAspNetCoreMvcRenderingIHtmlHelperInterface extends Interface {
204
+ MicrosoftAspNetCoreMvcRenderingIHtmlHelperInterface ( ) {
205
+ getNamespace ( ) instanceof MicrosoftAspNetCoreMvcRendering and
206
+ hasName ( "IHtmlHelper " )
199
207
}
200
208
201
209
/** Gets the `Raw` method. */
Original file line number Diff line number Diff line change @@ -176,13 +176,18 @@ class WebPageWriteLiteralToSink extends HtmlSink {
176
176
abstract class AspNetCoreHtmlSink extends HtmlSink { }
177
177
178
178
/**
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
180
180
* a `.cshtml` file.
181
181
*/
182
182
class MicrosoftAspNetCoreMvcHtmlHelperRawSink extends AspNetCoreHtmlSink {
183
183
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
+ MicrosoftAspNetCoreMvcRenderingIHtmlHelperInterface and
189
+ this .getExpr ( ) = c .getAnArgument ( )
190
+ )
186
191
}
187
192
}
188
193
You can’t perform that action at this time.
0 commit comments