Skip to content

fix: Escape attribute names that look like references in redactedAttributes - #309

Open
keelerm84 wants to merge 1 commit into
mainfrom
mk/SDK-3775/escape-redacted-attribute-names
Open

keelerm84 wants to merge 1 commit into
mainfrom
mk/SDK-3775/escape-redacted-attribute-names

Conversation

@keelerm84

@keelerm84 keelerm84 commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Summary

_meta.redactedAttributes in analytics events holds attribute references. When a top-level attribute was redacted, the SDK wrote its literal name. A private attribute named /a was reported as /a, which LaunchDarkly reads as a reference to an attribute named a. The SDK now writes the escaped reference, /~1a. This applies to per-context and global private attributes and to all_attributes_private. The redaction itself was already correct.

The v2 contract tests for private attribute names that look like references now pass.


Note

Overview
Fixes _meta.redactedAttributes for top-level private attributes: the serializer now records AttributeReference::fromLiteral($attr)->getPath() instead of the raw attribute name when a whole attribute is redacted (all_attributes_private, per-context private attrs, or global private names at depth 1).

That keeps names like /a and /~x from being misread as JSON-pointer references (e.g. /a → /~1a). Nested redaction paths were already using reference paths; only whole-attribute entries changed.

New EventSerializerTest cases cover private attributes with reference-like names and all_attributes_private.

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

…ibutes

_meta.redactedAttributes holds attribute references. The SDK wrote the
literal name of a redacted top-level attribute, so a private attribute
named "/a" was reported as "/a", which LaunchDarkly reads as a reference
to an attribute named "a". The name is now written as "/~1a".
@keelerm84
keelerm84 requested a review from a team as a code owner November 25, 2026 20:52

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Risk: low. Approved per SDK rules 1–3 (not a release PR, allowed author, no disallowed workflow changes). Cursor Bugbot completed with no findings that need human review.

Open in Web View Automation 

Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver

This branch has not been deployed

No deployments
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.

1 participant