fix: Only redact anonymous contexts in custom events for server SDKs#1814
Merged
Conversation
PR #1809 made custom (and migration) events redact anonymous contexts for all SDKs, but the other LaunchDarkly client/mobile SDKs redact anonymous contexts only in feature events. Client-side custom events should keep the full context. Add an EventProcessorOptions.redactAnonymousAllEvents flag (default false = redact only feature events, the client behavior). Server-side SDKs set it true so custom and migration op events also redact anonymous contexts. Feature-event redaction (non-debug) is unchanged for both. Relates to SDK-2722.
Contributor
|
@launchdarkly/js-sdk-common size report |
Contributor
|
@launchdarkly/js-client-sdk size report |
Contributor
|
@launchdarkly/browser size report |
Contributor
|
@launchdarkly/js-client-sdk-common size report |
keelerm84
marked this pull request as ready for review
July 21, 2026 12:56
joker23
approved these changes
Jul 21, 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.
Summary
PR #1809 made custom (and migration op) events redact anonymous context attributes for all SDKs built on this monorepo. However, an audit of the other LaunchDarkly client/mobile SDKs (.NET, Flutter, iOS, C++, Roku, Android) shows they redact anonymous contexts only in feature events -- custom events keep the full context. Client-side js-core SDKs should match that.
This adds
EventProcessorOptions.redactAnonymousAllEvents, defaulting tofalse(redact anonymous contexts only in feature events -- the client-side behavior). Server-side SDKs (sdk-serverLDClientImpl, and edge SDKs via it) set it totrue, so their custom and migration op events continue to redact anonymous contexts. Feature-event redaction (non-debug) is unchanged for both, and client SDKs need no change -- they inherit the default.Regression tests cover: default (custom not redacted),
redactAnonymousAllEvents: true(custom redacted), and migration op (server, redacted).Verified against the SDK contract test harness: node-client passes with custom events unredacted; server-node passes with custom + migration op events redacted.
Relates to SDK-2722.
Note
Medium Risk
Changes what PII is sent in analytics for anonymous users on client custom events (more data than the regression), while preserving server behavior; behavior is contract-tested but affects event payloads.
Overview
Reverts the client-side behavior introduced in PR #1809 where custom and migration op events always redacted anonymous context attributes. Other LaunchDarkly client/mobile SDKs only redact anonymous contexts in feature events; this change aligns js-core clients with that.
Adds optional
redactAnonymousAllEventsonEventProcessorOptions(defaultfalse). Custom and migration op inlined contexts now callContextFilter.filterwith that flag instead of always passingtrue. Feature event redaction is unchanged (non-debug feature events still always redact).Server SDKs (
LDClientImplfor FDv1 and FDv2) passredactAnonymousAllEvents: true, so server custom and migration op events keep full anonymous redaction. Client SDKs need no code changes.Tests now assert the default (anonymous custom events not redacted), server mode (custom redacted), and migration op under server config. Electron contract harness drops the unused
secure-mode-hashcapability.Reviewed by Cursor Bugbot for commit 7daead6. Bugbot is set up for automated code reviews on this repo. Configure here.