Repository navigation
fix: mask maskView views and secure fields in bug report screenshots and replays - #55
Open
boehlerlukas wants to merge 2 commits into
Open
boehlerlukas wants to merge 2 commits into
boehlerlukas wants to merge 2 commits into
Conversation
…and replays Gleap.maskView (and the automatic password / card / one-time-code masks and FLAG_SECURE) only applied to capture requests (GleapWindowCapture). Bug report screenshots, silent bug report screenshots and app replay frames all come from ScreenshotUtil, which copied or drew the window unmasked. ScreenshotUtil now paints the same masks (GleapWindowCapture.windowMasks), taken when the copy starts and when it finishes; a screenshot whose masks cannot be worked out is dropped (null), as capture frames are. setActivationMethods cleared every detector, the app replays included, and only rebuilt shake / screenshot: replays stopped when it was called after the config loaded. The replays detector is now recreated as after the config load. GleapActivationMethod documents that THREE_FINGER_DOUBLE_TAB and FAB do nothing on Android and that NONE alone turns the activation methods off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A frame still being taken (PixelCopy is async) when the old ReplaysDetector is unregistered re-posted its loop, so the restart in setActivationMethods could leave two loops running. Late frames no longer re-post after pause/unregister, and resume never stacks a second loop. Co-Authored-By: Claude Opus 5.5 <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.
What this fixes
1. Help-center audit finding 26 (high, privacy):
Gleap.maskViewdid not mask bug report screenshots or app replays.maskView, the automatic password / card / one-time-code masks andFLAG_SECUREwere only applied byGleapWindowCapture, which handles capture requests. Bug report screenshots (ScreenshotTaker), silent bug report screenshots (SilentBugReportUtil) and app replay frames (ReplaysDetector) all go throughScreenshotUtil.takeScreenshot. That path copied the window with PixelCopy, or drew it, with no masks at all.Fix:
ScreenshotUtilnow paints the same masks on every path:GetBitmapCallbackpicture (Flutter), with the masks scaled onto itIt uses a new
GleapWindowCapture.windowMasks/drawMasks, which reuses the capture code'sscan(masked views plusisSensitive), its 8 dp padding and itsFLAG_SECURErule (the whole window goes black). If the masks cannot be worked out (for example a window with too many views), no screenshot is delivered (null), the same as a dropped capture frame.2. Finding 24:
setActivationMethodsafter the config loaded stopped app replays.Gleap.setActivationMethodscalledclearAllDetectors(), which also unregisters theReplaysDetector, and then rebuilt only shake and screenshot. Now, when the config has loaded and replays are on, it creates the replays detector again, the same wayGleapInitializer.initGleapdoes.3. Finding 24 (rest):
THREE_FINGER_DOUBLE_TABandFABdo nothing on Android.GleapDetectorUtil.initDetectorsonly builds detectors forSHAKEandSCREENSHOT. This PR documents that on the enum:THREE_FINGER_DOUBLE_TABis unsupported,FABis replaced by the dashboard setting orshowFeedbackButton(boolean), andNONEalone turns activation off. Behaviour is unchanged.Verified
./gradlew build(JDK: Android Studio JBR): BUILD SUCCESSFUL. That covers the unit tests, lint and assembling the app and the library../gradlew :gleap:connectedDebugAndroidTeston theMedium_Phone_API_36.1emulator: 7/7 passed (the 6 existing e2e tests plus the new one).ScreenshotMaskingE2ETest(privacy / sanitising, so it gets a test per the workspace rule). It runs the realScreenshotUtil.takeScreenshotagainst the fake server and checks pixels: theGleap.maskViewview and the password field come out black, and the plain view stays red. I checked that it fails onmaster(expected:<-16777216> but was:<-65536>) and passes with the fix.Notes
maskView, password / card / one-time-code fields andFLAG_SECUREwindows are now masked in bug report screenshots and app replays too; callingsetActivationMethodsafter start no longer stops app replays."Not fixed (needs decision / out of scope)
THREE_FINGER_DOUBLE_TAB/FABis an API decision.setActivationMethodswhile the widget is open resumes the detectors (resumeAllDetectorssetswidgetOpen=false). This existed before; I left it alone.NONEmeans none. The Flutter and RN bridges now sendNONEfor an empty list.🤖 Generated with Claude Code