File tree Expand file tree Collapse file tree 3 files changed +57
-0
lines changed
integration-tests/all-platforms/blazor
security/dataflow/flowsinks Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ | BlazorTest/Components/MyOutput.razor:5:53:5:57 | access to property Value |
2
+ | BlazorTest/Components/Pages/TestPage.razor:11:48:11:55 | access to property UrlParam |
3
+ | BlazorTest/Components/Pages/TestPage.razor:20:60:20:69 | access to property QueryParam |
4
+ | BlazorTest/Components/Pages/TestPage.razor:29:53:29:63 | access to property InputValue1 |
5
+ | BlazorTest/Components/Pages/TestPage.razor:38:53:38:63 | access to property InputValue2 |
6
+ | BlazorTest/Components/Pages/TestPage.razor:47:53:47:68 | access to property Value |
7
+ | BlazorTest/Components/Pages/TestPage.razor:56:53:56:63 | access to property InputValue3 |
8
+ | BlazorTest/Components/Pages/TestPage.razor:65:53:65:63 | access to property InputValue4 |
Original file line number Diff line number Diff line change
1
+ /** Provides definitions related to the namespace `Microsoft.AspNetCore.Components`. */
2
+
3
+ import csharp
4
+ private import AspNetCore
5
+
6
+ /** The `Microsoft.AspNetCore.Components` namespace. */
7
+ class MicrosoftAspNetCoreComponents extends Namespace {
8
+ MicrosoftAspNetCoreComponents ( ) {
9
+ this .getParentNamespace ( ) instanceof MicrosoftAspNetCoreNamespace and
10
+ this .hasName ( "Components" )
11
+ }
12
+ }
13
+
14
+ /** A struct in the `Microsoft.AspNetCore.Components` namespace. */
15
+ class MicrosoftAspNetCoreComponentsStruct extends Struct {
16
+ MicrosoftAspNetCoreComponentsStruct ( ) {
17
+ this .getNamespace ( ) instanceof MicrosoftAspNetCoreComponents
18
+ }
19
+ }
20
+
21
+ /** The `Microsoft.AspNetCore.Components.MarkupString` struct. */
22
+ class MicrosoftAspNetCoreComponentsMarkupStringStruct extends MicrosoftAspNetCoreComponentsStruct {
23
+ MicrosoftAspNetCoreComponentsMarkupStringStruct ( ) { this .hasName ( "MarkupString" ) }
24
+
25
+ /** Gets the explicit conversion operator from `string` to `StringStruct`. */
26
+ ExplicitConversionOperator getOpExplicit ( ) {
27
+ result .getDeclaringType ( ) instanceof MicrosoftAspNetCoreComponentsMarkupStringStruct and
28
+ result .getReturnType ( ) instanceof MicrosoftAspNetCoreComponentsMarkupStringStruct and
29
+ result .getParameter ( 0 ) .getType ( ) instanceof StringType
30
+ }
31
+ }
Original file line number Diff line number Diff line change 5
5
import csharp
6
6
private import Remote
7
7
private import semmle.code.csharp.frameworks.microsoft.AspNetCore
8
+ private import semmle.code.csharp.frameworks.microsoft.Blazor
8
9
private import semmle.code.csharp.frameworks.system.Net
9
10
private import semmle.code.csharp.frameworks.system.Web
10
11
private import semmle.code.csharp.frameworks.system.web.Mvc
@@ -139,6 +140,23 @@ class HtmlString extends HtmlSink {
139
140
}
140
141
}
141
142
143
+ /**
144
+ * An expression passed to the constructor of a `MarkupString` or converted to a `MarkupString`.
145
+ */
146
+ class MarkupStringSink extends HtmlSink {
147
+ MarkupStringSink ( ) {
148
+ exists ( ObjectCreation oc |
149
+ oc .getObjectType ( ) instanceof MicrosoftAspNetCoreComponentsMarkupStringStruct and
150
+ oc .getAnArgument ( ) = this .getExpr ( )
151
+ )
152
+ or
153
+ exists ( OperatorCall oc |
154
+ oc .getTarget ( ) = any ( MicrosoftAspNetCoreComponentsMarkupStringStruct s ) .getOpExplicit ( ) and
155
+ oc .getArgument ( 0 ) = this .getExpr ( )
156
+ )
157
+ }
158
+ }
159
+
142
160
/**
143
161
* An expression that is used as an argument to `Page.WriteLiteral`, typically in
144
162
* a `.cshtml` file.
You can’t perform that action at this time.
0 commit comments