Skip to content

[AppSec] APPSEC-65483 Collect Datadog security-testing headers on entry spans#8682

Draft
christophe-papazian wants to merge 2 commits into
masterfrom
christophe.papazian/appsec-65483-security-testing-headers
Draft

[AppSec] APPSEC-65483 Collect Datadog security-testing headers on entry spans#8682
christophe-papazian wants to merge 2 commits into
masterfrom
christophe.papazian/appsec-65483-security-testing-headers

Conversation

@christophe-papazian
Copy link
Copy Markdown
Collaborator

Summary of changes

Tag x-datadog-endpoint-scan and x-datadog-security-test HTTP request headers as http.request.headers.<name> on every HTTP server entry span (and the inferred-proxy span when one is created), unconditionally — independent of DD_TRACE_HEADER_TAGS and AppSec enablement. Markers are not propagated downstream.

Reason for change

APPSEC-65483 — RFC "Security Testing: Trace Attribution for Inventory Enrichment and Pollution Prevention". These two markers let the API endpoint reducer distinguish Datadog scan/test traffic from real user traffic and keep it out of the API inventory.

Sibling-tracer implementations already merged: dd-trace-py#18049, dd-trace-js#8463, dd-trace-java#11418.

Implementation details

  • New SpanContextPropagator.AddSecurityTestingHeadersAsTags<THeaders> reads both markers from any IHeadersCollection and tags them on the supplied span. Tag names are precomputed; string[] fast-path avoids enumerator allocation on the legacy NameValueCollection / WebHeaderCollection carriers; presence-based (empty values still tagged).
  • Wired into every HTTP server entry path:
    • AspNetMvcIntegration (System.Web MVC) — entry span + inferred-proxy span (proxy tagged at creation site)
    • AspNetWebApi2Integration (System.Web Web API 2) — entry span (no proxy support on this path)
    • TracingHttpModule (OWIN/IIS classic) — entry span + inferred-proxy span
    • AspNetCoreHttpRequestHandler (ASP.NET Core, including Azure Functions isolated worker HTTP-proxying mode) — entry span + inferred-proxy span
    • WcfCommon (WCF over HTTP) — entry span

Test coverage

  • SpanContextPropagatorTests_AddSecurityTestingHeadersAsTags (new — 13 cases): both markers + unrelated header, absent headers, no HeaderTags config, only one marker present, empty-string value still tagged, case-insensitive lookup, ASP.NET Core HeadersCollectionAdapter with mixed-case lookup.
  • All existing SpanContextPropagatorTests* continue to pass.

Other details

APPSEC-65483

Tag `x-datadog-endpoint-scan` and `x-datadog-security-test` HTTP request
headers as `http.request.headers.<name>` on every HTTP server entry span
(and on the inferred-proxy span when one is created), unconditionally —
independent of `DD_TRACE_HEADER_TAGS` and AppSec enablement.

These markers let the API endpoint reducer distinguish Datadog scan/test
traffic from real user traffic and keep it out of the API inventory.

Wired into: ASP.NET MVC, ASP.NET Web API 2, OWIN/IIS classic, ASP.NET
Core, WCF over HTTP. Markers are not propagated downstream.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@christophe-papazian christophe-papazian requested review from a team as code owners May 22, 2026 15:39
@christophe-papazian christophe-papazian marked this pull request as draft May 22, 2026 15:40
@datadog-datadog-prod-us1
Copy link
Copy Markdown

datadog-datadog-prod-us1 Bot commented May 22, 2026

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 9 Pipeline jobs failed

DataDog/apm-reliability/dd-trace-dotnet | build   View in Datadog   GitLab

🔧 Fix in code (Fix with Cursor). Compilation errors related to missing tuple definitions: CS8137 and CS8179 in SpanContextPropagator.cs at line 28.

Verify app trimming xml file changes have been persisted | verify_app_trimming_descriptor_generator   View in Datadog   GitHub Actions

🔧 Fix in code (Fix with Cursor). Compilation errors related to tuples in SpanContextPropagator.cs:28:33. Required type 'System.Runtime.CompilerServices.TupleElementNamesAttribute' cannot be found.

Verify source generator changes have been persisted | verify_source_generators   View in Datadog   GitHub Actions

🔧 Fix in code (Fix with Cursor). Compilation error in SpanContextPropagator.cs:28:33: Cannot define a class or member that utilizes tuples because the required type 'System.Runtime.CompilerServices.TupleElementNamesAttribute' cannot be found.

View all 9 failed jobs.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 5bb6c5e | Docs | Datadog PR Page | Give us feedback!

@christophe-papazian christophe-papazian added area:asm type:enhancement Improvement to an existing feature labels May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:asm type:enhancement Improvement to an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant