Skip to content

Commit 034fdee

Browse files
authored
Robert/asm/waf crash bug (#4726)
* fix and integration tests * more snapshots, always welcome
1 parent 6eeaa11 commit 034fdee

11 files changed

+1915
-0
lines changed

tracer/src/Datadog.Trace/AppSec/Waf/Encoder.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ void EnumerateItems<TKeySource, TValueSource>()
137137
var key = getKey(keyValue!);
138138
if (string.IsNullOrEmpty(key))
139139
{
140+
childrenCount--;
140141
Log.Warning("EncodeDictionary: ignoring dictionary member with null name");
141142
continue;
142143
}
@@ -154,6 +155,7 @@ void EnumerateItems<TKeySource, TValueSource>()
154155
var key = getKey(keyValue);
155156
if (string.IsNullOrEmpty(key))
156157
{
158+
childrenCount--;
157159
Log.Warning("EncodeDictionary: ignoring dictionary member with null name");
158160
continue;
159161
}

tracer/test/Datadog.Trace.Security.IntegrationTests/AspNetCoreBase.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public async Task TryStartApp()
4343
[InlineData(AddressesConstants.RequestQuery, HttpStatusCode.OK, "/Health/?[$slice]=value")]
4444
[InlineData(AddressesConstants.RequestQuery, HttpStatusCode.OK, "/Health/?arg&[$slice]")]
4545
[InlineData(AddressesConstants.RequestPathParams, HttpStatusCode.OK, "/health/params/appscan_fingerprint")]
46+
[InlineData(AddressesConstants.RequestPathParams, HttpStatusCode.OK, "/health/params/appscan_fingerprint?&q=help")]
4647
[Trait("RunOnWindows", "True")]
4748
public async Task TestRequest(string test, HttpStatusCode expectedStatusCode, string url)
4849
{

tracer/test/Datadog.Trace.Security.IntegrationTests/AspNetMvc5.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public AspNetMvc5(IisFixture iisFixture, ITestOutputHelper output, bool classicM
8282
[InlineData(AddressesConstants.RequestQuery, "/Health/?arg=[$slice]", null)]
8383
[InlineData(AddressesConstants.RequestQuery, "/Health/?arg&[$slice]", null)]
8484
[InlineData(AddressesConstants.RequestPathParams, "/Health/params/appscan_fingerprint", null)]
85+
[InlineData(AddressesConstants.RequestPathParams, "/Health/params/appscan_fingerprint?&q=help", null)]
8586
[InlineData(AddressesConstants.RequestBody, "/Home/Upload", "{\"Property1\": \"[$slice]\"}")]
8687
[InlineData(AddressesConstants.RequestBody, "/Home/UploadStruct", "{\"Property1\": \"[$slice]\"}")]
8788
[InlineData(AddressesConstants.RequestBody, "/Home/UploadJson", "{\"DictionaryProperty\": {\"a\":\"[$slice]\"} }")]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
[
2+
{
3+
TraceId: Id_1,
4+
SpanId: Id_2,
5+
Name: aspnet_core.request,
6+
Resource: GET /health/params/{id},
7+
Service: Samples.Security.AspNetCore2,
8+
Type: web,
9+
Tags: {
10+
aspnet_core.route: health/params/{id},
11+
component: aspnet_core,
12+
env: integration_tests,
13+
http.method: GET,
14+
http.request.headers.host: localhost:00000,
15+
http.route: health/params/{id},
16+
http.status_code: 200,
17+
http.url: http://localhost:00000/health/params/appscan_fingerprint?&q=help,
18+
http.useragent: Mistake Not...,
19+
language: dotnet,
20+
runtime-id: Guid_1,
21+
span.kind: server,
22+
_dd.p.dm: -0
23+
},
24+
Metrics: {
25+
process_id: 0,
26+
_dd.agent_psr: 1.0,
27+
_dd.top_level: 1.0,
28+
_dd.tracer_kr: 1.0,
29+
_sampling_priority_v1: 1.0
30+
}
31+
},
32+
{
33+
TraceId: Id_3,
34+
SpanId: Id_4,
35+
Name: aspnet_core.request,
36+
Resource: GET /health/params/{id},
37+
Service: Samples.Security.AspNetCore2,
38+
Type: web,
39+
Tags: {
40+
aspnet_core.route: health/params/{id},
41+
component: aspnet_core,
42+
env: integration_tests,
43+
http.method: GET,
44+
http.request.headers.host: localhost:00000,
45+
http.route: health/params/{id},
46+
http.status_code: 200,
47+
http.url: http://localhost:00000/health/params/appscan_fingerprint?&q=help,
48+
http.useragent: Mistake Not...,
49+
language: dotnet,
50+
runtime-id: Guid_1,
51+
span.kind: server,
52+
_dd.p.dm: -0
53+
},
54+
Metrics: {
55+
process_id: 0,
56+
_dd.agent_psr: 1.0,
57+
_dd.top_level: 1.0,
58+
_dd.tracer_kr: 1.0,
59+
_sampling_priority_v1: 1.0
60+
}
61+
},
62+
{
63+
TraceId: Id_5,
64+
SpanId: Id_6,
65+
Name: aspnet_core.request,
66+
Resource: GET /health/params/{id},
67+
Service: Samples.Security.AspNetCore2,
68+
Type: web,
69+
Tags: {
70+
aspnet_core.route: health/params/{id},
71+
component: aspnet_core,
72+
env: integration_tests,
73+
http.method: GET,
74+
http.request.headers.host: localhost:00000,
75+
http.route: health/params/{id},
76+
http.status_code: 200,
77+
http.url: http://localhost:00000/health/params/appscan_fingerprint?&q=help,
78+
http.useragent: Mistake Not...,
79+
language: dotnet,
80+
runtime-id: Guid_1,
81+
span.kind: server,
82+
_dd.p.dm: -0
83+
},
84+
Metrics: {
85+
process_id: 0,
86+
_dd.agent_psr: 1.0,
87+
_dd.top_level: 1.0,
88+
_dd.tracer_kr: 1.0,
89+
_sampling_priority_v1: 1.0
90+
}
91+
},
92+
{
93+
TraceId: Id_7,
94+
SpanId: Id_8,
95+
Name: aspnet_core.request,
96+
Resource: GET /health/params/{id},
97+
Service: Samples.Security.AspNetCore2,
98+
Type: web,
99+
Tags: {
100+
aspnet_core.route: health/params/{id},
101+
component: aspnet_core,
102+
env: integration_tests,
103+
http.method: GET,
104+
http.request.headers.host: localhost:00000,
105+
http.route: health/params/{id},
106+
http.status_code: 200,
107+
http.url: http://localhost:00000/health/params/appscan_fingerprint?&q=help,
108+
http.useragent: Mistake Not...,
109+
language: dotnet,
110+
runtime-id: Guid_1,
111+
span.kind: server,
112+
_dd.p.dm: -0
113+
},
114+
Metrics: {
115+
process_id: 0,
116+
_dd.agent_psr: 1.0,
117+
_dd.top_level: 1.0,
118+
_dd.tracer_kr: 1.0,
119+
_sampling_priority_v1: 1.0
120+
}
121+
},
122+
{
123+
TraceId: Id_9,
124+
SpanId: Id_10,
125+
Name: aspnet_core.request,
126+
Resource: GET /health/params/{id},
127+
Service: Samples.Security.AspNetCore2,
128+
Type: web,
129+
Tags: {
130+
aspnet_core.route: health/params/{id},
131+
component: aspnet_core,
132+
env: integration_tests,
133+
http.method: GET,
134+
http.request.headers.host: localhost:00000,
135+
http.route: health/params/{id},
136+
http.status_code: 200,
137+
http.url: http://localhost:00000/health/params/appscan_fingerprint?&q=help,
138+
http.useragent: Mistake Not...,
139+
language: dotnet,
140+
runtime-id: Guid_1,
141+
span.kind: server,
142+
_dd.p.dm: -0
143+
},
144+
Metrics: {
145+
process_id: 0,
146+
_dd.agent_psr: 1.0,
147+
_dd.top_level: 1.0,
148+
_dd.tracer_kr: 1.0,
149+
_sampling_priority_v1: 1.0
150+
}
151+
}
152+
]

0 commit comments

Comments
 (0)