Repository navigation
feat(android): Mask screenshots by default - #6437
Conversation
|
📲 Install BuildsAndroid
|
| * #setMaskAllText(boolean)} and/or {@link #setMaskAllImages(boolean)} with {@code false}. | ||
| * | ||
| * <p>Note: Screenshot masking requires the {@code sentry-android-replay} module to be present at | ||
| * runtime. If masking is enabled but the replay module is not available, no screenshot is captured |
There was a problem hiding this comment.
oh, wait this is a deal-breaker, right? Basically whoever is not using replay now, will stop getting screenshots once they bump to v9 🙈
There was a problem hiding this comment.
ah I see we mention in the changelog... On a second thought it's probably fine, that's why it goes into a new major. So customers would have to explicitly "opt-in" for screenshots without masking.
Junior estimated around 30-40 orgs that would stop receiving screenshots in v9 because of this, which is fine given we'll have the migration guide I think.
What do you think of maybe logging the warning with a options.getFatalLogger() to bypass the options.debug flag in ScreenshotUtils:89 when we found such misconfiguration (masking on, but no replay module)?
romtsn
left a comment
There was a problem hiding this comment.
Approving, but left one suggestion which I think is worth doing (changing the logger in ScreenshotUtils)
Error and user feedback screenshots now mask all text and images by default, matching Session Replay. The manifest reader defaulted the screenshot masking keys to false, which would have undone the new default, so it now defaults them to true like the replay keys. Masking needs sentry-android-replay at runtime. Apps that depend on sentry-android-core alone and attach screenshots now get no screenshot until they add the replay module or turn masking off. Refs JAVA-502 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c72358a to
8ba018e
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8ba018e. Configure here.
ScreenshotEventProcessor checks for the missing replay module itself and returns before captureMaskedScreenshot, so the warning was still gated on options.debug for native errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

📜 Description
Error screenshots and user feedback screenshots now mask all text and images by default, matching Session Replay.
SentryScreenshotOptionsturns onmaskAllTextandmaskAllImagesin its constructor.maskAllImagesalso masksWebView,VideoViewand the media player views.ManifestMetadataReaderused to set both options tofalsewhenio.sentry.screenshot.mask-all-textandio.sentry.screenshot.mask-all-imageswere missing, which would have undone the new default. It now defaults them totrue, like the session replay keys.Opt out with
options.screenshot.setMaskAllText(false)/setMaskAllImages(false), or the manifest keys above set tofalse.Note: masking needs
sentry-android-replayat runtime. If masking is configured and the replay module is missing,ScreenshotEventProcessorskips the screenshot instead of attaching an unmasked one.sentry-androidincludes replay, so this only affects apps that depend onsentry-android-coredirectly and useattachScreenshot. Those apps now get no screenshot until they addsentry-android-replayor turn masking off.💡 Motivation and Context
Screenshots can contain PII. Masking by default makes the safe choice the default, as on iOS.
💚 How did you test it?
SentryScreenshotOptionsandManifestMetadataReadersentry-android-corescreenshot, feedback and manifest unit tests📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps