Skip to content

Respect Mask boundaries when reading sentry-label for touch breadcrumbs #6114

@antonis

Description

@antonis

Currently sentry-label is read unconditionally as the #1 priority in the label fallback chain (getLabelValue in touchevents.tsx). This means text content from sentry-label appears in touch breadcrumbs even when the component is inside a Sentry.Mask boundary or when maskAllText is enabled.

This becomes a concern with #6098 (auto-inject sentry-label from static JSX text children in Babel plugin), where sentry-label values will be auto-generated from visible text content. Text that Session Replay masks in the UI could leak into breadcrumbs via the auto-injected sentry-label.

Proposed approach:

During the upward fiber tree traversal in _onTouchStart, check if any ancestor is a RNSentryReplayMask component. If so, skip the sentry-label value for that component. This is consistent with how runtime text extraction (#6097) already respects Mask boundaries.

Also consider skipping sentry-label entirely when maskAllText is enabled, similar to how _shouldExtractText() already works for runtime text extraction.

Trade-off: Users who deliberately place sentry-label inside a Mask boundary would lose that label. This seems like the correct default — if content is masked, its label shouldn't leak via breadcrumbs.

Files to change:

  • packages/core/src/js/touchevents.tsx — add Mask ancestor check in _onTouchStart or getTouchedComponentInfo

Related:

Metadata

Metadata

Assignees

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions