-
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
[ASM] iast: Fix Microsoft.Data.Sqlite
database tainting
#6295
base: master
Are you sure you want to change the base?
Conversation
Snapshots difference summaryThe following differences have been observed in committed snapshots. It is meant to help the reviewer. 1 occurrences of : - http.url: http://localhost:00000/Iast/StoredSqli,
+ http.url: http://localhost:00000/Iast/StoredSqli?useMicrosoftDataDb=...,
1 occurrences of : - http.url: http://localhost:00000/Iast/StoredXss?param=%3Cb%3ERawValue%3C/b%3E,
+ http.url: http://localhost:00000/Iast/StoredXss?param=%3Cb%3ERawValue%3C/b%3E&useMicrosoftDataDb=...,
1 occurrences of : - http.url: http://localhost:00000/Iast/StoredXssEscaped,
+ http.url: http://localhost:00000/Iast/StoredXssEscaped?useMicrosoftDataDb=...,
|
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 (6295) - mean (73ms) : 64, 81
. : milestone, 73,
master - mean (72ms) : 63, 81
. : milestone, 72,
section CallTarget+Inlining+NGEN
This PR (6295) - mean (1,110ms) : 1086, 1134
. : milestone, 1110,
master - mean (1,107ms) : 1082, 1132
. : milestone, 1107,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6295) - mean (110ms) : 106, 113
. : milestone, 110,
master - mean (108ms) : 105, 111
. : milestone, 108,
section CallTarget+Inlining+NGEN
This PR (6295) - mean (769ms) : 753, 785
. : milestone, 769,
master - mean (770ms) : 753, 786
. : milestone, 770,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6295) - mean (93ms) : 90, 95
. : milestone, 93,
master - mean (92ms) : 90, 94
. : milestone, 92,
section CallTarget+Inlining+NGEN
This PR (6295) - mean (723ms) : 708, 738
. : milestone, 723,
master - mean (725ms) : 709, 741
. : milestone, 725,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6295) - mean (191ms) : 186, 195
. : milestone, 191,
master - mean (191ms) : 185, 196
. : milestone, 191,
section CallTarget+Inlining+NGEN
This PR (6295) - mean (1,210ms) : 1181, 1240
. : milestone, 1210,
master - mean (1,213ms) : 1190, 1237
. : milestone, 1213,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6295) - mean (277ms) : 273, 281
. : milestone, 277,
master - mean (276ms) : 271, 280
. : milestone, 276,
section CallTarget+Inlining+NGEN
This PR (6295) - mean (942ms) : 925, 959
. : milestone, 942,
master - mean (945ms) : 929, 960
. : milestone, 945,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6295) - mean (265ms) : 262, 268
. : milestone, 265,
master - mean (265ms) : 260, 270
. : milestone, 265,
section CallTarget+Inlining+NGEN
This PR (6295) - mean (925ms) : 906, 943
. : milestone, 925,
master - mean (930ms) : 907, 952
. : milestone, 930,
|
Datadog ReportBranch report: ❌ 15 Failed (0 Known Flaky), 453631 Passed, 2732 Skipped, 18h 41m 22.08s Total Time ❌ Failed Tests (15)
|
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 (6295) (11.032M) : 0, 11032468
master (11.197M) : 0, 11197381
benchmarks/2.9.0 (11.033M) : 0, 11032866
section Automatic
This PR (6295) (7.074M) : 0, 7074491
master (7.192M) : 0, 7192384
benchmarks/2.9.0 (7.786M) : 0, 7785853
section Trace stats
master (7.476M) : 0, 7475872
section Manual
master (11.271M) : 0, 11270878
section Manual + Automatic
This PR (6295) (6.524M) : 0, 6524324
master (6.621M) : 0, 6620931
section DD_TRACE_ENABLED=0
master (10.177M) : 0, 10176556
gantt
title Throughput Linux arm64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6295) (9.599M) : 0, 9599024
master (9.640M) : 0, 9639769
benchmarks/2.9.0 (9.495M) : 0, 9494821
section Automatic
This PR (6295) (6.469M) : 0, 6469496
master (6.385M) : 0, 6384570
section Trace stats
master (6.740M) : 0, 6739552
section Manual
master (9.612M) : 0, 9611974
section Manual + Automatic
This PR (6295) (6.004M) : 0, 6004356
master (5.891M) : 0, 5890550
section DD_TRACE_ENABLED=0
master (8.839M) : 0, 8838985
gantt
title Throughput Windows x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6295) (9.823M) : 0, 9823139
master (10.121M) : 0, 10120763
benchmarks/2.9.0 (10.020M) : 0, 10019592
section Automatic
This PR (6295) (6.370M) : 0, 6370164
master (6.469M) : 0, 6469072
benchmarks/2.9.0 (7.255M) : 0, 7255257
section Trace stats
master (6.864M) : 0, 6863851
section Manual
master (9.854M) : 0, 9854162
section Manual + Automatic
This PR (6295) (5.949M) : 0, 5949205
master (5.906M) : 0, 5906154
section DD_TRACE_ENABLED=0
master (9.224M) : 0, 9224050
|
86e5c95
to
9411f11
Compare
Microsoft.Data.Sqlite
database taintingMicrosoft.Data.Sqlite
database tainting
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.
Good catch. Thanks a lot
Benchmarks Report for tracer 🐌Benchmarks for #6295 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 - Faster 🎉 Same allocations ✔️
|
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net6.0 | 1.115 | 1,302.84 | 1,168.50 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | CallElasticsearch |
net6.0 | 1.3μs | 0.582ns | 2.18ns | 0.0137 | 0 | 0 | 976 B |
master | CallElasticsearch |
netcoreapp3.1 | 1.58μs | 2.2ns | 7.94ns | 0.0132 | 0 | 0 | 976 B |
master | CallElasticsearch |
net472 | 2.61μs | 1.12ns | 4.19ns | 0.157 | 0 | 0 | 995 B |
master | CallElasticsearchAsync |
net6.0 | 1.21μs | 0.535ns | 1.93ns | 0.0133 | 0 | 0 | 952 B |
master | CallElasticsearchAsync |
netcoreapp3.1 | 1.64μs | 0.892ns | 3.34ns | 0.014 | 0 | 0 | 1.02 KB |
master | CallElasticsearchAsync |
net472 | 2.59μs | 1.59ns | 6.16ns | 0.167 | 0 | 0 | 1.05 KB |
#6295 | CallElasticsearch |
net6.0 | 1.17μs | 0.411ns | 1.54ns | 0.0135 | 0 | 0 | 976 B |
#6295 | CallElasticsearch |
netcoreapp3.1 | 1.53μs | 0.783ns | 2.93ns | 0.0128 | 0 | 0 | 976 B |
#6295 | CallElasticsearch |
net472 | 2.58μs | 1.33ns | 5.13ns | 0.158 | 0 | 0 | 995 B |
#6295 | CallElasticsearchAsync |
net6.0 | 1.28μs | 0.501ns | 1.88ns | 0.0136 | 0 | 0 | 952 B |
#6295 | CallElasticsearchAsync |
netcoreapp3.1 | 1.63μs | 0.476ns | 1.72ns | 0.0139 | 0 | 0 | 1.02 KB |
#6295 | CallElasticsearchAsync |
net472 | 2.67μs | 1.33ns | 4.99ns | 0.166 | 0 | 0 | 1.05 KB |
Benchmarks.Trace.GraphQLBenchmark - Slower ⚠️ Same allocations ✔️
Slower ⚠️ in #6295
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net6.0
1.130
1,218.44
1,376.52
Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net6.0 | 1.130 | 1,218.44 | 1,376.52 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | ExecuteAsync |
net6.0 | 1.22μs | 0.382ns | 1.43ns | 0.0136 | 0 | 0 | 952 B |
master | ExecuteAsync |
netcoreapp3.1 | 1.57μs | 1.31ns | 5.08ns | 0.0134 | 0 | 0 | 952 B |
master | ExecuteAsync |
net472 | 1.85μs | 2.49ns | 9.66ns | 0.145 | 0 | 0 | 915 B |
#6295 | ExecuteAsync |
net6.0 | 1.38μs | 0.724ns | 2.71ns | 0.013 | 0 | 0 | 952 B |
#6295 | ExecuteAsync |
netcoreapp3.1 | 1.71μs | 1.5ns | 5.41ns | 0.0127 | 0 | 0 | 952 B |
#6295 | ExecuteAsync |
net472 | 1.89μs | 0.982ns | 3.8ns | 0.145 | 0 | 0 | 915 B |
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | SendAsync |
net6.0 | 4.31μs | 1.01ns | 3.63ns | 0.0316 | 0 | 0 | 2.31 KB |
master | SendAsync |
netcoreapp3.1 | 5.4μs | 4.82ns | 18.7ns | 0.0377 | 0 | 0 | 2.85 KB |
master | SendAsync |
net472 | 7.4μs | 2.02ns | 7.83ns | 0.496 | 0 | 0 | 3.12 KB |
#6295 | SendAsync |
net6.0 | 4.31μs | 1.4ns | 5.23ns | 0.0324 | 0 | 0 | 2.31 KB |
#6295 | SendAsync |
netcoreapp3.1 | 5.33μs | 4.03ns | 15.6ns | 0.0374 | 0 | 0 | 2.85 KB |
#6295 | SendAsync |
net472 | 7.36μs | 1.71ns | 6.39ns | 0.494 | 0 | 0 | 3.12 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 |
net6.0 | 1.56μs | 0.656ns | 2.54ns | 0.0233 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
netcoreapp3.1 | 2.23μs | 0.808ns | 3.13ns | 0.0221 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
net472 | 2.67μs | 1.88ns | 7.28ns | 0.249 | 0 | 0 | 1.57 KB |
#6295 | EnrichedLog |
net6.0 | 1.48μs | 1.17ns | 4.53ns | 0.023 | 0 | 0 | 1.64 KB |
#6295 | EnrichedLog |
netcoreapp3.1 | 2.22μs | 0.633ns | 2.28ns | 0.0221 | 0 | 0 | 1.64 KB |
#6295 | EnrichedLog |
net472 | 2.51μs | 1.36ns | 5.26ns | 0.249 | 0 | 0 | 1.57 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 |
net6.0 | 119μs | 144ns | 556ns | 0.0587 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
netcoreapp3.1 | 124μs | 151ns | 585ns | 0 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
net472 | 152μs | 95.8ns | 371ns | 0.683 | 0.228 | 0 | 4.46 KB |
#6295 | EnrichedLog |
net6.0 | 119μs | 361ns | 1.4μs | 0.0612 | 0 | 0 | 4.28 KB |
#6295 | EnrichedLog |
netcoreapp3.1 | 123μs | 153ns | 591ns | 0 | 0 | 0 | 4.28 KB |
#6295 | EnrichedLog |
net472 | 150μs | 202ns | 782ns | 0.683 | 0.228 | 0 | 4.46 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 |
net6.0 | 3.1μs | 0.94ns | 3.64ns | 0.0311 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
netcoreapp3.1 | 4.12μs | 3ns | 11.6ns | 0.0286 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
net472 | 4.82μs | 1.33ns | 4.98ns | 0.319 | 0 | 0 | 2.02 KB |
#6295 | EnrichedLog |
net6.0 | 3.02μs | 1.08ns | 4.17ns | 0.0302 | 0 | 0 | 2.2 KB |
#6295 | EnrichedLog |
netcoreapp3.1 | 4.28μs | 1.52ns | 5.69ns | 0.0283 | 0 | 0 | 2.2 KB |
#6295 | EnrichedLog |
net472 | 4.82μs | 1.47ns | 5.49ns | 0.319 | 0 | 0 | 2.02 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 |
net6.0 | 1.35μs | 0.681ns | 2.64ns | 0.0162 | 0 | 0 | 1.14 KB |
master | SendReceive |
netcoreapp3.1 | 1.77μs | 2.44ns | 9.46ns | 0.0153 | 0 | 0 | 1.14 KB |
master | SendReceive |
net472 | 2.03μs | 1.47ns | 5.7ns | 0.183 | 0 | 0 | 1.16 KB |
#6295 | SendReceive |
net6.0 | 1.35μs | 0.564ns | 2.03ns | 0.0162 | 0 | 0 | 1.14 KB |
#6295 | SendReceive |
netcoreapp3.1 | 1.75μs | 1.29ns | 4.99ns | 0.0158 | 0 | 0 | 1.14 KB |
#6295 | SendReceive |
net472 | 2.11μs | 2.81ns | 10.9ns | 0.183 | 0 | 0 | 1.16 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 |
net6.0 | 2.73μs | 0.684ns | 2.65ns | 0.0219 | 0 | 0 | 1.6 KB |
master | EnrichedLog |
netcoreapp3.1 | 3.95μs | 2.19ns | 8.49ns | 0.0218 | 0 | 0 | 1.65 KB |
master | EnrichedLog |
net472 | 4.47μs | 2.07ns | 7.76ns | 0.322 | 0 | 0 | 2.04 KB |
#6295 | EnrichedLog |
net6.0 | 2.9μs | 1.03ns | 3.86ns | 0.0217 | 0 | 0 | 1.6 KB |
#6295 | EnrichedLog |
netcoreapp3.1 | 3.88μs | 1.94ns | 7.26ns | 0.0215 | 0 | 0 | 1.65 KB |
#6295 | EnrichedLog |
net472 | 4.37μs | 2.46ns | 9.52ns | 0.322 | 0 | 0 | 2.04 KB |
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️
Faster 🎉 in #6295
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0
1.196
576.22
481.85
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0
1.180
465.83
394.86
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 | 1.196 | 576.22 | 481.85 | |
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 | 1.180 | 465.83 | 394.86 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StartFinishSpan |
net6.0 | 466ns | 0.378ns | 1.46ns | 0.00815 | 0 | 0 | 576 B |
master | StartFinishSpan |
netcoreapp3.1 | 557ns | 0.32ns | 1.15ns | 0.00781 | 0 | 0 | 576 B |
master | StartFinishSpan |
net472 | 605ns | 0.514ns | 1.99ns | 0.0917 | 0 | 0 | 578 B |
master | StartFinishScope |
net6.0 | 576ns | 0.471ns | 1.82ns | 0.00984 | 0 | 0 | 696 B |
master | StartFinishScope |
netcoreapp3.1 | 708ns | 0.97ns | 3.76ns | 0.00927 | 0 | 0 | 696 B |
master | StartFinishScope |
net472 | 920ns | 0.712ns | 2.76ns | 0.104 | 0 | 0 | 658 B |
#6295 | StartFinishSpan |
net6.0 | 394ns | 0.354ns | 1.37ns | 0.00816 | 0 | 0 | 576 B |
#6295 | StartFinishSpan |
netcoreapp3.1 | 546ns | 0.74ns | 2.87ns | 0.00768 | 0 | 0 | 576 B |
#6295 | StartFinishSpan |
net472 | 628ns | 1.19ns | 4.61ns | 0.0917 | 0 | 0 | 578 B |
#6295 | StartFinishScope |
net6.0 | 482ns | 0.403ns | 1.56ns | 0.00965 | 0 | 0 | 696 B |
#6295 | StartFinishScope |
netcoreapp3.1 | 722ns | 1.39ns | 5.38ns | 0.00937 | 0 | 0 | 696 B |
#6295 | StartFinishScope |
net472 | 880ns | 1.01ns | 3.64ns | 0.104 | 0 | 0 | 658 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 |
net6.0 | 645ns | 0.482ns | 1.87ns | 0.00977 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 880ns | 0.617ns | 2.23ns | 0.00929 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
net472 | 1.21μs | 1.17ns | 4.52ns | 0.105 | 0 | 0 | 658 B |
#6295 | RunOnMethodBegin |
net6.0 | 612ns | 0.632ns | 2.28ns | 0.00975 | 0 | 0 | 696 B |
#6295 | RunOnMethodBegin |
netcoreapp3.1 | 953ns | 0.694ns | 2.69ns | 0.00912 | 0 | 0 | 696 B |
#6295 | RunOnMethodBegin |
net472 | 1.15μs | 0.859ns | 3.33ns | 0.104 | 0 | 0 | 658 B |
Summary of changes
The instrumentation introduced for tainting values coming from database was incorrect for
Microsoft.Data.Sqlite
.A typo was introduced in the name
Microsoft.Data.Sqlite.SqliteDataReader
, thus making the instrumentation fail.Test coverage
Tests on database tainting such as Stored XSS or Stored SQLI has been updated to also create an SQLite connection using
Microsoft.Data.Sqlite
while also keeping theSystem.Data.SQLite
connection.Other details
Original implementation PR: #5804