posthog-js icon indicating copy to clipboard operation
posthog-js copied to clipboard

Unable to Apply Selective Privacy with Current rrweb Version in [email protected]

Open firebotQL opened this issue 1 year ago • 2 comments

Hello Team,

I've come across an issue regarding the Selective privacy - only reveal things that are marked as safe feature mentioned in your documentation. Unfortunately, I encounter the issue where your example of query selector appears non-functional as it selects everything in the DOM.

To illustrate the problem, I've contrived a small example. You may find it here.

To meet our privacy requirements, we aim for the utilization of the capability to initially mark every field as anonymized, henceforth choosing specific fields to unmask.

From my example, you might have noticed that I've utilized: maskTextFn: (text, element) => {. This was applied as it currently seems the only logical way to accomplish this requirement (element parameter doesn't exists in this version), considering that such behavior is already achievable through maskInputFn.

I have noticed that the recent [email protected] makes use of "rrweb": "2.0.0-alpha.11", presently being the latest release. However, it seems it does not contain the specific change we require to fulfil our needs.

The change/fix reference could be found here: Extends maskTextFn to pass the HTMLElement to the deciding function, and by searching for maskTextFn, you can see how this adjustment could solve our problem.

Considering the situation, it seems we are unable to meet our requirements until the latest rrweb releases new version and you guys integrate it?

Could you please advise/guide us if there is an alternative or workaround to achieve this? Any assistance would be greatly appreciated.

Thank you in advance for your help.

firebotQL avatar Jan 05 '24 16:01 firebotQL

Ah, thanks for the really clear issue and the reproduction!

The PR to add the element to the function parameter in rrweb was actually from @benjackwhite on this project 😊

I'm tagging him to check if my next assumption is correct.

I think we must have updated the documentation assuming the PR would hit rrweb quickly after being merged but that hasn't happened. I think that without the element parameter what you're trying to do isn't possible...

pauldambra avatar Jan 05 '24 16:01 pauldambra

No extra context. We're just waiting on the rrweb release 🤷

benjackwhite avatar Jan 17 '24 08:01 benjackwhite

that rrweb release is out now so this should be working for you :)

pauldambra avatar Jul 11 '24 21:07 pauldambra