Repository navigation
Share only the evidence usage sharing accepts, as .NET does - #51
Merged
Merged
Conversation
Usage sharing should share what the specification's accepted evidence section allows: headers other than Cookie, cookies, session values and query string parameters starting 51D_, the parameters the caller names, and any other evidence. A name containing a dot is matched whole. The email address, the salt for hashed email identifiers, the query string and the path are never shared. The session cookie is kept for the tracker whatever the case of its name, and the default tracker does not share again a request that differs only in its session id and sequence. These tests fail on rc.
The usage sharing filter split each key at every dot and applied its rules only to keys with exactly two parts, so any key with more, such as query.id.email, cookie.a.b or a session attribute named after a class, was shared whatever the configuration said. It now splits at the first dot, so the field is everything after it. The filter now also - never shares id.email, id.salt, request-query or request-path, matched without regard to case as the whole key or after a dot, as .NET does, - shares query string parameters starting 51D_, as the specification and .NET do, - does not share the Cookie header, which carries every cookie. It blocked "cookies", which no request sends, - matches the session cookie name without regard to case. The default name, JSESSIONID, was compared with the lowercased key, so the session cookie was never kept for the tracker. The default tracker used the plain filter, which includes the session id and sequence number, so every request looked new to it. It now uses EvidenceKeyFilterShareUsageTracker, which leaves them out. The builder's documentation now says that query string parameters starting 51D_ are shared by default.
This was referenced Nov 6, 2026
Merged
jwrosewell
marked this pull request as ready for review
November 7, 2026 00:22
Draft
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.
This is the fix for #50, which can close once it reaches main. It also fixes the filter point listed under "Also found" in #28, and two faults found on the way.
Problem
EvidenceKeyFilterShareUsage.include()split the key at every.and applied its rules only when that gave exactly two parts. Any other key was shared whatever the configuration said, for examplequery.id.email,cookie.a.b,session.org.example.attribute, and a header on the block list whose name has a dot.id.email,id.salt,request-queryorrequest-path.51D_were not shared unless named, where the accepted evidence section of the specification and .NET share them (#28).JSESSIONID, socookie.JSESSIONIDnever matched and session tracking had no effect.EvidenceKeyFilterShareUsage, notEvidenceKeyFilterShareUsageTracker. The plain filter includes the session id and sequence number, which differ on every request, so every request looked new to the tracker.Change
., so the prefix is everything before it and the field everything after it, as .NET does. A key with no.is still shared.id.email,id.salt,request-queryandrequest-pathare never shared, matched without regard to case as the whole key or after a., and checked before every other rule, as in .NET'sEvidenceKeyFilterShareUsage.51D_are shared, and the builder's documentation says so.EvidenceKeyFilterShareUsageTracker.cookies(see below).For review
cookiesHTTP header", and the filter blockedcookies, as .NET does. HTTP has no header calledCookies, and the request header that carries cookies isCookie(RFC 6265 section 5.4), so the raw header, with every cookie in it, was shared and undid the cookie rule. The51d_cookies are still shared, as their owncookie.entries. .NET has the same gap.cookieheader name are not in the specification yet. specifications#89 proposes both, so that every language agrees.Tests
EvidenceKeyFilterShareUsageTestsis new. It ports the .NET filter tests and adds the cases the issue lists:query.id.email,header.id.email,cookie.a.b,session.org.example.attributeandquery.valid.email, together withquery.51D_Test, the session cookie in either case, lists in mixed case and the tracker filter.ShareUsageElementTestsgains three tests that check what is sent. The first checks what the default settings send. The second uses the default tracker and checks that a repeat differing only in its session id and sequence is not sent again. The third tracks sessions and checks thatcookie.JSESSIONIDis kept and never sent, and that a new session is shared again.Checks
cookie.JSESSIONIDnot kept, 2 records where 1 was expected for the repeat,query.51D_Testnot shared, andid.emailandserver.request-queryshared. Every existing test passed (run 42197039440, first attempt).Release note
Usage sharing now applies its rules to keys with more than one dot, never shares an email address, its salt, the query string or the path, shares query string parameters starting
51D_, keeps theJSESSIONIDsession cookie for the tracker without sending it, and no longer shares the same request again because its sequence number changed.