feat(core): Respect Mask boundaries when reading sentry-label#6142
Merged
Conversation
…ch breadcrumbs Skip sentry-label when maskAllText is enabled or the touched element is inside a RNSentryReplayMask ancestor, preventing masked text content from leaking into breadcrumbs. Fallback labels (accessibilityLabel, testID) still work. Also skips text extraction from children inside Mask ancestors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
Contributor
|
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 615b359. Configure here.
This was referenced May 13, 2026
3 tasks
antonis
added a commit
to getsentry/sentry-docs
that referenced
this pull request
May 21, 2026
) ## DESCRIBE YOUR PR Documents new touch breadcrumb label features in the React Native SDK (v8.12.0): - **Automatic `sentry-label` injection** — build-time label injection from static text via the Babel plugin, enabled by default with `annotateReactComponents` ([sentry-react-native#6141](getsentry/sentry-react-native#6141)) - **Runtime text extraction from children** — `extractTextFromChildren` prop extracts text from child fiber nodes as a label fallback ([sentry-react-native#6106](getsentry/sentry-react-native#6106)) - **Session Replay masking interaction** — `sentry-label` and text extraction respect `maskAllText` and `Sentry.Mask` boundaries ([sentry-react-native#6142](getsentry/sentry-react-native#6142)) - **Updated label priority chain** — now 6 steps including text extraction and masking notes ### Files changed - `docs/platforms/react-native/configuration/touchevents.mdx` — new h2 sections for automatic label injection, text extraction, masking interaction; updated label priority; added `extractTextFromChildren` to options - `docs/platforms/react-native/integrations/component-names.mdx` — new section for `autoInjectSentryLabel` with disable examples Closes getsentry/sentry-react-native#6113 ## IS YOUR CHANGE URGENT? - [ ] Urgent deadline (GA date, etc.) - [ ] Other deadline - [x] None: Not urgent, can wait up to 1 week+⚠️ Should be merged after the above implementation is shipped in 8.12.0 ## PRE-MERGE CHECKLIST - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📢 Type of change
📜 Description
When Session Replay masking is active,
sentry-labelvalues may contain text derived from component content (viaautoInjectSentryLabelfrom the Babel plugin). This PR ensures those labels are not leaked into touch breadcrumbs when:maskAllTextis enabled (the default whenmobileReplayIntegrationis present) —sentry-labelis skipped entirely.Sentry.Maskboundary —sentry-labeland text extraction from children are both skipped.Fallback labels (
accessibilityLabel,aria-label,testID, customlabelName) continue to work in all cases, since they are developer-provided identifiers rather than user-visible text content.Implementation details
_isMaskAllTextEnabled()from the existing_shouldExtractText()method for reuse.hasAncestorMask()to traverse the fiber tree upward and detectRNSentryReplayMaskancestors.getLabelValue()to accept areadSentryLabelflag that gates thesentry-labellookup.getTouchedComponentInfo()to pass the mask state through.💡 Motivation and Context
Closes #6114
With
autoInjectSentryLabelenabled by default (PR #6141), the Babel plugin injectssentry-labelprops derived from static text content. Without this change, masked text would leak into breadcrumbs viasentry-label, defeating the purpose of replay masking.💚 How did you test it?
sentry-labelskipped whenmaskAllTextis enabledsentry-labelskipped whenmaskAllTextdefaults to truesentry-labelread whenmaskAllTextis explicitly falsesentry-labelskipped insideRNSentryReplayMaskancestor (name and displayName)sentry-labelread when no replay integration is presentmaskAllTextis already enabled📝 Checklist
sendDefaultPIIis enabled🔮 Next steps