Skip to content

fix: Only redact anonymous contexts in custom events for server SDKs#1814

Merged
keelerm84 merged 2 commits into
mainfrom
mk/sdk-2722/client-custom-anon-redaction
Jul 21, 2026
Merged

fix: Only redact anonymous contexts in custom events for server SDKs#1814
keelerm84 merged 2 commits into
mainfrom
mk/sdk-2722/client-custom-anon-redaction

Conversation

@keelerm84

@keelerm84 keelerm84 commented Jul 21, 2026

Copy link
Copy Markdown
Member

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 to false (redact anonymous contexts only in feature events -- the client-side behavior). Server-side SDKs (sdk-server LDClientImpl, and edge SDKs via it) set it to true, 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 redactAnonymousAllEvents on EventProcessorOptions (default false). Custom and migration op inlined contexts now call ContextFilter.filter with that flag instead of always passing true. Feature event redaction is unchanged (non-debug feature events still always redact).

Server SDKs (LDClientImpl for FDv1 and FDv2) pass redactAnonymousAllEvents: 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-hash capability.

Reviewed by Cursor Bugbot for commit 7daead6. Bugbot is set up for automated code reviews on this repo. Configure here.

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.
@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 26360 bytes
Compressed size limit: 29000
Uncompressed size: 129188 bytes

@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 32030 bytes
Compressed size limit: 34000
Uncompressed size: 114438 bytes

@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 179649 bytes
Compressed size limit: 200000
Uncompressed size: 831617 bytes

@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 38887 bytes
Compressed size limit: 39000
Uncompressed size: 212703 bytes

@keelerm84
keelerm84 marked this pull request as ready for review July 21, 2026 12:56
@keelerm84
keelerm84 requested a review from a team as a code owner July 21, 2026 12:56
@keelerm84
keelerm84 merged commit 5a3b3fb into main Jul 21, 2026
55 checks passed
@keelerm84
keelerm84 deleted the mk/sdk-2722/client-custom-anon-redaction branch July 21, 2026 13:48
@github-actions github-actions Bot mentioned this pull request Jul 20, 2026
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.

2 participants