Skip to content

feat: honor remote session replay masking flags on mobile - #753

Merged
ioannisj merged 10 commits into
mainfrom
feat/replay-remote-masking-config
Dec 2, 2026
Merged

ioannisj merged 10 commits into
mainfrom
feat/replay-remote-masking-config

Conversation

@ioannisj

@ioannisj ioannisj commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Fixes #492

Session replay masking in Flutter came only from local Dart config, so the masking flags the project settings send for mobile (sessionRecording.masking.mobile) had no effect. This makes the plugin honor them: a server value of true turns on masking for text and images in Flutter content, and a local true is never turned off. The native SDKs resolve the flags, and the plugin reads them back on every capture tick and again right before it sends a frame. If a flag turned on in between, the frame is dropped and a new one is captured. A flag turning off, or native returning no value, doesn't loosen masking for a frame that's already in flight.

Spec: PostHog/sdk-specs#247. Native halves: PostHog/posthog-ios#1124 and PostHog/posthog-android#1008.

This needs posthog-ios 4.2.0 and posthog-android 4.2.0, so the minimums are raised to those versions in Package.swift and build.gradle.

The project setting works like setting maskAllTexts or maskAllImages to true in sessionReplayConfig. When a textMaskPolicy is set, it still decides which text gets masked.

💚 How did you test it?

  • flutter test in posthog_flutter passes, including new tests for native-only masking flags, for dropping frames captured before a flag reset, and for a flag that turns on between capture and send.
  • flutter analyze and dart format are clean.
  • The native builds and the Kotlin unit tests run in CI against the published 4.2.0.

📝 Checklist

  • All commits are signed (see Commit signing)
  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm changeset to generate a changeset file

🤖 Agent context

DRI: @ioannisj
Autonomy: Human-driven (agent-assisted)

@ioannisj ioannisj self-assigned this Nov 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

posthog-flutter Compliance Report

Date: 2026-12-02T09:54:00.184760+00:00
Duration: 371624ms

✅ All Tests Passed!

232/232 tests passed


Capture_V1 Tests

✅ 105/105 tests passed

