Skip to content

Set TokenImpersonationLevel.Anonymous in NamedPipeClient#8676

Merged
andrewlock merged 6 commits into
masterfrom
andrew/disable-named-pipe-impersonation
Jun 9, 2026
Merged

Set TokenImpersonationLevel.Anonymous in NamedPipeClient#8676
andrewlock merged 6 commits into
masterfrom
andrew/disable-named-pipe-impersonation

Conversation

@andrewlock

Copy link
Copy Markdown
Member

Summary of changes

Disable impersonation in various usages of NamedPipeClient

Reason for change

"Impersonation" allows the server-end of the named pipe to "act" as the client's user. We don't need that capabillity - the named pipe is just a dumb transport pipe to replace TCP/IP, so we can disable impersonation.

I looked into whether we could/should set PipeOptions.CurrentUserOnly as well, but we explicitly can't do that, because the agent creating the pipe is likely running as a different user.

Implementation details

Update three places we create a NamedPipeClient

  • For trace transports
  • In the dd-trace tool for testing connectivity
  • In the vendored statsd-client code
    • Updated the Vendored code too, but didn't test that this actually vendors correctly, as I don't remember whether it does 😅

Test coverage

Meh, existing named pipe tests seem sufficient, and worst case we have the AAS reliability env to test real-world

@andrewlock
andrewlock requested a review from a team as a code owner May 22, 2026 10:45
@andrewlock andrewlock added the area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) label May 22, 2026
@andrewlock
andrewlock requested a review from a team as a code owner May 22, 2026 10:45
@datadog-official

This comment has been minimized.

@pr-commenter

pr-commenter Bot commented May 22, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-06-04 09:02:43

Comparing candidate commit b43dc88 in PR branch andrew/disable-named-pipe-impersonation with baseline commit 80223a3 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 1 performance regressions! Performance is the same for 71 metrics, 0 unstable metrics, 63 known flaky benchmarks, 63 flaky benchmarks without significant changes.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:Benchmarks.Trace.HttpClientBenchmark.SendAsync net472

  • 🟥 throughput [-5391.275op/s; -5067.577op/s] or [-6.155%; -5.785%]

Known flaky benchmarks

