-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Expand file tree
/
Copy pathAspRemoteFlowSource.cs
More file actions
66 lines (52 loc) · 2.15 KB
/
AspRemoteFlowSource.cs
File metadata and controls
66 lines (52 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc;
using System;
namespace Testing
{
public class ViewModel
{
public string RequestId { get; set; } // Considered tainted.
public object RequestIdField; // Considered tainted.
public string RequestIdOnlyGet { get; } // Not considered tainted as there is no setter.
public string RequestIdPrivateSet { get; private set; } // Not considered tainted as it has a private setter.
public static object RequestIdStatic { get; set; } // Not considered tainted as it is static.
private string RequestIdPrivate { get; set; } // Not considered tainted as it is private.
}
public class TestController : Controller
{
public object MyAction(ViewModel viewModel)
{
throw null;
}
}
public class Item
{
public string Tainted { get; set; }
}
public class AspRoutingEndpoints
{
public delegate void MapGetHandler(string param);
public void HandlerMethod(string param) { }
public void M1(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
// The delegate parameters are considered flow sources.
app.MapGet("/api/redirect/{newUrl}", (string newUrl) => { });
app.MapGet("/{myApi}/redirect/{myUrl}", (string myApi, string myUrl) => { });
Action<string> handler = (string lambdaParam) => { };
app.MapGet("/api/redirect/{lambdaParam}", handler);
MapGetHandler handler2 = HandlerMethod;
app.MapGet("/api/redirect/{mapGetParam}", handler2);
app.MapPost("/api/redirect/{mapPostParam}", (string mapPostParam) => { });
app.MapPut("/api/redirect/{mapPutParam}", (string mapPutParam) => { });
app.MapDelete("/api/redirect/{mapDeleteParam}", (string mapDeleteParam) => { });
app.MapPost("/items", (Item item) => { });
app.Run();
}
}
public abstract class AbstractTestController : Controller
{
public void MyActionMethod(string param) { }
}
}