-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IAST] Safeguard Method Replace aspects with try/catch #5841
Conversation
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing the following branches/commits: Execution-time benchmarks measure the whole time it takes to execute a program. And are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are shown in red. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5841) - mean (75ms) : 63, 86
. : milestone, 75,
master - mean (73ms) : 64, 82
. : milestone, 73,
section CallTarget+Inlining+NGEN
This PR (5841) - mean (1,068ms) : 1049, 1088
. : milestone, 1068,
master - mean (1,061ms) : 1045, 1078
. : milestone, 1061,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5841) - mean (109ms) : 106, 112
. : milestone, 109,
master - mean (108ms) : 104, 112
. : milestone, 108,
section CallTarget+Inlining+NGEN
This PR (5841) - mean (756ms) : 729, 782
. : milestone, 756,
master - mean (746ms) : 728, 763
. : milestone, 746,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5841) - mean (92ms) : 89, 94
. : milestone, 92,
master - mean (92ms) : 90, 94
. : milestone, 92,
section CallTarget+Inlining+NGEN
This PR (5841) - mean (742ms) : 636, 848
. : milestone, 742,
master - mean (702ms) : 685, 718
. : milestone, 702,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5841) - mean (193ms) : 190, 196
. : milestone, 193,
master - mean (192ms) : 189, 195
. : milestone, 192,
section CallTarget+Inlining+NGEN
This PR (5841) - mean (1,174ms) : 1149, 1199
. : milestone, 1174,
master - mean (1,163ms) : 1140, 1186
. : milestone, 1163,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5841) - mean (278ms) : 271, 285
. : milestone, 278,
master - mean (276ms) : 271, 281
. : milestone, 276,
section CallTarget+Inlining+NGEN
This PR (5841) - mean (922ms) : 894, 951
. : milestone, 922,
master - mean (913ms) : 894, 933
. : milestone, 913,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5841) - mean (266ms) : 262, 270
. : milestone, 266,
master - mean (266ms) : 263, 269
. : milestone, 266,
section CallTarget+Inlining+NGEN
This PR (5841) - mean (904ms) : 878, 930
. : milestone, 904,
master - mean (918ms) : 856, 979
. : milestone, 918,
|
Datadog ReportBranch report: ✅ 0 Failed, 425962 Passed, 2656 Skipped, 28h 2m 39.79s Total Time |
b5a02be
to
a2cf4e2
Compare
Benchmarks Report for appsec 🐌Benchmarks for #5841 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.Asm.AppSecBodyBenchmark - Faster 🎉 Same allocations ✔️
|
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody‑netcoreapp3.1 | 1.276 | 249.89 | 195.90 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | AllCycleSimpleBody |
net6.0 | 72.8μs | 112ns | 433ns | 0.0724 | 0 | 0 | 6 KB |
master | AllCycleSimpleBody |
netcoreapp3.1 | 61.6μs | 55.2ns | 207ns | 0.0922 | 0 | 0 | 6.95 KB |
master | AllCycleSimpleBody |
net472 | 47.4μs | 27.3ns | 102ns | 1.31 | 0 | 0 | 8.33 KB |
master | AllCycleMoreComplexBody |
net6.0 | 78.8μs | 164ns | 635ns | 0.119 | 0 | 0 | 9.51 KB |
master | AllCycleMoreComplexBody |
netcoreapp3.1 | 68.8μs | 103ns | 400ns | 0.137 | 0 | 0 | 10.36 KB |
master | AllCycleMoreComplexBody |
net472 | 54.7μs | 51.1ns | 184ns | 1.86 | 0.0274 | 0 | 11.85 KB |
master | ObjectExtractorSimpleBody |
net6.0 | 144ns | 0.122ns | 0.457ns | 0.00397 | 0 | 0 | 280 B |
master | ObjectExtractorSimpleBody |
netcoreapp3.1 | 250ns | 0.148ns | 0.535ns | 0.00375 | 0 | 0 | 272 B |
master | ObjectExtractorSimpleBody |
net472 | 167ns | 0.274ns | 1.06ns | 0.0446 | 0 | 0 | 281 B |
master | ObjectExtractorMoreComplexBody |
net6.0 | 2.99μs | 1.2ns | 4.64ns | 0.0526 | 0 | 0 | 3.78 KB |
master | ObjectExtractorMoreComplexBody |
netcoreapp3.1 | 3.91μs | 1.79ns | 6.95ns | 0.051 | 0 | 0 | 3.69 KB |
master | ObjectExtractorMoreComplexBody |
net472 | 3.79μs | 4.94ns | 18.5ns | 0.602 | 0.0057 | 0 | 3.8 KB |
#5841 | AllCycleSimpleBody |
net6.0 | 73.5μs | 122ns | 438ns | 0.0744 | 0 | 0 | 6 KB |
#5841 | AllCycleSimpleBody |
netcoreapp3.1 | 62.4μs | 84.8ns | 328ns | 0.0932 | 0 | 0 | 6.95 KB |
#5841 | AllCycleSimpleBody |
net472 | 48.2μs | 67ns | 259ns | 1.32 | 0 | 0 | 8.34 KB |
#5841 | AllCycleMoreComplexBody |
net6.0 | 78.7μs | 108ns | 417ns | 0.118 | 0 | 0 | 9.51 KB |
#5841 | AllCycleMoreComplexBody |
netcoreapp3.1 | 69.6μs | 102ns | 381ns | 0.138 | 0 | 0 | 10.37 KB |
#5841 | AllCycleMoreComplexBody |
net472 | 54.9μs | 93.1ns | 360ns | 1.86 | 0.0274 | 0 | 11.85 KB |
#5841 | ObjectExtractorSimpleBody |
net6.0 | 143ns | 0.162ns | 0.627ns | 0.00397 | 0 | 0 | 280 B |
#5841 | ObjectExtractorSimpleBody |
netcoreapp3.1 | 196ns | 0.17ns | 0.658ns | 0.00366 | 0 | 0 | 272 B |
#5841 | ObjectExtractorSimpleBody |
net472 | 167ns | 0.166ns | 0.6ns | 0.0446 | 0 | 0 | 281 B |
#5841 | ObjectExtractorMoreComplexBody |
net6.0 | 3.14μs | 2.4ns | 9.28ns | 0.0533 | 0 | 0 | 3.78 KB |
#5841 | ObjectExtractorMoreComplexBody |
netcoreapp3.1 | 4.07μs | 2.6ns | 10.1ns | 0.0513 | 0 | 0 | 3.69 KB |
#5841 | ObjectExtractorMoreComplexBody |
net472 | 3.79μs | 2.38ns | 9.23ns | 0.602 | 0.00568 | 0 | 3.8 KB |
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EncodeArgs |
net6.0 | 37.8μs | 25.2ns | 97.6ns | 0.457 | 0 | 0 | 32.4 KB |
master | EncodeArgs |
netcoreapp3.1 | 54.3μs | 28.3ns | 110ns | 0.434 | 0 | 0 | 32.4 KB |
master | EncodeArgs |
net472 | 66.4μs | 32.4ns | 117ns | 5.16 | 0.0662 | 0 | 32.5 KB |
master | EncodeLegacyArgs |
net6.0 | 78μs | 26.5ns | 103ns | 0 | 0 | 0 | 2.14 KB |
master | EncodeLegacyArgs |
netcoreapp3.1 | 105μs | 416ns | 1.61μs | 0 | 0 | 0 | 2.14 KB |
master | EncodeLegacyArgs |
net472 | 155μs | 81.5ns | 316ns | 0.311 | 0 | 0 | 2.15 KB |
#5841 | EncodeArgs |
net6.0 | 36.5μs | 14.1ns | 52.9ns | 0.456 | 0 | 0 | 32.4 KB |
#5841 | EncodeArgs |
netcoreapp3.1 | 54.5μs | 52.8ns | 205ns | 0.436 | 0 | 0 | 32.4 KB |
#5841 | EncodeArgs |
net472 | 65.7μs | 31.9ns | 124ns | 5.13 | 0.0658 | 0 | 32.5 KB |
#5841 | EncodeLegacyArgs |
net6.0 | 71.4μs | 28.2ns | 109ns | 0 | 0 | 0 | 2.14 KB |
#5841 | EncodeLegacyArgs |
netcoreapp3.1 | 107μs | 113ns | 439ns | 0 | 0 | 0 | 2.14 KB |
#5841 | EncodeLegacyArgs |
net472 | 154μs | 43.5ns | 163ns | 0.309 | 0 | 0 | 2.15 KB |
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | RunWafRealisticBenchmark |
net6.0 | 185μs | 21.2ns | 76.3ns | 0 | 0 | 0 | 2.42 KB |
master | RunWafRealisticBenchmark |
netcoreapp3.1 | 195μs | 278ns | 1.07μs | 0 | 0 | 0 | 2.37 KB |
master | RunWafRealisticBenchmark |
net472 | 211μs | 106ns | 381ns | 0.315 | 0 | 0 | 2.43 KB |
master | RunWafRealisticBenchmarkWithAttack |
net6.0 | 123μs | 29.9ns | 116ns | 0 | 0 | 0 | 1.46 KB |
master | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 129μs | 75.7ns | 283ns | 0 | 0 | 0 | 1.45 KB |
master | RunWafRealisticBenchmarkWithAttack |
net472 | 140μs | 36.8ns | 143ns | 0.21 | 0 | 0 | 1.48 KB |
#5841 | RunWafRealisticBenchmark |
net6.0 | 186μs | 74.4ns | 278ns | 0 | 0 | 0 | 2.42 KB |
#5841 | RunWafRealisticBenchmark |
netcoreapp3.1 | 198μs | 136ns | 508ns | 0 | 0 | 0 | 2.37 KB |
#5841 | RunWafRealisticBenchmark |
net472 | 209μs | 45.7ns | 177ns | 0.312 | 0 | 0 | 2.43 KB |
#5841 | RunWafRealisticBenchmarkWithAttack |
net6.0 | 123μs | 43.2ns | 156ns | 0 | 0 | 0 | 1.46 KB |
#5841 | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 130μs | 57.6ns | 216ns | 0 | 0 | 0 | 1.45 KB |
#5841 | RunWafRealisticBenchmarkWithAttack |
net472 | 140μs | 48.1ns | 186ns | 0.209 | 0 | 0 | 1.48 KB |
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations ⚠️
More allocations ⚠️ in #5841
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1
252.69 KB
262.51 KB
9.82 KB
3.89%
Fewer allocations 🎉 in #5841
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472
62.46 KB
57.9 KB
-4.56 KB
-7.30%
Benchmark | Base Allocated | Diff Allocated | Change | Change % |
---|---|---|---|---|
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 | 252.69 KB | 262.51 KB | 9.82 KB | 3.89% |
Benchmark | Base Allocated | Diff Allocated | Change | Change % |
---|---|---|---|---|
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 | 62.46 KB | 57.9 KB | -4.56 KB | -7.30% |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StringConcatBenchmark |
net6.0 | 61.2μs | 702ns | 6.95μs | 0 | 0 | 0 | 43.44 KB |
master | StringConcatBenchmark |
netcoreapp3.1 | 52.6μs | 247ns | 1.08μs | 0 | 0 | 0 | 42.64 KB |
master | StringConcatBenchmark |
net472 | 37.6μs | 80.5ns | 301ns | 0 | 0 | 0 | 62.46 KB |
master | StringConcatAspectBenchmark |
net6.0 | 275μs | 5.22μs | 51.7μs | 0 | 0 | 0 | 254.11 KB |
master | StringConcatAspectBenchmark |
netcoreapp3.1 | 337μs | 1.85μs | 14.7μs | 0 | 0 | 0 | 252.69 KB |
master | StringConcatAspectBenchmark |
net472 | 303μs | 7.47μs | 73.9μs | 0 | 0 | 0 | 278.53 KB |
#5841 | StringConcatBenchmark |
net6.0 | 61.1μs | 676ns | 6.62μs | 0 | 0 | 0 | 43.44 KB |
#5841 | StringConcatBenchmark |
netcoreapp3.1 | 53.5μs | 251ns | 1.06μs | 0 | 0 | 0 | 42.64 KB |
#5841 | StringConcatBenchmark |
net472 | 38.2μs | 176ns | 680ns | 0 | 0 | 0 | 57.9 KB |
#5841 | StringConcatAspectBenchmark |
net6.0 | 316μs | 1.76μs | 10.6μs | 0 | 0 | 0 | 255.09 KB |
#5841 | StringConcatAspectBenchmark |
netcoreapp3.1 | 345μs | 1.82μs | 9.09μs | 0 | 0 | 0 | 262.51 KB |
#5841 | StringConcatAspectBenchmark |
net472 | 287μs | 6.11μs | 59.8μs | 0 | 0 | 0 | 278.53 KB |
Throughput/Crank Report ⚡Throughput results for AspNetCoreSimpleController comparing the following branches/commits: Cases where throughput results for the PR are worse than latest master (5% drop or greater), results are shown in red. Note that these results are based on a single point-in-time result for each branch. For full results, see one of the many, many dashboards! gantt
title Throughput Linux x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (5841) (11.551M) : 0, 11551201
master (11.276M) : 0, 11275684
benchmarks/2.9.0 (11.335M) : 0, 11335046
section Automatic
This PR (5841) (7.792M) : 0, 7791629
master (7.474M) : 0, 7473550
benchmarks/2.9.0 (8.124M) : 0, 8123605
section Trace stats
master (7.762M) : 0, 7762495
section Manual
master (11.218M) : 0, 11218180
section Manual + Automatic
This PR (5841) (7.174M) : 0, 7174091
master (6.967M) : 0, 6966824
section DD_TRACE_ENABLED=0
master (10.397M) : 0, 10396799
gantt
title Throughput Linux arm64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (5841) (9.303M) : 0, 9302776
section Automatic
This PR (5841) (6.679M) : 0, 6678749
section Manual + Automatic
This PR (5841) (5.978M) : 0, 5978055
gantt
title Throughput Windows x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (5841) (10.212M) : 0, 10211794
benchmarks/2.9.0 (10.092M) : 0, 10091577
section Automatic
This PR (5841) (7.018M) : 0, 7018352
benchmarks/2.9.0 (7.470M) : 0, 7469858
section Manual + Automatic
This PR (5841) (6.539M) : 0, 6538583
|
Benchmarks Report for tracer 🐌Benchmarks for #5841 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - 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 - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️
|
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 | 1.118 | 558.76 | 499.60 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StartFinishSpan |
net6.0 | 407ns | 0.192ns | 0.742ns | 0.00818 | 0 | 0 | 576 B |
master | StartFinishSpan |
netcoreapp3.1 | 560ns | 0.375ns | 1.4ns | 0.00765 | 0 | 0 | 576 B |
master | StartFinishSpan |
net472 | 680ns | 0.568ns | 2.2ns | 0.0917 | 0 | 0 | 578 B |
master | StartFinishScope |
net6.0 | 564ns | 2.31ns | 8.94ns | 0.0098 | 0 | 0 | 696 B |
master | StartFinishScope |
netcoreapp3.1 | 682ns | 0.69ns | 2.58ns | 0.00946 | 0 | 0 | 696 B |
master | StartFinishScope |
net472 | 907ns | 4.16ns | 16.1ns | 0.104 | 0 | 0 | 658 B |
#5841 | StartFinishSpan |
net6.0 | 399ns | 0.108ns | 0.388ns | 0.00817 | 0 | 0 | 576 B |
#5841 | StartFinishSpan |
netcoreapp3.1 | 610ns | 0.272ns | 1.05ns | 0.00771 | 0 | 0 | 576 B |
#5841 | StartFinishSpan |
net472 | 622ns | 0.272ns | 1.02ns | 0.0916 | 0 | 0 | 578 B |
#5841 | StartFinishScope |
net6.0 | 499ns | 0.317ns | 1.23ns | 0.00983 | 0 | 0 | 696 B |
#5841 | StartFinishScope |
netcoreapp3.1 | 702ns | 0.276ns | 1.03ns | 0.0095 | 0 | 0 | 696 B |
#5841 | StartFinishScope |
net472 | 867ns | 0.516ns | 2ns | 0.104 | 0 | 0 | 658 B |
Benchmarks.Trace.TraceAnnotationsBenchmark - Faster 🎉 Same allocations ✔️
Faster 🎉 in #5841
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0
1.211
736.64
608.53
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 | 1.211 | 736.64 | 608.53 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | RunOnMethodBegin |
net6.0 | 736ns | 0.281ns | 1.05ns | 0.00957 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 857ns | 0.266ns | 0.958ns | 0.00923 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
net472 | 1.13μs | 0.57ns | 2.21ns | 0.104 | 0 | 0 | 658 B |
#5841 | RunOnMethodBegin |
net6.0 | 609ns | 0.379ns | 1.37ns | 0.00962 | 0 | 0 | 696 B |
#5841 | RunOnMethodBegin |
netcoreapp3.1 | 916ns | 0.47ns | 1.7ns | 0.00938 | 0 | 0 | 696 B |
#5841 | RunOnMethodBegin |
net472 | 1.13μs | 2.8ns | 10.9ns | 0.104 | 0 | 0 | 658 B |
6baff6a
to
70d74af
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I'm happy if you are!
The only ones I wonder about are where we're trying to calculate the length of the stringbuilder before we append to it, I worry that it could be a source of bugs, and wonder if it's just safer to use what we were doing before?
Other than that, I'm happy if you are, thanks!
tracer/src/Datadog.Trace.Tools.Analyzers/AspectAnalyzers/BeforeAfterAspectAnalyzer.cs
Outdated
Show resolved
Hide resolved
tracer/src/Datadog.Trace.Tools.Analyzers/AspectAnalyzers/ReplaceAspectAnalyzer.cs
Show resolved
Hide resolved
tracer/src/Datadog.Trace/Iast/Aspects/System.Net/WebUtilityAspect.cs
Outdated
Show resolved
Hide resolved
tracer/src/Datadog.Trace/Iast/Aspects/System.Text/StringBuilderAspects.cs
Show resolved
Hide resolved
tracer/src/Datadog.Trace/Iast/Aspects/System.Text/StringBuilderAspects.cs
Show resolved
Hide resolved
tracer/src/Datadog.Trace/Iast/Aspects/System.Text/StringBuilderAspects.cs
Show resolved
Hide resolved
tracer/src/Datadog.Trace/Iast/Aspects/System.Text/StringBuilderAspects.cs
Show resolved
Hide resolved
return result; | ||
} | ||
|
||
#if !NETFRAMEWORK | ||
#if NETCOREAPP2_1_OR_GREATER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we should probably stick to NETCOREAPP
#if NETCOREAPP2_1_OR_GREATER | |
#if NETCOREAPP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem here is netcoreapp includes netcoreapp2.0, and many overloads are missing there and available from 2.1 (even we don't compile for that platform). This could be netcoreapp3_1_or_greater, but I don't loose the faith in changing netstandard2 for netcoreapp2.1 someday
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
netcoreapp includes netcoreapp2.0
I see, so the concern is we'll add a .NET Core 2.0 target, then this would break. TBH. I don't think we care about that, because it's never going to happen 😄 But it's a nit anyway so all good
...grations/Samples.InstrumentedTests/Vulnerabilities/StringBuilder/StringBuilderRemoveTests.cs
Show resolved
Hide resolved
...grations/Samples.InstrumentedTests/Vulnerabilities/StringBuilder/StringBuilderRemoveTests.cs
Show resolved
Hide resolved
82d3fc0
to
9de6130
Compare
@@ -485,22 +496,22 @@ public void GivenATaintedObject_WhenCallingConcatWith4ObjectParams_ResultIsTaint | |||
AssertTaintedFormatWithOriginalCallCheck(":+-TAINTED2-+:concat:+-tainted-+:concat2", String.Concat(taintedValue2, (object)"concat", taintedValue, (object)"concat2"), () => String.Concat(taintedValue2, (object)"concat", taintedValue, (object)"concat2")); | |||
} | |||
|
|||
[Fact] | |||
[Fact(Skip = "Aspect disabled until undefined generics are supported")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the issue with the undefined generics? Until now, they were supported, right? but there must be a strong reason to stop supporting them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not supported in instrumentation. We just added heuristic code to circumvent this, causing potential crashes. As the purpose of this PR is to add security to our code, these overloads were removed until a proper support is implemented.
69a372d
to
c6b25ee
Compare
Covered all `AspectMethodReplace` aspects with try catch clauses to ensure no crash will bubble up to client, following new analyzer rules. Disabled some weird casts and processes to support some functions not present en NetCore 2.0, but present in 2.1 (netstandard2 assembly is loaded in netcore2.1 apps). Disabled some overloads receiving generic undefined arguments until proper callsite support is implemented. SSI will make the tracer enabled for a lot more of services when available. We must ensure we do not break any of them, and if so, that we provide a fast answer. Apply analyzer suggestions adding a try / catch clause in all `Methodreplace` aspects <!-- Fixes #{issue} --> <!--⚠️ Note: where possible, please obtain 2 approvals prior to merging. Unless CODEOWNERS specifies otherwise, for external teams it is typically best to have one review from a team member, and one review from apm-dotnet. Trivial changes do not require 2 reviews. -->
…5855) ## Summary of changes Covered all `AspectMethodReplace` aspects with try catch clauses to ensure no crash will bubble up to client, following new analyzer rules. Disabled some weird casts and processes to support some functions not present en NetCore 2.0, but present in 2.1 (netstandard2 assembly is loaded in netcore2.1 apps). Disabled some overloads receiving generic undefined arguments until proper callsite support is implemented. ## Reason for change SSI will make the tracer enabled for a lot more of services when available. We must ensure we do not break any of them, and if so, that we provide a fast answer. ## Implementation details Apply analyzer suggestions adding a try / catch clause in all `Methodreplace` aspects
Summary of changes
Covered all
AspectMethodReplace
aspects with try catch clauses to ensure no crash will bubble up to client, following new analyzer rules.Disabled some weird casts and processes to support some functions not present en NetCore 2.0, but present in 2.1 (netstandard2 assembly is loaded in netcore2.1 apps).
Disabled some overloads receiving generic undefined arguments until proper callsite support is implemented.
Reason for change
SSI will make the tracer enabled for a lot more of services when available. We must ensure we do not break any of them, and if so, that we provide a fast answer.
Implementation details
Apply analyzer suggestions adding a try / catch clause in all
Methodreplace
aspectsTest coverage
Other details