fix(replay): web canvas masking keeps an app-provided maskRegionsFn for non-Flutter canvases - #508
Merged
Merged
Conversation
|
Reviews (1): Last reviewed commit: "fix(replay): keep the app's maskRegionsF..." | Re-trigger Greptile |
Contributor
posthog-flutter Compliance ReportDate: 2026-07-30 16:13:39 UTC ✅ All Tests Passed!45/45 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 16/16 tests passed View Details
|
dustinbyrne
approved these changes
Jul 30, 2026
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.

💡 Motivation and Context
Follow-up to greptile's security note on #507 about code merged in #499: opting into web canvas masking unconditionally replaces
session_recording.canvasCapture.maskRegionsFnwith the provider's own callback, and the provider answers[]for any canvas outside a flutter-view. On a hybrid page whose originalmaskRegionsFnmasked its own (non-Flutter) canvases, those canvases were recorded unmasked — the app's masking was silently dropped.Now the provider captures the app's callback once, before the first
set_configreplaces it, and delegates canvases outside every flutter-view back to it. Its own flutter-view canvas keeps the widget-tree answer, a foreign flutter-view canvas still fails closed, and a throwing app callback fails closed too. One documented caveat: js_interop conflatesundefinedandnullon the way back through Dart, so an app answer ofundefined(record unmasked) is coerced to the fail-closednull— over-masking, never a leak.💚 How did you test it?
nullkept, a throwing callback fails closed, and a secondsetup()does not re-capture the provider's own installed callback (which would recurse).flutter analyzeanddart formatclean.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
main). Verified the leak path before fixing:_unsafeComputeMaskRegionsreturned[]for host-less canvases, which posthog-js treats as "answered, zero regions".setup()from capturing the provider's own installed callback —toJSwrapper identity is not reliable across compilers.