Skip to main content

[JavaScript] Why isn't maskAttributes masking my Session Replay attributes?

Issue

I configured maskAttributes for Session Replay, but attribute values such as aria-label still appear unmasked in my replays.

Applies To

  • All SaaS Customers and Self-Hosted Users

  • JavaScript SDK

  • Session Replay

Resolution

maskAttributes masks the listed HTML attribute names during Session Replay recording. The default list is title, placeholder, and aria-label. Listed attributes are masked even when maskAllText is false.

If an attribute still appears in the replay:

  1. Confirm the attribute name is in maskAttributes. Add it if it is missing from the default list.

  2. Confirm the element is not matched by an unmask selector (or sentry-unmask / data-sentry-unmask). Unmask takes precedence.

  3. Record a new replay after the config change. Older replays keep the privacy settings from when they were recorded.

Example:

Sentry.replayIntegration({
  maskAttributes: ["title", "placeholder", "aria-label", "data-user-email"],
});

maskAllText still controls text-node masking and can also mask value on submit/button inputs when value is not listed in maskAttributes. It is not required for named attributes in maskAttributes.

For the full privacy option set, see Session Replay Privacy.

Did this answer your question?