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:
Currently
sentry-labelis read unconditionally as the #1 priority in the label fallback chain (getLabelValueintouchevents.tsx). This means text content fromsentry-labelappears in touch breadcrumbs even when the component is inside aSentry.Maskboundary or whenmaskAllTextis enabled.This becomes a concern with #6098 (auto-inject
sentry-labelfrom static JSX text children in Babel plugin), wheresentry-labelvalues will be auto-generated from visible text content. Text that Session Replay masks in the UI could leak into breadcrumbs via the auto-injectedsentry-label.Proposed approach:
During the upward fiber tree traversal in
_onTouchStart, check if any ancestor is aRNSentryReplayMaskcomponent. If so, skip thesentry-labelvalue for that component. This is consistent with how runtime text extraction (#6097) already respects Mask boundaries.Also consider skipping
sentry-labelentirely whenmaskAllTextis enabled, similar to how_shouldExtractText()already works for runtime text extraction.Trade-off: Users who deliberately place
sentry-labelinside 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_onTouchStartorgetTouchedComponentInfoRelated:
sentry-labelfrom static JSX text children in Babel plugin #6098: Babel plugin auto-injectssentry-labelfrom static text children