refactor(ios): Migrate from PrivateSentrySDKOnly to SentrySDK.internal#6380
refactor(ios): Migrate from PrivateSentrySDKOnly to SentrySDK.internal#6380alwx wants to merge 3 commits into
2 issues
Low
No tests cover the new `RNSentryInternal` bridge for envelope capture, screenshot, and view hierarchy - `packages/core/ios/RNSentry.mm:625`
The three methods refactored here — captureEnvelope, captureScreenshot, and fetchViewHierarchy — have no corresponding tests in the tester suite, so there is no coverage verifying that the new RNSentryInternal bridge calls behave correctly after this change.
UnsafeRawPointer escaped outside withUnsafePointer closure - `packages/core/ios/RNSentryInternal.swift:163-166`
In swizzleRNSScreenViewDidAppear, the UnsafeRawPointer produced inside withUnsafePointer(to: &rnsScreenViewDidAppearKey) { UnsafeRawPointer($0) } is returned from the closure and assigned to keyPtr, then used after the closure returns when passed to SentrySDK.internal.swizzle.instanceMethod(... key: keyPtr ...). Swift's API contract states the pointer argument is valid only for the duration of the closure body; escaping it is technically undefined behavior. In practice the pointer is only used as a stable identity token (never dereferenced) and rnsScreenViewDidAppearKey is a static var whose address is stable for the program lifetime, so real-world impact is negligible. To be spec-correct, take the address of the static property differently (e.g. UnsafeMutableRawPointer(&Self.rnsScreenViewDidAppearKey)) or perform the swizzle call inside the closure.
4 skills analyzed
| Skill | Findings | Duration | Cost |
|---|---|---|---|
| security-review | 0 | 13.4s | $0.32 |
| code-review | 1 | 3m 40s | $1.35 |
| find-bugs | 1 | 13m 20s | $3.60 |
| gha-security-review | 0 | 7m 46s | $0.25 |
⏱ 24m 59s · 2.5M in / 156.6k out · $5.53