feat: Support redacting anonymous context attributes in all events#194
Merged
Conversation
tanderson-ld
approved these changes
Jul 21, 2026
keelerm84
force-pushed
the
mk/SDK-2732/redact-anonymous-custom-events
branch
from
July 21, 2026 14:01
5454823 to
e8164aa
Compare
…server-side, opt-in) Server-side SDKs inline the full context in custom and migration_op events and must redact an anonymous context's attributes into _meta.redactedAttributes. Client-side SDKs use the current context for custom events and must NOT redact them (only feature events redact anonymous contexts on the client), per sdk-test-harness #388. Because this internal module is shared with client/mobile SDKs (e.g. Android), the redaction is gated behind a new EventsConfiguration flag, redactAnonymousAllEvents (default false), matching the js-core convention (js-core #1814). The existing EventsConfiguration constructors default it to false, so client/mobile consumers are unaffected and remain source-compatible. Server-side SDKs opt in as a follow-up once this change is released. Feature-event redaction is unchanged (applies to both). - EventsConfiguration: new redactAnonymousAllEvents flag + full constructor overload (older overloads delegate with false). - EventOutputFormatter: custom and migration_op events honor the flag. - Tests: server-behavior redacts (custom + migration), client-behavior (flag off) does not. SDK-2732
keelerm84
force-pushed
the
mk/SDK-2732/redact-anonymous-custom-events
branch
from
July 21, 2026 14:08
e8164aa to
e5b1d72
Compare
tanderson-ld
approved these changes
Jul 21, 2026
This was referenced Jul 21, 2026
keelerm84
pushed a commit
that referenced
this pull request
Jul 21, 2026
🤖 I have created a release *beep* *boop* --- ## [1.10.0](launchdarkly-java-sdk-internal-1.9.0...launchdarkly-java-sdk-internal-1.10.0) (2026-07-21) ### Features * Support redacting anonymous context attributes in all events ([#194](#194)) ([a83a628](a83a628)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
keelerm84
added a commit
that referenced
this pull request
Jul 21, 2026
…ents Consume the redactAnonymousAllEvents flag added to launchdarkly-java-sdk-internal: bump the internal dependency and enable the flag when the server SDK constructs its EventsConfiguration, so anonymous context attributes are redacted in custom and migration_op events (server-side behavior). Stacked on #194 (the internal change). Do not merge until launchdarkly-java-sdk-internal 1.9.1 is released. SDK-2732
keelerm84
pushed a commit
that referenced
this pull request
Jul 21, 2026
🤖 I have created a release *beep* *boop* --- ## [7.15.0](launchdarkly-java-server-sdk-7.14.0...launchdarkly-java-server-sdk-7.15.0) (2026-07-21) ### Features * Support redacting anonymous context attributes in all events ([#194](#194)) ([a83a628](a83a628)) ### Bug Fixes * Enable anonymous context redaction in server custom/migration events ([#195](#195)) ([19aa714](19aa714)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
Summary
Custom-event (and migration_op) anonymous-context redaction is a server-side behavior: server-side SDKs inline the full context and must redact an anonymous context's attributes into
_meta.redactedAttributes. Client-side/mobile SDKs use the current context for custom events and must not redact them (only feature events redact anonymous contexts on the client) — see sdk-test-harness #388.Because this
internalmodule is shared by both the server SDK and client/mobile SDKs (e.g. Android), the redaction is gated behind a new opt-in flag rather than applied unconditionally. The flag is namedredactAnonymousAllEventsto match the js-core convention (js-core #1814).Scope of this PR (internal module only)
EventsConfiguration: newredactAnonymousAllEventsfield (default false) + a full constructor overload. The existing constructors default it tofalse, so client/mobile consumers are unaffected and remain source-compatible.EventOutputFormatter: custom andmigration_opevents honor the flag (migration_op is only ever produced server-side). Feature-event redaction is unchanged (both client and server).Follow-up (separate PR, after this releases)
Ships as a new
launchdarkly-java-sdk-internalrelease. The server SDK then opts in via a follow-up PR that bumpslaunchdarklyJavaSdkInternaland setsredactAnonymousAllEventsinComponentsImpl. That is when the server contract tests go green.CI note
test-contract-testsbuilds the server SDK against the releasedinternal, so the custom/migration anonymous-redaction contract tests remain red on this PR until the follow-up server bump — expected, not a regression. Thejava-sdk-internalchecks (unit tests) cover this change.Verification
internalunit tests pass (server-behavior custom + migration, client-behavior no-redaction).v2@0317ec5(incl. #388): with the server opting in,events/custom events/*anonymous*andmigrations/redacts anonymous context attributespass; with the flag off, the custom-event context is emitted unredacted (client behavior).Jira: SDK-2732
Note
Medium Risk
Changes analytics payload shape for anonymous contexts when the flag is enabled; default-off preserves current client behavior but server adopters must enable it deliberately to match harness expectations.
Overview
Adds an opt-in
redactAnonymousAllEventsflag onEventsConfiguration(defaults false via existing constructors so client/mobile SDKs stay unchanged). When enabled,EventOutputFormatterredacts anonymous context attributes on custom andmigration_opevents—the same_meta.redactedAttributesbehavior feature events already use—while identify/index and client-default custom events are unchanged.Unit tests cover server-style redaction (single- and multi-kind) and client-style full context when the flag is off. Contract-test suppressions were added for anonymous custom/migration scenarios until the server SDK opts in in a follow-up release.
Reviewed by Cursor Bugbot for commit 2b89ca1. Bugbot is set up for automated code reviews on this repo. Configure here.