Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cdp): add pii hashing transformation #28446

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

meikelmosby
Copy link
Contributor

@meikelmosby meikelmosby commented Feb 7, 2025

Problem

we want a way to hash PII through transformations, also on nested values e.g. properties.$ip or properties.$set.$email

Changes

  • introduced new transformation that can hash any field in properties.
  • we handle nested properties as well e.g. properties.$set.$default_browser
  • you also hash the distinct_id
  • you can optionally provide a salt

2025-02-12 17 10 52

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

How did you test this code?

  • written tests
  • tested locally

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Introduced a new PII data hashing transformation that uses SHA-256 to protect sensitive user data in event properties, with configurable property selection.

  • Implemented SHA-256 hashing in /plugin-server/src/cdp/templates/_transformations/pii-hashing/pii-hashing.template.ts with default IP address hashing
  • Added comprehensive test suite in pii-hashing.template.test.ts covering edge cases like empty values and invalid paths
  • Template preserves original event structure by creating a copy before modification
  • Includes input schema for flexible property selection via dictionary configuration
  • Maintains data integrity by only hashing non-empty values and leaving unspecified properties unchanged

3 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings | Greptile

@meikelmosby meikelmosby requested review from benjackwhite and a team February 10, 2025 09:23
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