Skip to content

Properties sanitizer#64

Merged
marandaneto merged 3 commits into
mainfrom
chore/properties-sanitizer
Nov 14, 2023
Merged

Properties sanitizer#64
marandaneto merged 3 commits into
mainfrom
chore/properties-sanitizer

Conversation

@marandaneto
Copy link
Copy Markdown
Member

@marandaneto marandaneto commented Nov 14, 2023

💡 Motivation and Context

Some SDKs have a sanitize_properties method, others property_denylist (which is just a deny list instead of giving the flexibility of adding, redacting, or removing properties).
This is similar to sanitize_properties but as a callback that is run before the event is cached or sent over the wire.
The user can redact, remove, or add any properties.
This would work for automatic events as well since it runs for every single event and not only manually captured events.
The downside is that the user can mess up with properties that may cause a bug on the backend or something.

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

Copy link
Copy Markdown

@benjackwhite benjackwhite left a comment

Choose a reason for hiding this comment

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

Personally I like it. I think sanitize properties is the right terminology (certainly as good as any other)

@marandaneto marandaneto marked this pull request as ready for review November 14, 2023 12:09
@marandaneto
Copy link
Copy Markdown
Member Author

Personally I like it. I think sanitize properties is the right terminology (certainly as good as any other)

Alright, added tests and updated the usage markdown, will cut a version :)

@marandaneto
Copy link
Copy Markdown
Member Author

For context, there was a workaround before:
PostHog.capture("testEvent", properties = mapOf("\$device_name" to "removed"))

This would work for manually captured events, but it'd not work for automatically captured events nor events that don't contain the properties param eg identify.

@marandaneto marandaneto merged commit 0cc233c into main Nov 14, 2023
@marandaneto marandaneto deleted the chore/properties-sanitizer branch November 14, 2023 12:17
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.

2 participants