View Details
Test Status Duration
Endpoint And Method.Targets V1 Endpoint ✅ 251ms
Endpoint And Method.Does Not Use Legacy Endpoints ✅ 133ms
Required Headers.Has Authorization Bearer Header ✅ 123ms
Required Headers.Has Content Type Json ✅ 126ms
Required Headers.Has Posthog Sdk Info Format ✅ 121ms
Required Headers.Has Posthog Attempt Header ✅ 121ms
Required Headers.Has Posthog Request Id ✅ 122ms
Required Headers.Has Posthog Request Timestamp ✅ 121ms
Required Headers.Has User Agent ✅ 121ms
Body Format.Body Has Created At And Batch ✅ 121ms
Body Format.No Api Key In Body ✅ 121ms
Body Format.No Sent At In Body ✅ 121ms
Event Format.Event Has Required Root Fields ✅ 121ms
Event Format.Event Uuid Is Valid ✅ 123ms
Event Format.Event Timestamp Is Rfc3339 ✅ 123ms
Event Format.Non Utc Event Timestamp Is Converted To Utc ✅ 123ms
Event Format.Distinct Id Is String ✅ 123ms
Event Format.Distinct Id At Root Not Properties ✅ 123ms
Event Format.Custom Properties Preserved ✅ 122ms
Event Format.Set Properties Preserved ✅ 124ms
Event Format.Set Once Properties Preserved ✅ 119ms
Event Format.Groups Properties Preserved ✅ 119ms
Event Format.Sdk Generates Uuid If Not Provided ✅ 119ms
Event Format.Event Has Required Root Fields Batch ✅ 124ms
Event Format.Event Uuid Is Valid Batch ✅ 125ms
Event Format.Event Timestamp Is Rfc3339 Batch ✅ 124ms
Event Format.Distinct Id Is String Batch ✅ 125ms
Event Format.Distinct Id At Root Not Properties Batch ✅ 124ms
Event Format.Custom Properties Preserved Batch ✅ 124ms
Event Format.Set Properties Preserved Batch ✅ 130ms
Event Format.Set Once Properties Preserved Batch ✅ 125ms
Event Format.Groups Properties Preserved Batch ✅ 123ms
Event Format.Sdk Generates Uuid If Not Provided Batch ✅ 124ms
Batch Behavior.Multiple Events In Single Batch ✅ 132ms
Batch Behavior.Batch Envelope Smoke ✅ 128ms
Batch Behavior.Flush With No Events Sends Nothing ✅ 110ms
Batch Behavior.Flush At Triggers Batch ✅ 1017ms
Batch Behavior.Created At Reflects Batch Creation Time ✅ 119ms
Deduplication.Generates Unique Uuids ✅ 128ms
Deduplication.Different Events Same Content Different Uuids ✅ 125ms
Deduplication.Preserves Uuid On Retry ✅ 5127ms
Deduplication.Preserves Timestamp On Retry ✅ 5124ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 5126ms
Deduplication.No Duplicate Events In Batch ✅ 131ms
Header Behavior On Retry.Attempt Header Starts At One ✅ 117ms
Header Behavior On Retry.Attempt Header Increments On Retry ✅ 10129ms
Header Behavior On Retry.Request Id Preserved On Retry ✅ 5133ms
Header Behavior On Retry.Different Requests Have Different Request Ids ✅ 2235ms
Header Behavior On Retry.Request Timestamp Changes On Retry ✅ 5120ms
Response Format Validation.Success Response Has Uuid Keyed Results ✅ 118ms
Response Format Validation.Success Response Has Ok For Each Event ✅ 126ms
Response Format Validation.Success No Retry After When All Ok ✅ 124ms
Response Format Validation.Success Retry After Present When Retry Events ✅ 125ms
Response Format Validation.Success No Retry After When Drop Only ✅ 124ms
Response Format Validation.Response Echoes Request Id ✅ 119ms
Retry Behavior.Retries On 408 ✅ 5125ms
Retry Behavior.Retries On 500 ✅ 5125ms
Retry Behavior.Retries On 503 ✅ 5124ms
Retry Behavior.Retries On 504 ✅ 5122ms
Retry Behavior.Retries On 404 ✅ 5125ms
Retry Behavior.Retries On 429 ✅ 5124ms
Retry Behavior.Retries On 502 ✅ 5124ms
Retry Behavior.Retryable Errors Have Retry After ✅ 2121ms
Retry Behavior.Respects Retry After On Retryable Error ✅ 8126ms
Retry Behavior.Does Not Retry On 400 ✅ 2123ms
Retry Behavior.Does Not Retry On 401 ✅ 2120ms
Retry Behavior.Does Not Retry On 402 ✅ 2121ms
Retry Behavior.Does Not Retry On 413 ✅ 2122ms
Retry Behavior.Does Not Retry On 415 ✅ 2120ms
Retry Behavior.Non Retryable Errors Have No Retry After ✅ 2120ms
Retry Behavior.Implements Backoff ✅ 12120ms
Partial Batch Handling.Handles 200 Full Success ✅ 2123ms
Partial Batch Handling.Handles 200 With All Ok ✅ 3128ms
Partial Batch Handling.Does Not Retry Dropped Events ✅ 3127ms
Partial Batch Handling.Does Not Retry Warning Events ✅ 3124ms
Partial Batch Handling.Prunes Ok Events On Partial Retry ✅ 5127ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry ✅ 5128ms
Partial Batch Handling.Retries Only Retry Events From Partial ✅ 5130ms
Partial Batch Handling.Partial Retry Preserves Uuids ✅ 5127ms
Partial Batch Handling.Partial Retry Attempt Header Increments ✅ 5128ms
Partial Batch Handling.Partial Retry Request Id Preserved ✅ 5126ms
Partial Batch Handling.Respects Retry After On Partial ✅ 5127ms
Partial Batch Handling.Unknown Result Treated As Terminal ✅ 3125ms
Partial Batch Handling.Mixed Ok Drop Warning No Retry ✅ 3129ms
Compression.Sends Gzip Content Encoding ✅ 123ms
Compression.No Content Encoding When Disabled ✅ 116ms
Compression.Compressed Body Is Decompressible ✅ 118ms
Error Handling.Does Not Retry On Unknown 4Xx ✅ 2120ms
Event Options.Cookieless Mode Override ✅ 119ms
Event Options.Disable Skew Correction Override ✅ 117ms
Event Options.Process Person Profile Override ✅ 117ms
Event Options.Product Tour Id Override ✅ 117ms
Event Options.Unset Options Omitted ✅ 117ms
Event Options.Options Override In Batch ✅ 122ms
Event Options.Unknown Option Passes Through ✅ 117ms
Event Options.Option Value Is Not Converted ✅ 116ms
Event Options.Lenient Bool Option Values Are Not Converted ✅ 118ms
Event Options.Option Wins Over Legacy Property ✅ 117ms
Event Options.Legacy Property Fills Unset Option ✅ 118ms
Event Options.Null Option Falls Back To Legacy Property ✅ 116ms
Property Layers.Caller Property Beats Registered Property ✅ 116ms
Property Layers.Before Send Runs Last ✅ 119ms
Fail Open.Empty Api Key Sends Nothing ✅ 1112ms
Fail Open.Personal Api Key Sends Nothing ✅ 1112ms
Geoip And Historical Migration.Historical Migration Absent By Default ✅ 118ms

Capture_Ai_V1 Tests

✅ 110/110 tests passed

View Details
Test Status Duration
Endpoint And Method.Targets V1 Endpoint ✅ 119ms
Endpoint And Method.Does Not Use Legacy Endpoints ✅ 117ms
Endpoint And Method.Capture Does Not Reroute Ai Named Events ✅ 117ms
Endpoint And Method.Capture Ai Does Not Reroute Non Ai Events ✅ 117ms
Lane Isolation.Failing Ai Lane Does Not Delay Analytics ✅ 5137ms
Required Headers.Has Authorization Bearer Header ✅ 117ms
Required Headers.Has Content Type Json ✅ 117ms
Required Headers.Has Posthog Sdk Info Format ✅ 117ms
Required Headers.Has Posthog Attempt Header ✅ 117ms
Required Headers.Has Posthog Request Id ✅ 117ms
Required Headers.Has Posthog Request Timestamp ✅ 116ms
Required Headers.Has User Agent ✅ 116ms
Body Format.Body Has Created At And Batch ✅ 116ms
Body Format.No Api Key In Body ✅ 117ms
Body Format.No Sent At In Body ✅ 117ms
Event Format.Event Has Required Root Fields ✅ 116ms
Event Format.Event Uuid Is Valid ✅ 116ms
Event Format.Event Timestamp Is Rfc3339 ✅ 116ms
Event Format.Non Utc Event Timestamp Is Converted To Utc ✅ 116ms
Event Format.Distinct Id Is String ✅ 117ms
Event Format.Distinct Id At Root Not Properties ✅ 117ms
Event Format.Custom Properties Preserved ✅ 117ms
Event Format.Set Properties Preserved ✅ 116ms
Event Format.Set Once Properties Preserved ✅ 117ms
Event Format.Groups Properties Preserved ✅ 118ms
Event Format.Sdk Generates Uuid If Not Provided ✅ 118ms
Event Format.Event Has Required Root Fields Batch ✅ 123ms
Event Format.Event Uuid Is Valid Batch ✅ 122ms
Event Format.Event Timestamp Is Rfc3339 Batch ✅ 121ms
Event Format.Distinct Id Is String Batch ✅ 122ms
Event Format.Distinct Id At Root Not Properties Batch ✅ 122ms
Event Format.Custom Properties Preserved Batch ✅ 121ms
Event Format.Set Properties Preserved Batch ✅ 121ms
Event Format.Set Once Properties Preserved Batch ✅ 121ms
Event Format.Groups Properties Preserved Batch ✅ 122ms
Event Format.Sdk Generates Uuid If Not Provided Batch ✅ 122ms
Batch Behavior.Multiple Events In Single Batch ✅ 126ms
Batch Behavior.Batch Envelope Smoke ✅ 124ms
Batch Behavior.Flush At Triggers Batch ✅ 1015ms
Batch Behavior.Created At Reflects Batch Creation Time ✅ 116ms
Deduplication.Generates Unique Uuids ✅ 127ms
Deduplication.Different Events Same Content Different Uuids ✅ 121ms
Deduplication.Preserves Uuid On Retry ✅ 5122ms
Deduplication.Preserves Timestamp On Retry ✅ 5119ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 5128ms
Deduplication.No Duplicate Events In Batch ✅ 127ms
Header Behavior On Retry.Attempt Header Starts At One ✅ 118ms
Header Behavior On Retry.Attempt Header Increments On Retry ✅ 10127ms
Header Behavior On Retry.Request Id Preserved On Retry ✅ 5123ms
Header Behavior On Retry.Different Requests Have Different Request Ids ✅ 2235ms
Header Behavior On Retry.Request Timestamp Changes On Retry ✅ 5123ms
Response Format Validation.Success Response Has Uuid Keyed Results ✅ 119ms
Response Format Validation.Success Response Has Ok For Each Event ✅ 122ms
Response Format Validation.Success No Retry After When All Ok ✅ 120ms
Response Format Validation.Success Retry After Present When Retry Events ✅ 120ms
Response Format Validation.Success No Retry After When Drop Only ✅ 120ms
Response Format Validation.Response Echoes Request Id ✅ 116ms
Retry Behavior.Retries On 408 ✅ 5119ms
Retry Behavior.Retries On 500 ✅ 5124ms
Retry Behavior.Retries On 503 ✅ 5123ms
Retry Behavior.Retries On 504 ✅ 5125ms
Retry Behavior.Retries On 404 ✅ 5123ms
Retry Behavior.Retries On 429 ✅ 5123ms
Retry Behavior.Retries On 502 ✅ 5123ms
Retry Behavior.Retryable Errors Have Retry After ✅ 2121ms
Retry Behavior.Respects Retry After On Retryable Error ✅ 8127ms
Retry Behavior.Does Not Retry On 400 ✅ 2121ms
Retry Behavior.Does Not Retry On 401 ✅ 2121ms
Retry Behavior.Does Not Retry On 402 ✅ 2120ms
Retry Behavior.Does Not Retry On 413 ✅ 2121ms
Retry Behavior.Does Not Retry On 415 ✅ 2121ms
Retry Behavior.Non Retryable Errors Have No Retry After ✅ 2121ms
Retry Behavior.Implements Backoff ✅ 12131ms
Partial Batch Handling.Handles 200 Full Success ✅ 2120ms
Partial Batch Handling.Handles 200 With All Ok ✅ 3133ms
Partial Batch Handling.Does Not Retry Dropped Events ✅ 3128ms
Partial Batch Handling.Does Not Retry Warning Events ✅ 3123ms
Partial Batch Handling.Prunes Ok Events On Partial Retry ✅ 5125ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry ✅ 5125ms
Partial Batch Handling.Retries Only Retry Events From Partial ✅ 5128ms
Partial Batch Handling.Partial Retry Preserves Uuids ✅ 5125ms
Partial Batch Handling.Partial Retry Attempt Header Increments ✅ 5126ms
Partial Batch Handling.Partial Retry Request Id Preserved ✅ 5129ms
Partial Batch Handling.Respects Retry After On Partial ✅ 5122ms
Partial Batch Handling.Unknown Result Treated As Terminal ✅ 3123ms
Partial Batch Handling.Mixed Ok Drop Warning No Retry ✅ 3129ms
Compression.Sends Gzip Content Encoding ✅ 117ms
Compression.No Content Encoding When Disabled ✅ 116ms
Compression.Compressed Body Is Decompressible ✅ 116ms
Error Handling.Does Not Retry On Unknown 4Xx ✅ 2119ms
Event Options.Cookieless Mode Override ✅ 117ms
Event Options.Disable Skew Correction Override ✅ 117ms
Event Options.Process Person Profile Override ✅ 116ms
Event Options.Product Tour Id Override ✅ 116ms
Event Options.Unset Options Omitted ✅ 116ms
Event Options.Options Override In Batch ✅ 122ms
Event Options.Unknown Option Passes Through ✅ 116ms
Event Options.Option Value Is Not Converted ✅ 116ms
Event Options.Lenient Bool Option Values Are Not Converted ✅ 116ms
Event Options.Option Wins Over Legacy Property ✅ 116ms
Event Options.Legacy Property Fills Unset Option ✅ 116ms
Event Options.Null Option Falls Back To Legacy Property ✅ 116ms
Event Size.Event Over Ceiling Is Not Sent ✅ 4284ms
Event Size.Over Ceiling Drop Is Reported Or Logged Without Content ✅ 2197ms
Event Size.Batches Close Before Byte Target ✅ 6395ms
Geoip And Historical Migration.Historical Migration Absent By Default ✅ 119ms
Property Layers.Caller Property Beats Registered Property ✅ 117ms
Property Layers.Before Send Runs Last ✅ 120ms
Fail Open.Empty Api Key Sends Nothing ✅ 1113ms
Fail Open.Personal Api Key Sends Nothing ✅ 1112ms

Feature_Flags Tests

✅ 17/17 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id ✅ 26ms
Request Payload.Flags Request Uses V2 Query Param ✅ 19ms
Request Payload.Flags Request Hits Flags Path Not Decide ✅ 15ms
Request Payload.Flags Request Omits Authorization Header ✅ 14ms
Request Payload.Token In Flags Body Matches Init ✅ 15ms
Request Payload.Groups Round Trip ✅ 15ms
Request Payload.Groups Default To Empty Object ✅ 14ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False ✅ 14ms
Request Payload.Disable Geoip Omitted Defaults To False ✅ 14ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key ✅ 13ms
Request Lifecycle.No Flags Request On Init Alone ✅ 6ms
Request Lifecycle.No Flags Request On Normal Capture ✅ 117ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests ✅ 23ms
Request Lifecycle.Mock Response Value Is Returned To Caller ✅ 15ms
Retry Behavior.Retries Flags On 502 ✅ 329ms
Retry Behavior.Retries Flags On 504 ✅ 320ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event ✅ 124ms

@posthog

posthog Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

PostHog Review · Deep · reviewed 3619288

Nothing to post.

Step Status Result
Prepare the diff done 18 files, 1 chunk
Pick perspectives done 3 perspectives
Run review passes done 1 issue
Merge overlapping findings done 1 → 1
Validate findings done 0 kept, 1 dismissed
Publish done Nothing to post

A happy dog on a sunny path

@ioannisj
ioannisj marked this pull request as ready for review December 2, 2026 09:57
@ioannisj
ioannisj requested a review from a team as a code owner December 2, 2026 09:57
@veria-ai

veria-ai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Fixed/addressed: 1 · PR risk: 0/10

Reviews

@marandaneto marandaneto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good; no qualifying findings. Verdict: correct.

@ioannisj
ioannisj merged commit 63f0bbc into main Dec 2, 2026
29 checks passed
@ioannisj
ioannisj deleted the feat/replay-remote-masking-config branch December 2, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session replay: apply remote (server-side) masking config

2 participants