Skip to content

Add the usage sharing options to share all Evidence and all query string parameters - #83

Draft
jwrosewell wants to merge 6 commits into
rcfrom
fix/usage-sharing-options
Draft

jwrosewell wants to merge 6 commits into
rcfrom
fix/usage-sharing-options

Conversation

@jwrosewell

@jwrosewell jwrosewell commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Three differences between Java's usage sharing element and the usage sharing element specification (on specifications rc), found in the independent review of #68 (merged into rc as 7299688).

Changes

  1. The two missing options. The Configuration options table lists "Share all Evidence" and "Share all query string parameters", both defaulting to false. .NET has SetShareAllEvidence and SetShareAllQueryStringParameters, and Go has the same pair. Java now has setShareAllEvidence(boolean) and setShareAllQueryStringParameters(boolean) on ShareUsageBuilderBase, with isShareAllEvidence() and isShareAllQueryStringParameters(). The configuration file reads them like every other builder option, as ShareAllEvidence and ShareAllQueryStringParameters.
    • Share all Evidence follows Shared Evidence. The never-shared keys (id.email, id.salt, request-query, request-path and header.cookie) are still refused "even when all Evidence is shared", and the rules for blocked headers, cookie., session. and query. apply only "unless all Evidence is shared". The filter checks the never-shared keys first, then returns true.
    • Share all query string parameters includes every query. key that is not a never-shared key, and leaves the rules for headers, cookies and session values alone. .NET does this by dropping the allow list, and Java by a flag in the filter, with the same result.
    • Both flags reach the key filters in ShareUsageBase, being the filter that decides what is sent and the filter the tracker uses, so session tracking sees the same values that are sent.
  2. One cache in the tracker. ShareUsageTracker built a second cache for its own keys, while TrackerBase (through DataKeyedCacheBase) built its own and never used it. DataKeyedCacheBase now has an overridable generateKey(FlowData), which get and put use, and the tracker overrides it instead of keeping a second cache. Review finding 2 in the review of #68. The new method defaults to the previous behaviour, so no other class changes.
  3. Case. Shared Evidence says "Keys are compared without regard to case". ShareUsageBase.getDataFromEvidence switched on the key as given, so Server.Client-IP was written as an ordinary Server value, not as the client IP, whilst find() is case-insensitive. The switch now uses the lower-case key. Review finding 5 in the review of Accept no Evidence for usage sharing, and give it the whole web request #68.

How it was checked

Tests are in the new ShareUsageOptionsTests, which builds the element from options as a configuration file does and reads the XML it sends.

  • Red on rc plus the tests only: run 42687160142, Java 8 and 17. Of 7 new tests, 6 fail (tracker_BuildsOneCache expected 1 cache and found 2, keysAreReadWithoutRegardToCase found no client IP, and the four option tests fail with a PipelineConfiguration error because the options do not exist). The other 38 tests in the run pass.
  • Green with the change: run 42687756495, Java 8 and 17, 46 tests run, 0 failures, 1 skipped (as before).
  • Full build: see below.

Other drafts

Remaining

Locale

Review of this draft found that the filter lower-cased keys with the default locale. In a Turkish locale ID.EMAIL does not become id.email, so the never-shared check would miss and share-all would send the raw email key. EvidenceKeyFilterShareUsage now lower-cases with Locale.ROOT (the session cookie name, blocked headers, included parameters and the key). No other usage sharing code lowers or raises case without a locale. neverSharedKeys_TurkishLocale_StillRefused sets the default locale to Turkish and checks the never-shared keys are refused with and without share-all.

Full build

Head 4e720fc, which merges rc at 9846076 (including #81). Run 42719938865, and every Setting 'PullRequestSha' line is 4e720fc. Configure, the four Windows jobs (Java 8, 11, 17, 21) and the five Ubuntu jobs (Java 8, 11, 17, 21 and ARM 17) succeeded. The macOS jobs and Compare Performance were cancelled.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant