-
-
Notifications
You must be signed in to change notification settings - Fork 341
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
Fix: Time-of-check time-of-use filesystem race condition #4473
Conversation
…ace condition Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
e80771f | 1208.41 ms | 1233.94 ms | 25.53 ms |
1ce939e | 1216.79 ms | 1242.38 ms | 25.59 ms |
86b89b9 | 1237.28 ms | 1256.27 ms | 18.99 ms |
fb53d97 | 1226.08 ms | 1245.12 ms | 19.04 ms |
5de0a56 | 1214.49 ms | 1235.56 ms | 21.07 ms |
3a6495e | 1227.61 ms | 1239.22 ms | 11.60 ms |
3297d6e | 1203.79 ms | 1218.76 ms | 14.97 ms |
ca91a5c | 1234.53 ms | 1249.86 ms | 15.33 ms |
4d5eb78 | 1197.86 ms | 1215.73 ms | 17.88 ms |
feba2be | 1246.67 ms | 1254.64 ms | 7.97 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
e80771f | 21.58 KiB | 697.69 KiB | 676.10 KiB |
1ce939e | 22.85 KiB | 412.98 KiB | 390.13 KiB |
86b89b9 | 21.58 KiB | 638.25 KiB | 616.66 KiB |
fb53d97 | 20.76 KiB | 425.81 KiB | 405.04 KiB |
5de0a56 | 20.76 KiB | 432.87 KiB | 412.11 KiB |
3a6495e | 21.58 KiB | 422.66 KiB | 401.08 KiB |
3297d6e | 21.58 KiB | 418.45 KiB | 396.86 KiB |
ca91a5c | 22.84 KiB | 403.19 KiB | 380.34 KiB |
4d5eb78 | 21.58 KiB | 418.74 KiB | 397.16 KiB |
feba2be | 20.76 KiB | 414.45 KiB | 393.69 KiB |
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.
LGTM, but I think we should still ask somebody from the native team to have a look.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4473 +/- ##
=============================================
- Coverage 91.803% 91.797% -0.007%
=============================================
Files 611 611
Lines 68300 68294 -6
Branches 24529 24511 -18
=============================================
- Hits 62702 62692 -10
- Misses 5507 5509 +2
- Partials 91 93 +2
... and 10 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
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.
lgtm!
Fixes https://github.com/getsentry/sentry-cocoa/security/code-scanning/6
To fix the TOCTOU race condition, we should avoid using
stat
andopen
separately. Instead, we can use theopen
function with theO_RDONLY
flag to open the file directly and then usefstat
to get the file status. This ensures that the file we are operating on is the same file we checked, as both operations are performed on the file descriptor.Suggested fixes powered by Copilot Autofix. Review carefully before merging.