Skip to content

fix: Escape attribute names reported in redactedAttributes - #415

Draft
kinyoklion wants to merge 1 commit into
mainfrom
devin/1786660448-redacted-attribute-escaping
Draft

fix: Escape attribute names reported in redactedAttributes#415
kinyoklion wants to merge 1 commit into
mainfrom
devin/1786660448-redacted-attribute-escaping

Conversation

@kinyoklion

Copy link
Copy Markdown
Member

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

Surfaced by contract test harness v3.2.0-alpha.6 (the pin bump in #414). These 6 subtests failed against the newer harness:

  • events/context properties/single-kind, allAttributesPrivate, slash-prefixed attribute name (debug, identify, index-from-evaluation, index-from-custom-event)
  • events/feature events/single-kind anonymous context redacts all attributes/type: any
  • events/feature events/multi-kind with anonymous context redacts attributes appropriately/type: any

Describe the solution you've provided

_meta.redactedAttributes in event payloads is a list of attribute references, not raw attribute names. When a context has an attribute whose name begins with / (e.g. /ssn), the SDK emitted the raw name, which a consumer parses as a path expression pointing at a nested property rather than the top-level attribute:

expected: "/~1ssn"
actual:   "/ssn"

ContextFilter#check_whole_attribute_private now converts the attribute name to a reference with Reference.create_literal before adding it to the redacted list, which escapes / and ~ for slash-prefixed names and leaves all other names unchanged (name stays name, a/b~c stays a/b~c since it is already a literal reference). This covers both the allAttributesPrivate/configured-private paths and the anonymous-context redaction path, which is why one change fixes all 6 subtests.

Verified locally: contract test service against released harness v3.2.0-alpha.6, full suite — 4723 total, 14 skipped, all ran passed.

Describe alternatives you've considered

Escaping only in the all_attributes_private branch — rejected, the same escaping is required wherever a whole attribute is redacted.

Additional context

Nested redactions (redact_json_value) already reported Reference#raw_path, so they were unaffected.

Link to Devin session: https://app.devin.ai/sessions/316afaccd2604f8d802a72c9080f6921
Requested by: @kinyoklion

Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
@kinyoklion kinyoklion self-assigned this Aug 13, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration

Copy link
Copy Markdown
Contributor

@cursor review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant