feat(replay): add sensitive content widget to default masking - #2989
feat(replay): add sensitive content widget to default masking#2989buenaflor wants to merge 29 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2989 +/- ##
==========================================
+ Coverage 87.02% 89.21% +2.19%
==========================================
Files 134 99 -35
Lines 4964 3423 -1541
==========================================
- Hits 4320 3054 -1266
+ Misses 644 369 -275 ☔ View full report in Codecov by Sentry. |
iOS Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 6b69699 | 1254.80 ms | 1273.31 ms | 18.52 ms |
| 9b99523 | 1256.06 ms | 1270.33 ms | 14.27 ms |
| cba2765 | 1247.39 ms | 1246.96 ms | -0.43 ms |
| 2cb90b9 | 1272.90 ms | 1285.55 ms | 12.66 ms |
| d3fb366 | 1258.29 ms | 1260.79 ms | 2.51 ms |
| bbdbcb9 | 1262.70 ms | 1261.86 ms | -0.84 ms |
| 73a3c38 | 1263.37 ms | 1277.90 ms | 14.53 ms |
| 2cf9161 | 1248.33 ms | 1266.55 ms | 18.22 ms |
| 75284dc | 1254.81 ms | 1262.28 ms | 7.46 ms |
| c8596a6 | 1234.11 ms | 1241.19 ms | 7.08 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 6b69699 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| 9b99523 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| cba2765 | 5.53 MiB | 5.96 MiB | 444.84 KiB |
| 2cb90b9 | 7.86 MiB | 9.54 MiB | 1.69 MiB |
| d3fb366 | 5.53 MiB | 6.01 MiB | 487.96 KiB |
| bbdbcb9 | 5.53 MiB | 6.02 MiB | 501.33 KiB |
| 73a3c38 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| 2cf9161 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| 75284dc | 5.53 MiB | 5.97 MiB | 453.77 KiB |
| c8596a6 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
Previous results on branch: replay/add-sensitive-content
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 20657ad | 1271.84 ms | 1285.37 ms | 13.53 ms |
| 0c59077 | 1252.77 ms | 1271.38 ms | 18.61 ms |
| 088cf62 | 1266.14 ms | 1285.35 ms | 19.20 ms |
| e38ab52 | 1245.25 ms | 1243.41 ms | -1.84 ms |
| 32e3fc4 | 1270.65 ms | 1284.69 ms | 14.04 ms |
| 5ce2839 | 1271.55 ms | 1281.62 ms | 10.07 ms |
| 33b5751 | 1267.33 ms | 1269.45 ms | 2.12 ms |
| 1f8bf63 | 1250.02 ms | 1271.02 ms | 21.00 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 20657ad | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| 0c59077 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| 088cf62 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| e38ab52 | 5.53 MiB | 6.00 MiB | 480.93 KiB |
| 32e3fc4 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| 5ce2839 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| 33b5751 | 5.53 MiB | 6.01 MiB | 488.60 KiB |
| 1f8bf63 | 7.86 MiB | 9.54 MiB | 1.69 MiB |
Android Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| cc4e375 | 426.15 ms | 482.34 ms | 56.19 ms |
| 6b69699 | 456.06 ms | 557.44 ms | 101.38 ms |
| 6ba4675 | 499.80 ms | 632.43 ms | 132.63 ms |
| e200a70 | 433.06 ms | 437.00 ms | 3.94 ms |
| e5b87f8 | 371.22 ms | 377.22 ms | 6.00 ms |
| d3fb366 | 391.49 ms | 385.85 ms | -5.64 ms |
| 575ebaa | 478.00 ms | 585.76 ms | 107.76 ms |
| 6ad8fc4 | 489.92 ms | 484.96 ms | -4.96 ms |
| 75284dc | 512.39 ms | 530.87 ms | 18.48 ms |
| ea06d23 | 371.10 ms | 358.56 ms | -12.54 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| cc4e375 | 6.54 MiB | 7.69 MiB | 1.15 MiB |
| 6b69699 | 6.54 MiB | 7.70 MiB | 1.17 MiB |
| 6ba4675 | 6.54 MiB | 7.53 MiB | 1015.26 KiB |
| e200a70 | 13.93 MiB | 15.18 MiB | 1.25 MiB |
| e5b87f8 | 13.93 MiB | 15.18 MiB | 1.25 MiB |
| d3fb366 | 13.93 MiB | 15.06 MiB | 1.13 MiB |
| 575ebaa | 6.54 MiB | 7.69 MiB | 1.15 MiB |
| 6ad8fc4 | 13.93 MiB | 15.06 MiB | 1.13 MiB |
| 75284dc | 13.93 MiB | 14.93 MiB | 1.00 MiB |
| ea06d23 | 13.93 MiB | 15.18 MiB | 1.25 MiB |
Previous results on branch: replay/add-sensitive-content
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0c59077 | 479.96 ms | 570.00 ms | 90.04 ms |
| 32e3fc4 | 468.26 ms | 538.44 ms | 70.18 ms |
| 1f8bf63 | 493.32 ms | 568.69 ms | 75.37 ms |
| e38ab52 | 444.62 ms | 429.09 ms | -15.53 ms |
| 5ce2839 | 462.72 ms | 519.61 ms | 56.89 ms |
| 20657ad | 514.06 ms | 607.15 ms | 93.09 ms |
| 088cf62 | 462.73 ms | 544.39 ms | 81.65 ms |
| 33b5751 | 409.10 ms | 438.85 ms | 29.75 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0c59077 | 6.54 MiB | 7.70 MiB | 1.16 MiB |
| 32e3fc4 | 6.54 MiB | 7.70 MiB | 1.16 MiB |
| 1f8bf63 | 6.54 MiB | 7.70 MiB | 1.17 MiB |
| e38ab52 | 13.93 MiB | 15.00 MiB | 1.06 MiB |
| 5ce2839 | 6.54 MiB | 7.69 MiB | 1.15 MiB |
| 20657ad | 6.54 MiB | 7.70 MiB | 1.16 MiB |
| 088cf62 | 6.54 MiB | 7.70 MiB | 1.16 MiB |
| 33b5751 | 13.93 MiB | 15.06 MiB | 1.13 MiB |
🚨 Detected changes in high risk code 🚨High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:
|
| final minor = int.tryParse( | ||
| version.substring(dot + 1, nextDot == -1 ? version.length : nextDot)); | ||
|
|
||
| return major != null && |
There was a problem hiding this comment.
nit: Could do early returns when either major/minor is null. Also, do we do version check anywhere else? Then we could extract the version reading to a common place and only do the version check here, as we do both now.
…tion for better compatibility and runtime identification
Added SensitiveContent widget to default masking in unreleased section.
| } | ||
|
|
||
| /// Minimum Flutter version required for SensitiveContent widget support. | ||
| const _sensitiveContentMinMajor = 3; |
There was a problem hiding this comment.
Why not use FlutterVersionComponents? Then we can also drop meetsMinimum and just implement size comparison overloads, way easier to read.
const runtimeVersion = FlutterVersion.parseComponentsflutterVersion)
const requiredVersion = FlutterVersionComponents(3.33)
if (runtimeVersion >= requiredVersion) {
// do stuff
}| if (sensitivity is! Enum) { | ||
| return false; | ||
| } | ||
| return true; |
There was a problem hiding this comment.
We also need to check the type if we fully want to respect the API, no? They can be sensitive, autoSensitive and notSensitive.
| return true; | ||
| } catch (_) { | ||
| // Property not found – not a SensitiveContent widget. | ||
| return false; |
There was a problem hiding this comment.
I got this from a agent review, not sure how we'd handle this, just leaving this here:
Because the rule is registered as
SentryMaskingCustomRule<Widget>, every ordinary widget reaches this dynamic getter and throwsNoSuchMethodError. Screenshot masking runs synchronously over every visible element on every capture, making exception handling the normal hot-path behavior. Cache detection by widget type or otherwise avoid repeated exception-based probing.
📜 Description
Masks the
SensitiveContentwidget ootb for replay💡 Motivation and Context
Closes #2987
💚 How did you test it?
📝 Checklist
sendDefaultPiiis enabled🔮 Next steps