Repository navigation
fix: Filter sensitive cookie values instead of sending raw cookies - #5894
Merged
Merged
Conversation
Parse Cookie and Set-Cookie values per DataCollection spec 0.15.0 and filter each cookie by name, so raw cookie headers no longer reach request.cookies. Server transactions also carry the http.request.header.cookie string-array attribute. Fixes #5423 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5894 +/- ##
==========================================
+ Coverage 76.87% 76.95% +0.07%
==========================================
Files 533 535 +2
Lines 19847 19909 +62
Branches 3920 3945 +25
==========================================
+ Hits 15258 15320 +62
Misses 3709 3709
Partials 880 880 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A malformed pair now becomes a single [Filtered] element instead of discarding the other cookies in the header, matching sentry-java. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rse-cookies-196ba8 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reading cookies by name returned the first match for each duplicate, so a repeated cookie name sent the first value twice. Index the collection instead, which also drops the LINQ closure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ric-oliv
reviewed
Nov 10, 2026
…actions Adds the .AspNetCore. and .AspNet. prefixes to the sensitive cookie name terms, so default auth, antiforgery and custom-scheme cookies are filtered. Cookie parsing now only runs for sampled transactions. Trims redundant tests and adds a comma-only malformed case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HTTP/2 sends header names in lowercase, so the case-sensitive match skipped Request.Cookies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 62dd4f9. Configure here.
…s off The case-sensitive skip let a lowercase cookie header fill Request.Cookies without SendDefaultPii. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FilterSetCookieHeader had no caller. It will come back with its first call site. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ric-oliv
approved these changes
Nov 12, 2026
27 tasks done
This was referenced Nov 17, 2026
This was referenced Nov 17, 2026
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.

When
SendDefaultPiiis on, cookies are now parsed and filtered by name instead of being sent as the raw header. Sensitive values become[Filtered], and nameless or malformed cookies are replaced with[Filtered], as in sentry-java. This applies to the ASP.NET Core and ASP.NET scope/event paths and to the HTTP and GraphQL failed-request handlers.Cookie: user_session=abc; theme=dark-mode;opaque-tokenis now sent as:Where the array goes. The string array is the spec's span attribute, so it goes on server transactions through the existing
SetData. Error events have no attribute bag and Relay doesn't accept a plain string array inrequest.cookies, so events keep a filtered string, as sentry-java does. There is no public API or wire-format change, andSendDefaultPiistill gates collection. Client failed-request events only get the string.Worth a look in review:
invalid_dataerror on events containing a bare[Filtered]segment, which shows as a "Processing Error". The other cookies are kept..AspNetCore.and.AspNet.are new sensitive cookie name terms, which covers the framework auth, antiforgery and custom-scheme cookies..AspNetCore.Cultureis hidden too.Set-Cookieparsing rules from DataCollection phase 0: parse cookies individually and filter sensitive cookie names #5423 aren't implemented here, since nothing collectsSet-Cookieyet. They'll land with their first caller.SendDefaultPiirather thanDataCollection.Cookies, like every other cookie call site. It moves to the resolver with the rest of its integration, in DataCollection phase 2: migrate Sentry.AspNetCore #5430 for ASP.NET Core and DataCollection phase 2: migrate Sentry.AspNet (System.Web) #5431 for System.Web, so events and spans switch together.Cookievalue in the general header map is replaced with[Filtered]by fix: filter sensitive HTTP header values regardless of SendDefaultPii #5890 (DataCollection phase 0: always redact sensitive header values #5422), which is merged into this branch.SetDatawith astring[]needed an explicit branch in the JSON writer, because AOT builds have no serializer context for that type.Closes #5423
🤖 Generated with Claude Code