Skip to content

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

Merged
keelerm84 merged 1 commit into
mainfrom
mk/SDK-3775/escape-redacted-attribute-names
Nov 30, 2026
Merged

keelerm84 merged 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
When a whole top-level custom attribute is redacted, _meta.redactedAttributes now records AttributeReference::fromLiteral($attr)->getPath() instead of the raw attribute name. Names that start with / (for example /a or /~x) are emitted as escaped paths such as /~1a and /~1~0x, so LaunchDarkly does not treat them as nested references to a or ~x.

This applies when attributes are marked private on the context, via global private config, or when all_attributes_private redacts every attribute. Nested object redaction was already writing escaped paths via parsed AttributeReference instances; only whole-attribute redaction in checkWholeAttributePrivate was wrong.

Unit tests cover per-context private attributes and all_attributes_private for these edge-case names.

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

@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

…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 force-pushed the mk/SDK-3775/escape-redacted-attribute-names branch from 772688c to 9ea31bf Compare November 30, 2026 18:34
@keelerm84
keelerm84 merged commit d59cb4b into main Nov 30, 2026
15 checks passed
@keelerm84
keelerm84 deleted the mk/SDK-3775/escape-redacted-attribute-names branch November 30, 2026 18:39
keelerm84 pushed a commit that referenced this pull request Nov 30, 2026
🤖 I have created a release *beep* *boop*
---


##
[6.13.2](6.13.1...6.13.2)
(2026-11-30)


### Bug Fixes

* Escape attribute names that look like references in redactedAttributes
([#309](#309))
([d59cb4b](d59cb4b))
* Evaluate before and after clauses on timestamps with up to nine
fractional digits
([#308](#308))
([a174822](a174822))
* Redact nested private attributes in associative arrays that have
([1c5dba7](1c5dba7))
* Redact nested private attributes when attribute values are `stdClass`
objects
([#306](#306))
([1c5dba7](1c5dba7))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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