These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1

  • 🟥 throughput [-15007.128op/s; -12594.712op/s] or [-6.401%; -5.372%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472

  • 🟥 throughput [-6786.193op/s; -6334.745op/s] or [-8.046%; -7.511%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1

  • 🟥 throughput [-7319.948op/s; -5963.385op/s] or [-7.443%; -6.063%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 execution_time [+311.017ms; +319.011ms] or [+154.338%; +158.305%]
  • 🟥 throughput [-43.491op/s; -39.773op/s] or [-7.825%; -7.156%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟥 execution_time [+378.291ms; +380.431ms] or [+298.873%; +300.564%]
  • 🟩 throughput [+93.627op/s; +97.286op/s] or [+12.344%; +12.827%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+395.663ms; +398.946ms] or [+350.146%; +353.052%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net472

  • 🟥 allocated_mem [+1.308KB; +1.308KB] or [+27.528%; +27.540%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net6.0

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+9.976%; +9.987%]
  • 🟩 execution_time [-17.548ms; -12.823ms] or [-8.195%; -5.989%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody netcoreapp3.1

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+27.500%; +27.510%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net472

  • 🟥 allocated_mem [+1.307KB; +1.307KB] or [+105.743%; +105.758%]
  • 🟥 throughput [-273722.560op/s; -268694.825op/s] or [-27.948%; -27.435%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net6.0

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+38.557%; +38.566%]
  • 🟩 execution_time [-26.378ms; -21.521ms] or [-11.763%; -9.598%]
  • 🟥 throughput [-75684.968op/s; -51181.932op/s] or [-8.086%; -5.468%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+105.288%; +105.304%]
  • 🟥 throughput [-159771.075op/s; -143675.288op/s] or [-22.956%; -20.643%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net6.0

  • 🟩 throughput [+8104.264op/s; +11183.209op/s] or [+5.157%; +7.116%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody netcoreapp3.1

  • 🟩 throughput [+10106.544op/s; +12896.618op/s] or [+8.051%; +10.274%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net6.0

  • 🟩 throughput [+473073.841op/s; +491394.118op/s] or [+15.774%; +16.385%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody netcoreapp3.1

  • 🟩 execution_time [-18.406ms; -14.051ms] or [-8.484%; -6.477%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net472

  • 🟥 execution_time [+299.670ms; +300.325ms] or [+149.735%; +150.062%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net6.0

  • 🟥 execution_time [+299.753ms; +303.384ms] or [+151.166%; +152.997%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs netcoreapp3.1

  • 🟥 execution_time [+299.945ms; +302.413ms] or [+151.089%; +152.332%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net472

  • 🟥 execution_time [+298.104ms; +299.295ms] or [+146.417%; +147.002%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net6.0

  • 🟥 execution_time [+295.528ms; +297.749ms] or [+144.473%; +145.559%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs netcoreapp3.1

  • 🟥 execution_time [+299.589ms; +301.034ms] or [+149.734%; +150.456%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net6.0

  • 🟥 execution_time [+23.134µs; +50.635µs] or [+5.306%; +11.613%]
  • 🟥 throughput [-245.668op/s; -122.293op/s] or [-10.681%; -5.317%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net6.0

  • 🟥 execution_time [+23.645µs; +47.365µs] or [+7.549%; +15.121%]
  • 🟥 throughput [-439.488op/s; -239.949op/s] or [-13.700%; -7.480%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+299.759ms; +300.639ms] or [+149.611%; +150.050%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net6.0

  • unstable execution_time [+344.973ms; +405.017ms] or [+374.827%; +440.067%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest netcoreapp3.1

  • 🟥 execution_time [+369.043ms; +373.963ms] or [+280.211%; +283.947%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [+327.822ms; +366.678ms] or [+150.729%; +168.595%]
  • 🟥 throughput [-507.905op/s; -472.889op/s] or [-46.021%; -42.848%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • unstable execution_time [+209.595ms; +342.796ms] or [+89.321%; +146.085%]
  • 🟥 throughput [-670.357op/s; -586.757op/s] or [-44.713%; -39.137%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+335.732ms; +346.282ms] or [+200.807%; +207.117%]
  • 🟥 throughput [-414.779op/s; -378.012op/s] or [-28.880%; -26.320%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1

  • unstable throughput [+18.401op/s; +58.696op/s] or [+5.289%; +16.872%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net6.0

  • 🟩 throughput [+28.590op/s; +48.454op/s] or [+5.644%; +9.565%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 execution_time [+301.662ms; +303.336ms] or [+151.911%; +152.754%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net6.0

  • 🟥 execution_time [+300.972ms; +302.448ms] or [+150.817%; +151.557%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch netcoreapp3.1

  • 🟥 execution_time [+299.724ms; +302.856ms] or [+150.569%; +152.142%]
  • 🟩 throughput [+26424.114op/s; +33555.942op/s] or [+5.566%; +7.069%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 execution_time [+302.530ms; +304.169ms] or [+151.921%; +152.744%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net6.0

  • 🟥 execution_time [+298.362ms; +301.665ms] or [+147.527%; +149.160%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync netcoreapp3.1

  • 🟥 execution_time [+302.961ms; +306.617ms] or [+153.554%; +155.407%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 execution_time [+301.085ms; +302.977ms] or [+151.118%; +152.067%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net6.0

  • 🟥 execution_time [+304.414ms; +307.608ms] or [+151.723%; +153.315%]
  • 🟩 throughput [+51264.736op/s; +59224.962op/s] or [+10.180%; +11.760%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync netcoreapp3.1

  • 🟥 execution_time [+299.469ms; +302.266ms] or [+148.983%; +150.375%]

scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net6.0

  • 🟩 execution_time [-15.496ms; -11.824ms] or [-7.206%; -5.498%]
  • 🟩 throughput [+22603.319op/s; +29610.479op/s] or [+6.201%; +8.123%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net472

  • unstable execution_time [+15.724µs; +60.919µs] or [+3.884%; +15.047%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net6.0

  • 🟩 allocated_mem [-18.606KB; -18.584KB] or [-6.787%; -6.779%]
  • unstable execution_time [-33.441µs; +22.048µs] or [-6.609%; +4.358%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1

  • 🟩 allocated_mem [-17.022KB; -17.004KB] or [-6.205%; -6.199%]
  • unstable execution_time [-29789.387ns; +31608.344ns] or [-5.162%; +5.478%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net6.0

  • 🟥 execution_time [+6.297µs; +10.486µs] or [+14.884%; +24.785%]
  • 🟥 throughput [-4821.254op/s; -2952.351op/s] or [-20.296%; -12.428%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark netcoreapp3.1

  • unstable execution_time [-13.048µs; -4.558µs] or [-20.244%; -7.071%]
  • unstable throughput [+1161.942op/s; +3040.363op/s] or [+7.129%; +18.654%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+301.608ms; +302.847ms] or [+152.450%; +153.076%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+303.166ms; +305.476ms] or [+154.311%; +155.486%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+299.437ms; +302.026ms] or [+149.905%; +151.201%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+300.053ms; +302.712ms] or [+149.549%; +150.875%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+302.024ms; +303.308ms] or [+151.662%; +152.307%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+303.416ms; +305.794ms] or [+153.873%; +155.079%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+299.962ms; +300.929ms] or [+149.623%; +150.105%]
  • 🟩 throughput [+61061017.806op/s; +61423094.001op/s] or [+44.468%; +44.732%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net6.0

  • 🟥 execution_time [+421.781ms; +426.567ms] or [+524.560%; +530.512%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore netcoreapp3.1

  • 🟥 execution_time [+299.575ms; +300.634ms] or [+149.421%; +149.949%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net6.0

  • 🟩 throughput [+63358.157op/s; +82645.733op/s] or [+5.916%; +7.716%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope netcoreapp3.1

  • 🟩 throughput [+49014.089op/s; +69356.883op/s] or [+5.673%; +8.028%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0

  • 🟩 throughput [+76221.316op/s; +108928.903op/s] or [+5.900%; +8.431%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan netcoreapp3.1

  • 🟩 throughput [+92427.773op/s; +99782.338op/s] or [+9.180%; +9.910%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net6.0

  • 🟩 throughput [+46705.607op/s; +51243.726op/s] or [+8.481%; +9.305%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1

  • 🟩 throughput [+24488.659op/s; +34373.696op/s] or [+5.481%; +7.694%]

scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net6.0

  • 🟩 throughput [+66617.131op/s; +108657.780op/s] or [+7.443%; +12.140%]

Known flaky benchmarks without significant changes:

  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net472
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net6.0
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

@dd-trace-dotnet-ci-bot

dd-trace-dotnet-ci-bot Bot commented May 26, 2026

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (8676) and master.

✅ No regressions detected - check the details below

Full Metrics Comparison

FakeDbCommand

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration75.12 ± (75.00 - 75.50) ms74.09 ± (74.04 - 74.59) ms-1.4%
.NET Framework 4.8 - Bailout
duration78.26 ± (78.19 - 78.55) ms76.73 ± (76.74 - 77.10) ms-1.9%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1085.90 ± (1087.15 - 1092.70) ms1103.77 ± (1102.56 - 1110.72) ms+1.6%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms22.55 ± (22.49 - 22.60) ms22.42 ± (22.37 - 22.48) ms-0.5%
process.time_to_main_ms85.57 ± (85.29 - 85.85) ms84.84 ± (84.58 - 85.09) ms-0.9%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.94 ± (10.93 - 10.94) MB10.92 ± (10.92 - 10.93) MB-0.1%
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.32 ± (22.28 - 22.36) ms22.24 ± (22.20 - 22.28) ms-0.4%
process.time_to_main_ms84.88 ± (84.66 - 85.10) ms85.63 ± (85.40 - 85.86) ms+0.9%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.97 ± (10.97 - 10.97) MB10.95 ± (10.95 - 10.96) MB-0.2%
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms212.32 ± (211.21 - 213.43) ms214.90 ± (213.95 - 215.85) ms+1.2%✅⬆️
process.time_to_main_ms535.07 ± (533.82 - 536.32) ms541.05 ± (539.58 - 542.52) ms+1.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.39 ± (48.36 - 48.43) MB48.35 ± (48.31 - 48.38) MB-0.1%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.3%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms21.68 ± (21.63 - 21.73) ms21.25 ± (21.21 - 21.29) ms-2.0%
process.time_to_main_ms75.95 ± (75.71 - 76.20) ms73.63 ± (73.46 - 73.81) ms-3.1%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.63 ± (10.63 - 10.63) MB10.63 ± (10.62 - 10.63) MB-0.0%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.32 ± (21.28 - 21.36) ms21.62 ± (21.56 - 21.67) ms+1.4%✅⬆️
process.time_to_main_ms74.67 ± (74.49 - 74.84) ms77.47 ± (77.19 - 77.76) ms+3.8%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.75 ± (10.74 - 10.75) MB10.75 ± (10.74 - 10.75) MB+0.0%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms368.02 ± (366.09 - 369.95) ms371.10 ± (369.06 - 373.15) ms+0.8%✅⬆️
process.time_to_main_ms543.63 ± (542.41 - 544.84) ms548.61 ± (547.20 - 550.03) ms+0.9%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed49.83 ± (49.81 - 49.85) MB49.69 ± (49.67 - 49.71) MB-0.3%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.1%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms19.29 ± (19.25 - 19.32) ms19.17 ± (19.14 - 19.21) ms-0.6%
process.time_to_main_ms71.61 ± (71.45 - 71.76) ms71.87 ± (71.73 - 72.02) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.69 ± (7.68 - 7.70) MB7.66 ± (7.66 - 7.67) MB-0.4%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.54 ± (19.50 - 19.59) ms19.24 ± (19.20 - 19.27) ms-1.6%
process.time_to_main_ms75.60 ± (75.34 - 75.86) ms72.71 ± (72.57 - 72.84) ms-3.8%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.73 ± (7.73 - 7.74) MB7.72 ± (7.71 - 7.72) MB-0.2%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms296.70 ± (294.70 - 298.70) ms294.27 ± (292.22 - 296.33) ms-0.8%
process.time_to_main_ms495.14 ± (493.96 - 496.31) ms499.02 ± (497.68 - 500.35) ms+0.8%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.84 ± (36.81 - 36.88) MB36.82 ± (36.79 - 36.85) MB-0.1%
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)+0.3%✅⬆️

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration199.50 ± (198.85 - 199.80) ms200.05 ± (199.39 - 200.38) ms+0.3%✅⬆️
.NET Framework 4.8 - Bailout
duration201.94 ± (201.57 - 202.37) ms203.42 ± (203.04 - 203.82) ms+0.7%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1195.52 ± (1194.15 - 1200.11) ms1194.69 ± (1193.51 - 1199.24) ms-0.1%
.NET Core 3.1 - Baseline
process.internal_duration_ms194.89 ± (194.39 - 195.39) ms192.90 ± (192.54 - 193.25) ms-1.0%
process.time_to_main_ms85.24 ± (84.97 - 85.51) ms84.11 ± (83.76 - 84.46) ms-1.3%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.02 ± (16.00 - 16.05) MB16.07 ± (16.04 - 16.09) MB+0.3%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (19 - 20)-0.3%
.NET Core 3.1 - Bailout
process.internal_duration_ms194.24 ± (193.74 - 194.74) ms192.48 ± (192.06 - 192.90) ms-0.9%
process.time_to_main_ms86.05 ± (85.80 - 86.31) ms85.22 ± (84.97 - 85.48) ms-1.0%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.08 ± (16.06 - 16.10) MB16.19 ± (16.16 - 16.22) MB+0.7%✅⬆️
runtime.dotnet.threads.count21 ± (20 - 21)21 ± (21 - 21)+0.3%✅⬆️
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms387.79 ± (386.62 - 388.96) ms385.51 ± (384.14 - 386.87) ms-0.6%
process.time_to_main_ms540.61 ± (539.16 - 542.06) ms536.22 ± (535.07 - 537.36) ms-0.8%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed57.33 ± (57.16 - 57.50) MB57.47 ± (57.26 - 57.68) MB+0.2%✅⬆️
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)-0.3%
.NET 6 - Baseline
process.internal_duration_ms198.94 ± (198.47 - 199.42) ms197.96 ± (197.50 - 198.41) ms-0.5%
process.time_to_main_ms73.36 ± (73.09 - 73.64) ms72.90 ± (72.68 - 73.13) ms-0.6%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.33 ± (16.31 - 16.35) MB16.40 ± (16.37 - 16.43) MB+0.4%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)-0.1%
.NET 6 - Bailout
process.internal_duration_ms196.33 ± (195.84 - 196.82) ms196.77 ± (196.50 - 197.04) ms+0.2%✅⬆️
process.time_to_main_ms73.64 ± (73.39 - 73.89) ms73.68 ± (73.53 - 73.84) ms+0.1%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.37 ± (16.35 - 16.39) MB16.44 ± (16.41 - 16.47) MB+0.4%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)-0.2%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms585.73 ± (583.52 - 587.94) ms585.47 ± (582.92 - 588.02) ms-0.0%
process.time_to_main_ms545.54 ± (544.43 - 546.66) ms543.47 ± (542.44 - 544.50) ms-0.4%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed61.00 ± (60.92 - 61.08) MB61.13 ± (61.04 - 61.21) MB+0.2%✅⬆️
runtime.dotnet.threads.count31 ± (31 - 31)31 ± (31 - 31)+0.3%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms195.19 ± (194.74 - 195.64) ms195.24 ± (194.83 - 195.65) ms+0.0%✅⬆️
process.time_to_main_ms71.64 ± (71.38 - 71.89) ms72.55 ± (72.31 - 72.80) ms+1.3%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.68 ± (11.66 - 11.71) MB11.71 ± (11.68 - 11.73) MB+0.2%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)-0.0%
.NET 8 - Bailout
process.internal_duration_ms194.92 ± (194.46 - 195.39) ms194.22 ± (193.80 - 194.64) ms-0.4%
process.time_to_main_ms72.82 ± (72.62 - 73.02) ms73.42 ± (73.16 - 73.68) ms+0.8%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.72 ± (11.69 - 11.74) MB11.79 ± (11.77 - 11.81) MB+0.6%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.6%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms515.43 ± (512.87 - 517.99) ms518.26 ± (515.51 - 521.02) ms+0.5%✅⬆️
process.time_to_main_ms493.29 ± (492.51 - 494.06) ms491.56 ± (490.74 - 492.39) ms-0.3%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed50.63 ± (50.60 - 50.66) MB50.70 ± (50.66 - 50.74) MB+0.1%✅⬆️
runtime.dotnet.threads.count30 ± (29 - 30)29 ± (29 - 30)-0.0%
Comparison explanation

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 highlighted in **red**. The following thresholds were used for comparing the execution times:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

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).

Duration charts
FakeDbCommand (.NET Framework 4.8)
gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8676) - mean (74ms)  : 70, 78
    master - mean (75ms)  : 72, 79

    section Bailout
    This PR (8676) - mean (77ms)  : 75, 79
    master - mean (78ms)  : 76, 81

    section CallTarget+Inlining+NGEN
    This PR (8676) - mean (1,107ms)  : 1044, 1169
    master - mean (1,090ms)  : 1049, 1131

Loading
FakeDbCommand (.NET Core 3.1)
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8676) - mean (114ms)  : 108, 120
    master - mean (115ms)  : 110, 121

    section Bailout
    This PR (8676) - mean (115ms)  : 112, 118
    master - mean (114ms)  : 111, 117

    section CallTarget+Inlining+NGEN
    This PR (8676) - mean (790ms)  : 768, 813
    master - mean (786ms)  : 767, 806

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8676) - mean (101ms)  : 98, 104
    master - mean (104ms)  : 99, 109

    section Bailout
    This PR (8676) - mean (106ms)  : 100, 112
    master - mean (102ms)  : 100, 104

    section CallTarget+Inlining+NGEN
    This PR (8676) - mean (950ms)  : 909, 990
    master - mean (938ms)  : 902, 975

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8676) - mean (99ms)  : 95, 102
    master - mean (99ms)  : 96, 101

    section Bailout
    This PR (8676) - mean (100ms)  : 97, 102
    master - mean (103ms)  : 99, 108

    section CallTarget+Inlining+NGEN
    This PR (8676) - mean (825ms)  : 786, 865
    master - mean (821ms)  : 779, 862

Loading
HttpMessageHandler (.NET Framework 4.8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8676) - mean (200ms)  : 194, 205
    master - mean (199ms)  : 193, 205

    section Bailout
    This PR (8676) - mean (203ms)  : 200, 207
    master - mean (202ms)  : 198, 206

    section CallTarget+Inlining+NGEN
    This PR (8676) - mean (1,196ms)  : 1155, 1238
    master - mean (1,197ms)  : 1154, 1240

Loading
HttpMessageHandler (.NET Core 3.1)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8676) - mean (286ms)  : 281, 291
    master - mean (289ms)  : 281, 297

    section Bailout
    This PR (8676) - mean (286ms)  : 282, 291
    master - mean (289ms)  : 282, 297

    section CallTarget+Inlining+NGEN
    This PR (8676) - mean (963ms)  : 943, 982
    master - mean (968ms)  : 946, 989

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8676) - mean (280ms)  : 274, 286
    master - mean (281ms)  : 273, 289

    section Bailout
    This PR (8676) - mean (279ms)  : 276, 282
    master - mean (279ms)  : 271, 286

    section CallTarget+Inlining+NGEN
    This PR (8676) - mean (1,166ms)  : 1129, 1203
    master - mean (1,159ms)  : 1126, 1193

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8676) - mean (278ms)  : 271, 285
    master - mean (277ms)  : 272, 282

    section Bailout
    This PR (8676) - mean (278ms)  : 271, 285
    master - mean (278ms)  : 272, 283

    section CallTarget+Inlining+NGEN
    This PR (8676) - mean (1,044ms)  : 1002, 1086
    master - mean (1,042ms)  : 997, 1087

Loading

@zacharycmontoya zacharycmontoya left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@andrewlock
andrewlock merged commit 7e31e25 into master Jun 9, 2026
138 checks passed
@andrewlock
andrewlock deleted the andrew/disable-named-pipe-impersonation branch June 9, 2026 08:22
@github-actions github-actions Bot added this to the vNext-v3 milestone Jun 9, 2026
zacharycmontoya pushed a commit that referenced this pull request Jun 16, 2026
## Summary of changes

Disable impersonation in various usages of `NamedPipeClient`

## Reason for change

"Impersonation" allows the server-end of the named pipe to "act" as the
client's user. We don't need that capabillity - the named pipe is just a
dumb transport pipe to replace TCP/IP, so we can disable impersonation.

I looked into whether we could/should set `PipeOptions.CurrentUserOnly`
as well, but we explicitly _can't_ do that, because the agent creating
the pipe is likely running as a different user.

## Implementation details

Update three places we create a `NamedPipeClient`
- For trace transports
- In the `dd-trace` tool for testing connectivity
- In the vendored statsd-client code
- Updated the Vendored code too, but didn't test that this _actually_
vendors correctly, as I don't remember whether it does 😅

## Test coverage

Meh, existing named pipe tests seem sufficient, and worst case we have
the AAS reliability env to test real-world
gh-worker-dd-mergequeue-cf854d Bot pushed a commit to DataDog/libdatadog that referenced this pull request Jun 18, 2026
…e server (#2134)

# What does this PR do?

Disables named-pipe client impersonation in libdatadog's Windows named-pipe transport by opening the pipe with `SECURITY_ANONYMOUS` (the Rust/tokio equivalent of .NET's `TokenImpersonationLevel.Anonymous`).

Concretely, `libdd-common`'s hyper-based connector now sets `ClientOptions::security_qos_flags(SECURITY_ANONYMOUS)` when opening a named pipe in `ConnStream::from_named_pipe_uri`, instead of relying on tokio's default of `SECURITY_IDENTIFICATION`.

# Motivation

This mirrors the dd-trace-dotnet change [Set `TokenImpersonationLevel.Anonymous` in `NamedPipeClient` (#8676)] DataDog/dd-trace-dotnet#8676).

A Windows named pipe exposes the connecting client's security token to the server end, which can use it to identify or even impersonate the client. In our usage the pipe is just a dumb byte transport to the Datadog Agent, so the server end never needs any information about, or the ability to act as, the connecting (potentially privileged) process. Opening with `Anonymous` enforces least privilege and removes that capability, hardening against a malicious or pipe-squatting server reading the client's identity/privileges.

# Additional Notes

- libdatadog opens named-pipe clients through two transport stacks:
  - **hyper connector** (`libdd-common`) — fixed in this PR. Used by the     `libdd-http-client` hyper backend.
  - **reqwest** — the path used by the profiling exporter, `libdd-agent-client`,     and the default `libdd-http-client` backend. reqwest currently hardcodes     `ClientOptions::new().open(pipe)` and exposes no API to set the QoS flags, so     that path is **not** addressed here. A follow-up will upstream a     security-flags option to reqwest and then consume it at those call sites.
- Severity note: tokio's default is already `Identification` (not `Impersonation`),   so the server cannot *act* as the client today; it can only read the client's  identity/privileges. This change is therefore a defense-in-depth / least-privilege  hardening that aligns the Rust posture with the .NET fix, not a fix for an  exploitable privilege escalation on the Rust side.
- A shared `ANONYMOUS_IMPERSONATION_QOS` constant was added in  `libdd-common/src/connector/named_pipe.rs` so the same value can be reused by  the future reqwest call sites.

# How to test the change?

The change is Windows-only (`#[cfg(windows)]`).

- Automated: a round-trip test `from_named_pipe_uri_connects_with_anonymous_qos` was added in `libdd-common/src/connector/conn_stream.rs`. It stands up a tokio `ServerOptions` named-pipe server and asserts the client connects successfully with the Anonymous QoS flags. On a Windows host:

Co-authored-by: gregory.leocadie <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) identified-by:ai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants