feat(core): Respect Mask boundaries when reading sentry-label#6142
Open
antonis wants to merge 1 commit into
Open
feat(core): Respect Mask boundaries when reading sentry-label#6142antonis wants to merge 1 commit into
antonis wants to merge 1 commit into
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 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