[AppSec] APPSEC-65483 Collect Datadog security-testing headers on entry spans#8682
Draft
christophe-papazian wants to merge 2 commits into
Draft
[AppSec] APPSEC-65483 Collect Datadog security-testing headers on entry spans#8682christophe-papazian wants to merge 2 commits into
christophe-papazian wants to merge 2 commits into
Conversation
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>
|
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
Tag
x-datadog-endpoint-scanandx-datadog-security-testHTTP request headers ashttp.request.headers.<name>on every HTTP server entry span (and the inferred-proxy span when one is created), unconditionally — independent ofDD_TRACE_HEADER_TAGSand 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
SpanContextPropagator.AddSecurityTestingHeadersAsTags<THeaders>reads both markers from anyIHeadersCollectionand tags them on the supplied span. Tag names are precomputed;string[]fast-path avoids enumerator allocation on the legacyNameValueCollection/WebHeaderCollectioncarriers; presence-based (empty values still tagged).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 spanAspNetCoreHttpRequestHandler(ASP.NET Core, including Azure Functions isolated worker HTTP-proxying mode) — entry span + inferred-proxy spanWcfCommon(WCF over HTTP) — entry spanTest coverage
SpanContextPropagatorTests_AddSecurityTestingHeadersAsTags(new — 13 cases): both markers + unrelated header, absent headers, noHeaderTagsconfig, only one marker present, empty-string value still tagged, case-insensitive lookup, ASP.NET CoreHeadersCollectionAdapterwith mixed-case lookup.SpanContextPropagatorTests*continue to pass.Other details