Skip to content

Commit 6e2ba88

Browse files
committed
C#: Add an ASP.NET flow source example when using the WebMethod attribute.
1 parent 3e11b2e commit 6e2ba88

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

csharp/ql/test/library-tests/dataflow/flowsources/remote/RemoteFlowSource.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,32 @@ public static async void M3(System.Net.WebSockets.WebSocket webSocket)
5454
}
5555
}
5656
}
57+
58+
namespace AspRemoteFlowSource
59+
{
60+
using System.Web.Services;
61+
62+
public class MySubData
63+
{
64+
public string SubDataProp { get; set; }
65+
}
66+
67+
public class MyData
68+
{
69+
public string DataField;
70+
public string DataProp { get; set; }
71+
public MySubData SubData { get; set; }
72+
}
73+
74+
public class MyService
75+
{
76+
[WebMethod]
77+
public void MyMethod(MyData data)
78+
{
79+
Use(data.DataProp);
80+
Use(data.SubData.SubDataProp);
81+
}
82+
83+
public static void Use(object o) { }
84+
}
85+
}

csharp/ql/test/library-tests/dataflow/flowsources/remote/remoteFlowSource.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ remoteFlowSources
1212
| RemoteFlowSource.cs:45:17:45:23 | access to parameter request | ASP.NET query string |
1313
| RemoteFlowSource.cs:45:17:45:42 | access to property RawUrl | ASP.NET unvalidated request data |
1414
| RemoteFlowSource.cs:52:55:52:61 | [post] access to local variable segment | external |
15+
| RemoteFlowSource.cs:77:37:77:40 | data | ASP.NET web service input |

csharp/ql/test/resources/stubs/System.Web.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,3 +454,8 @@ public class SimpleTypeResolver : System.Web.Script.Serialization.JavaScriptType
454454
public SimpleTypeResolver() => throw null;
455455
}
456456
}
457+
458+
namespace System.Web.Services
459+
{
460+
public class WebMethodAttribute : Attribute { }
461+
}

0 commit comments

Comments
 (0)