[Appsec] Scanning request body by the waf#2495
Merged
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
robertpi
force-pushed
the
appsec/parsed-body-common
branch
from
February 23, 2022 17:00
f0e5fcb to
4919b76
Compare
This comment has been minimized.
This comment has been minimized.
anna-git
force-pushed
the
appsec/parsed-body-common
branch
2 times, most recently
from
February 24, 2022 16:57
60fc69f to
f61ac89
Compare
This comment has been minimized.
This comment has been minimized.
anna-git
force-pushed
the
appsec/parsed-body-common
branch
2 times, most recently
from
February 28, 2022 18:55
8b00c37 to
bc0ea81
Compare
This comment has been minimized.
This comment has been minimized.
anna-git
force-pushed
the
appsec/parsed-body-common
branch
from
March 1, 2022 09:19
bc0ea81 to
dce5b97
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
anna-git
force-pushed
the
appsec/parsed-body-common
branch
from
March 2, 2022 14:05
3173a4d to
0c676f6
Compare
anna-git
force-pushed
the
appsec/parsed-body-common
branch
from
March 2, 2022 14:36
0c676f6 to
9ebebfe
Compare
This comment has been minimized.
This comment has been minimized.
anna-git
force-pushed
the
appsec/parsed-body-common
branch
2 times, most recently
from
March 3, 2022 13:10
f984bab to
7f9f485
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
anna-git
force-pushed
the
appsec/parsed-body-common
branch
from
March 4, 2022 15:01
1c97e04 to
cc28fef
Compare
This comment has been minimized.
This comment has been minimized.
anna-git
force-pushed
the
appsec/parsed-body-common
branch
from
March 7, 2022 19:36
8eb45a5 to
ee291cc
Compare
This comment has been minimized.
This comment has been minimized.
anna-git
force-pushed
the
appsec/parsed-body-common
branch
from
March 8, 2022 10:36
ee291cc to
15b96e2
Compare
robertpi
marked this pull request as ready for review
March 8, 2022 13:30
This comment has been minimized.
This comment has been minimized.
anna-git
force-pushed
the
appsec/parsed-body-common
branch
from
March 9, 2022 10:48
3425158 to
68036f9
Compare
Includes: * Win Forms * WebApi * MVC
Adding a more complex model Removing tests with block enabled Removing tests with block enabled Renaming samples wth security prefix to avoid nuke confusion Changing sln accordingly
Detect object graphs with cycles Only look at instance properties
Use fields instead of property to avoid side effects Fix possible null ref
* first appsec benchmark * Remove required filter and add more benchmarks * Fix benchmarks for .NET framework * add a more complex object * fix build steps * Env variables * fix benchmarks * Init httpcontext outside of benchmark * remove global setup Co-authored-by: Robert Pickering <[email protected]>
Adding verified files
Factorize peek and pop with Func remove duck type on real type
Response to comments
… derived attribute
anna-git
force-pushed
the
appsec/parsed-body-common
branch
from
March 31, 2022 08:16
718e5ca to
36fe7b9
Compare
Member
Code Coverage Report 📊✔️ Merging #2495 into master will not change line coverage
View the full report for further details: Datadog.Trace Breakdown ✔️
The following classes have significant coverage changes.
The following classes were added in #2495:
View the full reports for further details: |
Member
Benchmarks Report 🐌Benchmarks for #2495 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.GraphQLBenchmark - Faster 🎉 Same allocations ✔️
|
| Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net472 | 1.136 | 3,793.60 | 3,338.83 |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | ExecuteAsync |
net472 | 3.81μs | 20.4ns | 126ns | 0.165 | 0 | 0 | 1.06 KB |
| master | ExecuteAsync |
netcoreapp3.1 | 2.05μs | 9.96ns | 41.1ns | 0.0145 | 0 | 0 | 1.03 KB |
| #2495 | ExecuteAsync |
net472 | 3.37μs | 16.3ns | 71ns | 0.168 | 0.00166 | 0 | 1.06 KB |
| #2495 | ExecuteAsync |
netcoreapp3.1 | 2.05μs | 8.28ns | 32.1ns | 0.0141 | 0 | 0 | 1.03 KB |
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendAsync |
net472 | 7.38μs | 30.2ns | 109ns | 0.36 | 0 | 0 | 2.28 KB |
| master | SendAsync |
netcoreapp3.1 | 4.8μs | 19.4ns | 72.7ns | 0.0312 | 0 | 0 | 2.21 KB |
| #2495 | SendAsync |
net472 | 7.3μs | 38.4ns | 277ns | 0.354 | 0 | 0 | 2.28 KB |
| #2495 | SendAsync |
netcoreapp3.1 | 5.26μs | 27ns | 124ns | 0.0311 | 0 | 0 | 2.21 KB |
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net472 | 3.54μs | 14.2ns | 58.7ns | 0.227 | 0 | 0 | 1.45 KB |
| master | EnrichedLog |
netcoreapp3.1 | 3.28μs | 15.5ns | 61.9ns | 0.0216 | 0 | 0 | 1.53 KB |
| #2495 | EnrichedLog |
net472 | 3.55μs | 13.2ns | 50.9ns | 0.228 | 0 | 0 | 1.45 KB |
| #2495 | EnrichedLog |
netcoreapp3.1 | 3.34μs | 16.2ns | 85.5ns | 0.0218 | 0 | 0 | 1.53 KB |
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net472 | 304μs | 1.22μs | 4.73μs | 0.446 | 0.149 | 0 | 4.33 KB |
| master | EnrichedLog |
netcoreapp3.1 | 238μs | 669ns | 2.5μs | 0 | 0 | 0 | 4.21 KB |
| #2495 | EnrichedLog |
net472 | 318μs | 1.79μs | 12.4μs | 0.316 | 0.158 | 0 | 4.33 KB |
| #2495 | EnrichedLog |
netcoreapp3.1 | 244μs | 908ns | 3.52μs | 0 | 0 | 0 | 4.21 KB |
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net472 | 8.49μs | 46.2ns | 333ns | 0.503 | 0 | 0 | 3.23 KB |
| master | EnrichedLog |
netcoreapp3.1 | 6.62μs | 23.9ns | 92.6ns | 0.0483 | 0 | 0 | 3.6 KB |
| #2495 | EnrichedLog |
net472 | 9.1μs | 27.6ns | 103ns | 0.503 | 0 | 0 | 3.23 KB |
| #2495 | EnrichedLog |
netcoreapp3.1 | 6.81μs | 25.3ns | 98.2ns | 0.0508 | 0 | 0 | 3.6 KB |
Benchmarks.Trace.RedisBenchmark - Faster 🎉 Same allocations ✔️
Faster 🎉 in #2495
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.RedisBenchmark.SendReceive‑netcoreapp3.1
1.164
2,398.91
2,060.16
| Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.RedisBenchmark.SendReceive‑netcoreapp3.1 | 1.164 | 2,398.91 | 2,060.16 |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendReceive |
net472 | 2.57μs | 14.3ns | 93.7ns | 0.158 | 0 | 0 | 1.01 KB |
| master | SendReceive |
netcoreapp3.1 | 2.4μs | 13.2ns | 79.1ns | 0.0144 | 0 | 0 | 1.01 KB |
| #2495 | SendReceive |
net472 | 2.54μs | 12.7ns | 53.9ns | 0.161 | 0.00124 | 0 | 1.01 KB |
| #2495 | SendReceive |
netcoreapp3.1 | 2.06μs | 9.18ns | 35.6ns | 0.0136 | 0 | 0 | 1.01 KB |
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net472 | 6.36μs | 29ns | 112ns | 0.292 | 0 | 0 | 1.87 KB |
| master | EnrichedLog |
netcoreapp3.1 | 5.51μs | 25.4ns | 101ns | 0.0187 | 0 | 0 | 1.49 KB |
| #2495 | EnrichedLog |
net472 | 6.22μs | 20.5ns | 79.3ns | 0.29 | 0 | 0 | 1.87 KB |
| #2495 | EnrichedLog |
netcoreapp3.1 | 5.53μs | 27.8ns | 130ns | 0.0188 | 0 | 0 | 1.49 KB |
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StartFinishSpan |
net472 | 928ns | 4.45ns | 18.4ns | 0.0716 | 0 | 0 | 457 B |
| master | StartFinishSpan |
netcoreapp3.1 | 909ns | 4.53ns | 18.7ns | 0.00634 | 0 | 0 | 456 B |
| master | StartFinishScope |
net472 | 1.15μs | 5.29ns | 20.5ns | 0.0843 | 0 | 0 | 538 B |
| master | StartFinishScope |
netcoreapp3.1 | 1.3μs | 3.43ns | 12.8ns | 0.00821 | 0 | 0 | 576 B |
| #2495 | StartFinishSpan |
net472 | 954ns | 4.28ns | 16.6ns | 0.0717 | 0 | 0 | 457 B |
| #2495 | StartFinishSpan |
netcoreapp3.1 | 915ns | 3.73ns | 14.4ns | 0.00634 | 0 | 0 | 456 B |
| #2495 | StartFinishScope |
net472 | 1.14μs | 3.89ns | 14.5ns | 0.0842 | 0 | 0 | 538 B |
| #2495 | StartFinishScope |
netcoreapp3.1 | 1.28μs | 7.31ns | 51.7ns | 0.00802 | 0 | 0 | 576 B |
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | RunOnMethodBegin |
net472 | 1.42μs | 4.14ns | 16ns | 0.0842 | 0 | 0 | 538 B |
| master | RunOnMethodBegin |
netcoreapp3.1 | 1.25μs | 7.05ns | 49.3ns | 0.00779 | 0 | 0 | 576 B |
| #2495 | RunOnMethodBegin |
net472 | 1.4μs | 8ns | 62ns | 0.0844 | 0 | 0 | 538 B |
| #2495 | RunOnMethodBegin |
netcoreapp3.1 | 1.2μs | 4.08ns | 16.3ns | 0.00766 | 0 | 0 | 576 B |
This was referenced Apr 1, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
Monitoring incoming body's request
https://datadoghq.atlassian.net/wiki/spaces/APS/pages/2356905034/server.request.body
Reason for change
Getting an http request's body scanned by the waf, in both core and framework
Implementation details
Adding instrumentation points for Core and Framework (mvc, web api, webforms, razor pages)
Adding benchmarks on the body extractor part
Test coverage
Adding unit tests
Adding integration tests
Other details