rrweb icon indicating copy to clipboard operation
rrweb copied to clipboard

[Feature Request]: ability to mask attributes

Open pauldambra opened this issue 1 year ago • 5 comments

Preflight Checklist

  • [X] I have searched the issue tracker for a feature request that matches the one I want to file, without success.

What package is this feature request for?

rrweb

Problem Description

see https://posthog.com/questions/scrubbing-html-attributes-from-dom-in-session-recordings

where a customer asks us for the ability to mask the content of an element's attribute - in that case aria-label might contain PII and they'd like to ensure it isn't captured

we can mask an element's text or an input's value

i believe it isn't possible to mask an element's attribute

Proposed Solution

addition of a function maskElement(element: Element) => Element | null

this would run ahead of other processing of a node and let you carry out arbitrary masking for this case you could iterate and mask attributes in practice it lets you carry out arbitrary alteration of the element

Alternatives Considered

if arbitrary alterations of the captured element are undesirable

then add a maskAttributes(attributes: SomeType[]) => SomeType[] | null

Additional Information

No response

pauldambra avatar Oct 09 '24 17:10 pauldambra