fix: Redact anonymous context attributes in migration op and custom events#1809
Merged
Conversation
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.
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 |
joker23
approved these changes
Jul 20, 2026
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
marked this pull request as ready for review
July 20, 2026 19:46
…m:launchdarkly/js-core into mk/sdk-2722/migration-anonymous-redaction
joker23
approved these changes
Jul 20, 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
Migration op events and custom events inline the full context, but the event processor called
ContextFilter.filter(context)without theredactAnonymousAttributesflag on those two paths -- only feature events passed it. As a result, an anonymous context kept its attributes inmigration_opandcustomevents even though feature/index events correctly redacted them and reported them under_meta.redactedAttributes.This passes
trueon 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_opandcustomanalytics events, matching feature events.EventProcessorcallsContextFilter.filter(context, true)on those paths instead of the defaultfalse, so redacted fields appear under_meta.redactedAttributesrather 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_opanonymous 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.