Commit 4299d1e
authored
feat(android): update session replay masking precedence rules (#518)
## Summary
Changes Android semantics to match iOS when applying session replay
masking precedence rules.
This changes existing masking behavior, but should be clearer than the
previous behavior. Please see the README changes for details.
## How did you test this change?
Unit tests added.
## Are there any deployment considerations?
N/A
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes core session replay privacy behavior by introducing explicit
mask/unmask precedence and propagation, which could affect what gets
redacted in recordings. Risk is mitigated by added unit tests but still
impacts sensitive-data handling paths.
>
> **Overview**
> Aligns Android session replay masking with a new **explicit precedence
model**: *explicit mask* (including `ldMask()` and `maskXMLViewIds`)
propagates to descendants and overrides everything, *explicit unmask*
(`ldUnmask()`) propagates but cannot override an explicit mask, and
*global privacy rules* (e.g. `maskTextInputs`, `maskText`,
`maskWebViews`) only apply when no explicit signal exists.
>
> Implements this by splitting `PrivacyProfile` matchers into
`explicitMaskMatchers` vs `globalMaskMatchers`, extending `MaskTarget`
with `hasLDUnmask`, updating `MaskCollector` traversal to carry
inherited explicit state, and wiring `ImageCaptureService` to pass both
matcher sets. Adds focused tests for the new precedence rules and
updates docs/comments to match; the React Native adapter also switches
Observability logging to `LDObserveLogging.adapter()`.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
d7e05f1. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent e1189e4 commit 4299d1e
12 files changed
Lines changed: 389 additions & 75 deletions
File tree
- sdk/@launchdarkly
- observability-android
- lib/src
- main/kotlin/com/launchdarkly/observability
- api
- replay
- capture
- masking
- test/kotlin/com/launchdarkly/observability/replay
- masking
- react-native-ld-session-replay/android/src/main/java/com/sessionreplayreactnative
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
247 | 260 | | |
248 | 261 | | |
249 | 262 | | |
| |||
322 | 335 | | |
323 | 336 | | |
324 | 337 | | |
325 | | - | |
| 338 | + | |
326 | 339 | | |
327 | 340 | | |
328 | 341 | | |
| |||
348 | 361 | | |
349 | 362 | | |
350 | 363 | | |
351 | | - | |
| 364 | + | |
352 | 365 | | |
353 | 366 | | |
354 | 367 | | |
| |||
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
Lines changed: 34 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | 52 | | |
69 | 53 | | |
70 | 54 | | |
| |||
140 | 124 | | |
141 | 125 | | |
142 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
143 | 161 | | |
144 | 162 | | |
145 | 163 | | |
| |||
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
178 | | - | |
| 179 | + | |
179 | 180 | | |
180 | 181 | | |
181 | 182 | | |
182 | 183 | | |
183 | 184 | | |
184 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
185 | 188 | | |
186 | 189 | | |
187 | 190 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
92 | 96 | | |
93 | 97 | | |
94 | 98 | | |
| |||
0 commit comments