-
-
Notifications
You must be signed in to change notification settings - Fork 277
Fix unsafe json access in sentry_device
#3309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3309 +/- ##
==========================================
- Coverage 88.08% 88.00% -0.09%
==========================================
Files 295 296 +1
Lines 10217 10244 +27
==========================================
+ Hits 9000 9015 +15
- Misses 1217 1229 +12 ☔ View full report in Codecov by Sentry. |
iOS Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 944b773 | 1252.82 ms | 1254.08 ms | 1.27 ms |
| aeb02f2 | 1244.29 ms | 1256.55 ms | 12.26 ms |
| 5b9a0da | 1249.69 ms | 1250.71 ms | 1.03 ms |
| 40c8f93 | 1234.27 ms | 1261.98 ms | 27.71 ms |
| 819c1e7 | 1250.59 ms | 1249.08 ms | -1.51 ms |
| c1e775e | 1263.08 ms | 1275.32 ms | 12.24 ms |
| c8596a6 | 1234.11 ms | 1241.19 ms | 7.08 ms |
| 192b44c | 1269.08 ms | 1275.52 ms | 6.44 ms |
| de377fd | 1252.28 ms | 1254.76 ms | 2.48 ms |
| e2d675d | 1238.48 ms | 1242.76 ms | 4.28 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 944b773 | 5.53 MiB | 6.00 MiB | 479.98 KiB |
| aeb02f2 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| 5b9a0da | 5.53 MiB | 5.96 MiB | 444.32 KiB |
| 40c8f93 | 5.53 MiB | 6.00 MiB | 479.94 KiB |
| 819c1e7 | 5.53 MiB | 6.00 MiB | 479.96 KiB |
| c1e775e | 20.70 MiB | 22.46 MiB | 1.75 MiB |
| c8596a6 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| 192b44c | 5.53 MiB | 5.96 MiB | 444.33 KiB |
| de377fd | 20.71 MiB | 22.43 MiB | 1.73 MiB |
| e2d675d | 7.86 MiB | 9.44 MiB | 1.58 MiB |
Previous results on branch: fix/unsafe-access-sentry-device
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 5551800 | 1261.46 ms | 1265.96 ms | 4.50 ms |
| 2a0b9c7 | 1233.52 ms | 1246.59 ms | 13.07 ms |
| d177ad0 | 1246.53 ms | 1245.63 ms | -0.90 ms |
| 3563704 | 1260.73 ms | 1257.17 ms | -3.57 ms |
| 3e5fad6 | 1269.69 ms | 1264.14 ms | -5.54 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 5551800 | 5.53 MiB | 6.00 MiB | 484.71 KiB |
| 2a0b9c7 | 5.53 MiB | 6.00 MiB | 484.82 KiB |
| d177ad0 | 5.53 MiB | 6.00 MiB | 485.18 KiB |
| 3563704 | 5.53 MiB | 6.00 MiB | 484.98 KiB |
| 3e5fad6 | 5.53 MiB | 6.00 MiB | 484.73 KiB |
Android Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 575ebaa | 478.00 ms | 585.76 ms | 107.76 ms |
| 73a3c38 | 478.18 ms | 526.62 ms | 48.44 ms |
| 819c1e7 | 449.80 ms | 442.98 ms | -6.82 ms |
| a10aff4 | 488.19 ms | 515.02 ms | 26.83 ms |
| 7cfee3b | 498.78 ms | 516.98 ms | 18.20 ms |
| 3615e19 | 468.38 ms | 504.71 ms | 36.33 ms |
| 73dca78 | 476.53 ms | 522.21 ms | 45.68 ms |
| aeb02f2 | 373.84 ms | 437.00 ms | 63.16 ms |
| e2d675d | 457.92 ms | 529.17 ms | 71.25 ms |
| 2cb90b9 | 479.38 ms | 552.69 ms | 73.31 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 575ebaa | 6.54 MiB | 7.69 MiB | 1.15 MiB |
| 73a3c38 | 6.54 MiB | 7.69 MiB | 1.15 MiB |
| 819c1e7 | 13.93 MiB | 15.00 MiB | 1.06 MiB |
| a10aff4 | 13.93 MiB | 15.06 MiB | 1.13 MiB |
| 7cfee3b | 6.54 MiB | 7.70 MiB | 1.17 MiB |
| 3615e19 | 6.54 MiB | 7.70 MiB | 1.16 MiB |
| 73dca78 | 6.54 MiB | 7.69 MiB | 1.15 MiB |
| aeb02f2 | 6.54 MiB | 7.69 MiB | 1.15 MiB |
| e2d675d | 6.54 MiB | 7.69 MiB | 1.15 MiB |
| 2cb90b9 | 6.54 MiB | 7.70 MiB | 1.17 MiB |
Previous results on branch: fix/unsafe-access-sentry-device
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 3e5fad6 | 365.02 ms | 361.24 ms | -3.78 ms |
| 5551800 | 579.29 ms | 598.21 ms | 18.92 ms |
| 2a0b9c7 | 433.07 ms | 457.19 ms | 24.12 ms |
| 3563704 | 411.51 ms | 440.96 ms | 29.45 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 3e5fad6 | 13.93 MiB | 15.00 MiB | 1.06 MiB |
| 5551800 | 13.93 MiB | 15.00 MiB | 1.06 MiB |
| 2a0b9c7 | 13.93 MiB | 15.00 MiB | 1.06 MiB |
| 3563704 | 13.93 MiB | 15.06 MiB | 1.13 MiB |
| // Handle numeric 0 and 1 as boolean values | ||
| if (value is num) { | ||
| if (value == 0) return false; | ||
| if (value == 1) return true; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the reason for this is when using FFI objective_c conversions bool are represented as 1 or 0 nums
| /// Extension providing type-safe value extraction from JSON maps | ||
| @internal | ||
| extension TypeSafeMapExtension on Map<String, dynamic> { | ||
| /// Generic, type-safe extraction with a few built-in coercions: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
📜 Description
Currently accessing the json values is not type safe
💡 Motivation and Context
Fixes #3301
💚 How did you test it?
Unit tests
📝 Checklist
sendDefaultPiiis enabled🔮 Next steps
Replace other protocol classes to use the new type safe access methods