Skip to content

fix: Redact anonymous context attributes in migration op and custom events#1809

Merged
joker23 merged 5 commits into
mainfrom
mk/sdk-2722/migration-anonymous-redaction
Jul 20, 2026
Merged

fix: Redact anonymous context attributes in migration op and custom events#1809
joker23 merged 5 commits into
mainfrom
mk/sdk-2722/migration-anonymous-redaction

Conversation

@keelerm84

@keelerm84 keelerm84 commented Jul 20, 2026

Copy link
Copy Markdown
Member

Summary

Migration op events and custom events inline the full context, but the event processor called ContextFilter.filter(context) without the redactAnonymousAttributes flag on those two paths -- only feature events passed it. As a result, an anonymous context kept its attributes in migration_op and custom events even though feature/index events correctly redacted them and reported them under _meta.redactedAttributes.

This passes true on both paths (neither migration nor custom events are ever debug events), matching feature-event behavior. Explicit private-attribute redaction already worked; this closes the anonymous-redaction gap for both event types.

Adds/updates EventProcessor regression tests for the migration op and custom event cases.

Found by running the expanded SDK contract-test-harness migration + custom-event suites against the Node contract test service; verified both suites now pass.


Note

Medium Risk
Touches analytics event privacy handling for inlined contexts; behavior change could affect downstream consumers that relied on full anonymous attributes in custom/migration events, but aligns with existing feature-event semantics.

Overview
Anonymous context attributes are now stripped from inlined contexts on migration_op and custom analytics events, matching feature events. EventProcessor calls ContextFilter.filter(context, true) on those paths instead of the default false, so redacted fields appear under _meta.redactedAttributes rather than leaking PII.

Index events are unchanged—they still carry the full anonymous context (as in the updated custom-event test comments).

Regression coverage adds a migration_op anonymous case and tightens the anonymous custom-event expectation for the custom payload only.

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

Migration op events inline the full context but passed no redactAnonymous
flag to ContextFilter.filter, so anonymous contexts kept their attributes
in the migration_op event even though feature events redacted them. Pass
true (migration events are never debug), matching feature-event behavior,
and add an EventProcessor regression test.

Fixes SDK-2722.
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 179641 bytes
Compressed size limit: 200000
Uncompressed size: 831521 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

Like migration op events, custom events inline the full context but did not
pass the redactAnonymous flag to ContextFilter.filter, so anonymous contexts
kept their attributes in custom events. Pass true (custom events are never
debug), matching feature and migration op behavior, and update the custom
anonymous-context test to assert redaction.

Fixes SDK-2722.
@keelerm84 keelerm84 changed the title fix: Redact anonymous context attributes in migration op events fix: Redact anonymous context attributes in migration op and custom events Jul 20, 2026
@keelerm84
keelerm84 requested a review from joker23 July 20, 2026 19:45
@keelerm84
keelerm84 marked this pull request as ready for review July 20, 2026 19:46
@keelerm84
keelerm84 requested a review from a team as a code owner July 20, 2026 19:46
…m:launchdarkly/js-core into mk/sdk-2722/migration-anonymous-redaction
@joker23
joker23 merged commit c84ec48 into main Jul 20, 2026
55 checks passed
@joker23
joker23 deleted the mk/sdk-2722/migration-anonymous-redaction branch July 20, 2026 22:06
@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