[Appsec] Call waf only once, add path params address#2676
Merged
Conversation
Member
Benchmarks Report 🐌Benchmarks for #2676 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 ✔️ More allocations
|
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.AppSecBodyBenchmark.AllCycleMoreComplexBody‑netcoreapp3.1 | 304 B | 392 B | 88 B | 28.95% |
| Benchmarks.Trace.AppSecBodyBenchmark.AllCycleMoreComplexBody‑net472 | 305 B | 393 B | 88 B | 28.85% |
| Benchmarks.Trace.AppSecBodyBenchmark.AllCycleSimpleBody‑netcoreapp3.1 | 328 B | 416 B | 88 B | 26.83% |
| Benchmarks.Trace.AppSecBodyBenchmark.AllCycleSimpleBody‑net472 | 329 B | 417 B | 88 B | 26.75% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | AllCycleSimpleBody |
net472 | 287ns | 1.39ns | 5.55ns | 0.0519 | 0 | 0 | 329 B |
| master | AllCycleSimpleBody |
netcoreapp3.1 | 373ns | 1.48ns | 5.72ns | 0.00444 | 0 | 0 | 328 B |
| master | AllCycleMoreComplexBody |
net472 | 288ns | 1.54ns | 8.59ns | 0.0481 | 0 | 0 | 305 B |
| master | AllCycleMoreComplexBody |
netcoreapp3.1 | 377ns | 1.8ns | 8.45ns | 0.00427 | 0 | 0 | 304 B |
| master | BodyExtractorSimpleBody |
net472 | 424ns | 1.92ns | 6.94ns | 0.0569 | 0 | 0 | 361 B |
| master | BodyExtractorSimpleBody |
netcoreapp3.1 | 434ns | 1.8ns | 7.2ns | 0.00361 | 0 | 0 | 272 B |
| master | BodyExtractorMoreComplexBody |
net472 | 23.9μs | 97.7ns | 378ns | 1.19 | 0.0118 | 0 | 7.62 KB |
| master | BodyExtractorMoreComplexBody |
netcoreapp3.1 | 21.8μs | 102ns | 396ns | 0.0945 | 0 | 0 | 6.75 KB |
| #2676 | AllCycleSimpleBody |
net472 | 310ns | 1.11ns | 4.17ns | 0.066 | 0 | 0 | 417 B |
| #2676 | AllCycleSimpleBody |
netcoreapp3.1 | 405ns | 1.28ns | 4.6ns | 0.00575 | 0 | 0 | 416 B |
| #2676 | AllCycleMoreComplexBody |
net472 | 305ns | 1.6ns | 7.49ns | 0.0623 | 0 | 0 | 393 B |
| #2676 | AllCycleMoreComplexBody |
netcoreapp3.1 | 393ns | 1.61ns | 6.24ns | 0.00537 | 0 | 0 | 392 B |
| #2676 | BodyExtractorSimpleBody |
net472 | 440ns | 2.29ns | 11.9ns | 0.057 | 0 | 0 | 361 B |
| #2676 | BodyExtractorSimpleBody |
netcoreapp3.1 | 443ns | 1.58ns | 6.12ns | 0.00369 | 0 | 0 | 272 B |
| #2676 | BodyExtractorMoreComplexBody |
net472 | 24.1μs | 128ns | 653ns | 1.19 | 0.0116 | 0 | 7.62 KB |
| #2676 | BodyExtractorMoreComplexBody |
netcoreapp3.1 | 20.4μs | 88.3ns | 342ns | 0.0919 | 0 | 0 | 6.75 KB |
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendRequest |
net472 | 0ns | 0ns | 0ns | 0 | 0 | 0 | 0 b |
| master | SendRequest |
netcoreapp3.1 | 289μs | 1.37μs | 5.29μs | 0.144 | 0 | 0 | 19.74 KB |
| #2676 | SendRequest |
net472 | 0ns | 0ns | 0ns | 0 | 0 | 0 | 0 b |
| #2676 | SendRequest |
netcoreapp3.1 | 300μs | 1.58μs | 8.38μs | 0.147 | 0 | 0 | 19.74 KB |
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | ExecuteNonQuery |
net472 | 1.92μs | 10.8ns | 74.9ns | 0.0944 | 0.001 | 0 | 594 B |
| master | ExecuteNonQuery |
netcoreapp3.1 | 1.55μs | 8.38ns | 59.8ns | 0.00904 | 0 | 0 | 632 B |
| #2676 | ExecuteNonQuery |
net472 | 1.81μs | 9.76ns | 51.7ns | 0.0944 | 0 | 0 | 594 B |
| #2676 | ExecuteNonQuery |
netcoreapp3.1 | 1.54μs | 7.18ns | 26.9ns | 0.00844 | 0 | 0 | 632 B |
Benchmarks.Trace.ElasticsearchBenchmark - Faster 🎉 Same allocations ✔️
Faster 🎉 in #2676
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑netcoreapp3.1
1.123
1,939.38
1,726.43
| Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑netcoreapp3.1 | 1.123 | 1,939.38 | 1,726.43 |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | CallElasticsearch |
net472 | 2.77μs | 15ns | 83.5ns | 0.127 | 0 | 0 | 803 B |
| master | CallElasticsearch |
netcoreapp3.1 | 1.66μs | 8.07ns | 35.2ns | 0.0106 | 0 | 0 | 792 B |
| master | CallElasticsearchAsync |
net472 | 2.91μs | 15ns | 67ns | 0.149 | 0.00145 | 0 | 939 B |
| master | CallElasticsearchAsync |
netcoreapp3.1 | 1.96μs | 10.8ns | 66.6ns | 0.0124 | 0 | 0 | 912 B |
| #2676 | CallElasticsearch |
net472 | 2.71μs | 12.7ns | 49.2ns | 0.127 | 0 | 0 | 803 B |
| #2676 | CallElasticsearch |
netcoreapp3.1 | 1.71μs | 6.31ns | 23.6ns | 0.011 | 0 | 0 | 792 B |
| #2676 | CallElasticsearchAsync |
net472 | 3.11μs | 16ns | 76.9ns | 0.149 | 0.00155 | 0 | 939 B |
| #2676 | CallElasticsearchAsync |
netcoreapp3.1 | 1.73μs | 6.49ns | 25.1ns | 0.0129 | 0 | 0 | 912 B |
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | ExecuteAsync |
net472 | 3.04μs | 15.8ns | 73.9ns | 0.168 | 0.00149 | 0 | 1.06 KB |
| master | ExecuteAsync |
netcoreapp3.1 | 1.94μs | 7.76ns | 29ns | 0.0146 | 0 | 0 | 1.03 KB |
| #2676 | ExecuteAsync |
net472 | 3.07μs | 16ns | 80ns | 0.168 | 0.00152 | 0 | 1.06 KB |
| #2676 | ExecuteAsync |
netcoreapp3.1 | 2.09μs | 11.2ns | 60.2ns | 0.0137 | 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 | 6.71μs | 33.5ns | 153ns | 0.36 | 0 | 0 | 2.28 KB |
| master | SendAsync |
netcoreapp3.1 | 4.75μs | 23ns | 94.9ns | 0.0306 | 0 | 0 | 2.21 KB |
| #2676 | SendAsync |
net472 | 6.72μs | 29.8ns | 111ns | 0.359 | 0 | 0 | 2.28 KB |
| #2676 | SendAsync |
netcoreapp3.1 | 4.82μs | 19.6ns | 78.6ns | 0.03 | 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.43μs | 19.8ns | 157ns | 0.228 | 0 | 0 | 1.45 KB |
| master | EnrichedLog |
netcoreapp3.1 | 3.03μs | 10.7ns | 39.9ns | 0.0206 | 0 | 0 | 1.53 KB |
| #2676 | EnrichedLog |
net472 | 3.48μs | 19ns | 113ns | 0.228 | 0 | 0 | 1.45 KB |
| #2676 | EnrichedLog |
netcoreapp3.1 | 3.1μs | 14.7ns | 78.9ns | 0.0219 | 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 | 293μs | 1.44μs | 5.93μs | 0.434 | 0.145 | 0 | 4.33 KB |
| master | EnrichedLog |
netcoreapp3.1 | 227μs | 864ns | 3.23μs | 0 | 0 | 0 | 4.21 KB |
| #2676 | EnrichedLog |
net472 | 296μs | 1.65μs | 10.7μs | 0.45 | 0.15 | 0 | 4.33 KB |
| #2676 | EnrichedLog |
netcoreapp3.1 | 233μs | 1.1μs | 4.39μ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 | 7.28μs | 34.4ns | 154ns | 0.506 | 0 | 0 | 3.23 KB |
| master | EnrichedLog |
netcoreapp3.1 | 6.4μs | 32ns | 143ns | 0.0476 | 0 | 0 | 3.6 KB |
| #2676 | EnrichedLog |
net472 | 7.83μs | 28.4ns | 106ns | 0.505 | 0 | 0 | 3.23 KB |
| #2676 | EnrichedLog |
netcoreapp3.1 | 6.98μs | 23.6ns | 91.5ns | 0.0482 | 0 | 0 | 3.6 KB |
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendReceive |
net472 | 2.37μs | 11.1ns | 41.4ns | 0.16 | 0 | 0 | 1.01 KB |
| master | SendReceive |
netcoreapp3.1 | 2.03μs | 8.9ns | 37.8ns | 0.0134 | 0 | 0 | 1.01 KB |
| #2676 | SendReceive |
net472 | 2.27μs | 10.3ns | 43.6ns | 0.161 | 0 | 0 | 1.01 KB |
| #2676 | SendReceive |
netcoreapp3.1 | 1.98μs | 9.3ns | 37.2ns | 0.0139 | 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 | 5.91μs | 24.1ns | 90.2ns | 0.293 | 0 | 0 | 1.87 KB |
| master | EnrichedLog |
netcoreapp3.1 | 5.08μs | 21.4ns | 80.1ns | 0.0203 | 0 | 0 | 1.49 KB |
| #2676 | EnrichedLog |
net472 | 6μs | 31ns | 152ns | 0.29 | 0 | 0 | 1.87 KB |
| #2676 | EnrichedLog |
netcoreapp3.1 | 5.07μs | 24.9ns | 106ns | 0.0198 | 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 | 887ns | 4.44ns | 22.7ns | 0.0717 | 0 | 0 | 457 B |
| master | StartFinishSpan |
netcoreapp3.1 | 927ns | 5.27ns | 37.3ns | 0.0063 | 0 | 0 | 456 B |
| master | StartFinishScope |
net472 | 1.12μs | 5.97ns | 31ns | 0.0846 | 0 | 0 | 538 B |
| master | StartFinishScope |
netcoreapp3.1 | 1.03μs | 3.08ns | 11.5ns | 0.00799 | 0 | 0 | 576 B |
| #2676 | StartFinishSpan |
net472 | 867ns | 2.94ns | 10.2ns | 0.0717 | 0 | 0 | 457 B |
| #2676 | StartFinishSpan |
netcoreapp3.1 | 900ns | 5.19ns | 42.5ns | 0.00612 | 0 | 0 | 456 B |
| #2676 | StartFinishScope |
net472 | 1.13μs | 5.78ns | 25.8ns | 0.0844 | 0 | 0 | 538 B |
| #2676 | StartFinishScope |
netcoreapp3.1 | 1.04μs | 5.97ns | 45.5ns | 0.00765 | 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.31μs | 4.88ns | 17.6ns | 0.084 | 0 | 0 | 538 B |
| master | RunOnMethodBegin |
netcoreapp3.1 | 1.16μs | 3.06ns | 11ns | 0.00769 | 0 | 0 | 576 B |
| #2676 | RunOnMethodBegin |
net472 | 1.31μs | 7.09ns | 39.5ns | 0.0841 | 0 | 0 | 538 B |
| #2676 | RunOnMethodBegin |
netcoreapp3.1 | 1.18μs | 5.99ns | 26.8ns | 0.00786 | 0 | 0 | 576 B |
anna-git
force-pushed
the
anna/appsec/add-path-params
branch
from
April 13, 2022 09:23
f28fb1f to
ef8f2a0
Compare
This comment has been minimized.
This comment has been minimized.
anna-git
marked this pull request as ready for review
April 13, 2022 13:35
robertpi
reviewed
Apr 13, 2022
| { | ||
| foreach (var item in args) | ||
| { | ||
| if (!_addresses.ContainsKey(item.Key)) |
Member
There was a problem hiding this comment.
Might make sense to replace the key rather than ignoring it?
Contributor
Author
There was a problem hiding this comment.
yes fixed in ed56173
taking last value then
robertpi
approved these changes
Apr 14, 2022
Member
Code Coverage Report 📊✔️ Merging #2676 into master will not change line coverage
View the full report for further details: Datadog.Trace Breakdown ✔️
The following classes have significant coverage changes.
1 classes were removed from Datadog.Trace in #2676 View the full reports for further details: |
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
Building up all the addresses and calling the waf only in the end
Adding an address that was accidentally removed to the waf, the path parameters of an mvc route.
Reason for change
Improvement on performances only calling waf once
Some path parameters attacks arent caught because route data params werent forwarded
Implementation details
Change instrumentation for asp.net, take advantage of the same instrumentation as the body one
Adapt integration tests with names per scenario
Test coverage
Other details