Repository navigation
Description
Part of #5420. Phase 0 — hardening pre-work, no new public API.
Rewritten for
dataCollectionspec 0.15.0 (2026-09-29), which changed how parsed cookies must be represented. The original version of this issue described one attribute per cookie name; that is no longer correct.
Cookie capture is currently all-or-nothing: the raw Cookie header string is attached wholesale when SendDefaultPii is true (src/Sentry/HttpHeadersExtensions.cs GetCookies, src/Sentry.AspNetCore/ScopeExtensions.cs, src/Sentry.AspNet/HttpContextExtensions.cs, SystemWebRequestEventProcessor.cs, the HTTP and GraphQL failed-request handlers).
Required representation
Cookies are attached as a single string-array attribute whose elements are name=value pairs — not one attribute per cookie name — following the http.request.header.<key> convention.
Given Cookie: user_session=abc; theme=dark-mode;opaque-token and Set-Cookie: theme=light-mode; HttpOnly:
http.request.header.cookie: ["user_session=[Filtered]", "theme=dark-mode", "[Filtered]"]
http.request.header.set-cookie: ["theme=light-mode"]
user_session=[Filtered]— matchessessionin the sensitive denylisttheme=dark-mode— not sensitive, value sent as-is[Filtered]— nameless cookie (see parsing rules)
Parsing rules
- Split on
";", not"; ". The space after the semicolon is not guaranteed; splitting on"; "would leak the previous cookie's value into the next element. - A segment without
"="is a nameless cookie: per RFC 6265bis the bare token is its value, not its name. The SDK MUST replace that element with"[Filtered]". Set-Cookieattributes (Max-Age,Path,HttpOnly, …) are metadata, not cookies, and MUST NOT appear as cookie pairs.- When individual pairs cannot be extracted (malformed or opaque cookie string), the entire header value MUST become
["[Filtered]"]— an array with the single fallback element, not a bare string. - Unfiltered raw cookie header values MUST NOT be sent. When in doubt, use the fallback.
Cookie names are filtered with the cookies behavior rules plus the cookie-specific name terms from the shared utility (#5421).
Note for #5422: Cookie / Set-Cookie appearing in the general HTTP header map are always replaced with "[Filtered]" — separately collected cookie data is what this issue governs. sentry-java does exactly this.
Depends on #5421.
References: spec 0.15.0; sentry-java 8.58.0 (DataCollectionResolver.getCookies()); JS #18325 (per-cookie parsing), #20485 (expanded cookie-name filtering).
Activity
linear-code commentedon Jul 22, 2026
NET-758
fix: Filter sensitive cookie values instead of sending raw cookies (g…