fix: Escape attribute names reported in redactedAttributes - #415
Draft
kinyoklion wants to merge 1 commit into
Draft
fix: Escape attribute names reported in redactedAttributes#415kinyoklion wants to merge 1 commit into
kinyoklion wants to merge 1 commit into
Conversation
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
3 tasks
Contributor
|
@cursor review |
3 tasks
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.
Requirements
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: anyevents/feature events/multi-kind with anonymous context redacts attributes appropriately/type: anyDescribe the solution you've provided
_meta.redactedAttributesin 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:ContextFilter#check_whole_attribute_privatenow converts the attribute name to a reference withReference.create_literalbefore adding it to the redacted list, which escapes/and~for slash-prefixed names and leaves all other names unchanged (namestaysname,a/b~cstaysa/b~csince it is already a literal reference). This covers both theallAttributesPrivate/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_privatebranch — rejected, the same escaping is required wherever a whole attribute is redacted.Additional context
Nested redactions (
redact_json_value) already reportedReference#raw_path, so they were unaffected.Link to Devin session: https://app.devin.ai/sessions/316afaccd2604f8d802a72c9080f6921
Requested by: @kinyoklion