Repository navigation
Share a header named Cookies by default, as only the Cookie header is blocked - #132
Merged
Merged
Conversation
A header named Cookies is shared like any other header, unless the blocked headers name it.
The usage sharing filter blocked a header named Cookies as well as the Cookie header. The specification's default is that all HTTP headers are shared except Cookie, so only Cookie is blocked now, and the blocked headers option still blocks any header it names. The builder's documentation gave the default as cookies that do not start with 51D_, which is the rule for cookies and not for headers.
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.
Problem
The usage sharing filter blocks two headers by default where the specification blocks one.
EvidenceKeyFilterShareUsageadds bothcookiesandcookieto its blocked headers whatever it is given (lines 165 to 168 at rc 1c99b72f), so a request header namedCookiesis never shared unless all Evidence is shared.Cookiesis not the Cookie header, so it is an ordinary header that the specification shares by default.The three
setBlockedHttpHeadersandsetBlockedHttpHeadermethods ofShareUsageBuilderBasealso describe the default wrongly. Their Javadoc says "all HTTP headers (excluding a few such as 'cookies', if they don't start with 51D_) are shared", and their@DefaultValuereads "All HTTP Headers are shared except cookies that do not start with 51D_" (lines 212, 229 and 244 at rc 1c99b72f), which mixes the header rule up with the cookie rule.A check of every language against the rule that usage sharing shares every HTTP header not flagged as personal, with the raw Cookie header left out, found this gap in Java. .NET had the same gap and fixed it in 51degrees-dotnet#172, merged into its
rc.What the specification says
usage-sharing-element.md at 6570727d, "Shared Evidence" names the keys that are never shared, among them
and then says that, unless all Evidence is shared, the filter "MUST also return false for any key where" the "Prefix =
header.and field is in a user-configurable block list", and "Anything else MUST return true. (i.e. it will be shared)".The configuration options table, line 404 gives the default of "Blocked HTTP headers" as
RFC 6265 section 5.4 names the request header that carries cookies as
Cookie. No header namedCookiesis defined there.What changed
EvidenceKeyFilterShareUsageno longer addscookiesto the blocked headers.cookieis still always blocked, as the specification asks.@DefaultValueof the three blocked header setters onShareUsageBuilderBasenow say "every HTTP header is shared except Cookie" and "All HTTP headers are shared except Cookie", the words of the specification's table.No public name is removed or renamed. An application that wants a header named
Cookiesleft out adds it to the blocked headers, which the second new test shows working.Tests
Written first (commit bc2872d), in
EvidenceKeyFilterShareUsageTests.onlyTheCookieHeaderIsBlockedByDefault. With the default settings,header.cookieandheader.Cookieare not shared, andheader.cookiesandheader.Cookiesare.aCookiesHeaderIsBlockedWhenNamed. WithCookiesin the blocked headers,header.cookiesandheader.Cookiesare not shared, andheader.cookiestill is not.The runs build
pipeline.engines.fiftyonewith the modules it needs and run the usage sharing test classes on the runner's Java, on Ubuntu.rc30e4886 (commit 0028d70 on a temporary branch): run 43536125839.EvidenceKeyFilterShareUsageTestsran 12 with 1 failure,onlyTheCookieHeaderIsBlockedByDefaultat line 199, whereheader.cookieswas not shared.rc1c99b72 is merged into this draft (merge commit ebe35da, no conflicts).rcgained #83 in the same file since, which compares keys in the root locale, and the full build below runs the tests on the merged code.Build
Full build 43594488581 on head ebe35da passed. Configure and all nine Build and Test jobs succeeded (Ubuntu Java 8, 11, 17 and 21, Ubuntu ARM Java 17, and Windows Java 8, 11, 17 and 21), and all 10
PullRequestShalines in the job logs read ebe35da. Configure printed "Left out 6 macOS entries".macOS was left out of this draft's full build under the 9 November decision. The rc head is built with macOS before it merges into main.
Before you upgrade
A request header named
Cookiesis now shared by usage sharing by default, as every other header butCookieis. To keep it out, add it to the blocked headers withsetBlockedHttpHeader("Cookies")on the usage sharing builder.What remains
Nothing for this change.