From 222266e7ecfe5deb6f6e5e6b86efd2d295a42581 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Fri, 4 Sep 2026 10:48:52 +0200 Subject: [PATCH 1/3] feat(ios): Expose enableMemoryIntrospection option Surfaces the public sentry-cocoa `enableMemoryIntrospection` option (added in cocoa 9.24.0, default false) as a typed, documented iOS option. Lets privacy-sensitive apps keep native crash reporting while omitting memory contents that SentryCrash reads near the crash site. The option passes straight through to Cocoa via optionsFromDictionary, so no ObjC bridging is required. Fixes #6547 Co-Authored-By: Claude Opus 4.8 --- CHANGELOG.md | 4 ++++ .../RNSentryStartTests.swift | 19 +++++++++++++++++++ packages/core/src/js/options.ts | 15 +++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bc796cdc6..76fc985744 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ ## Unreleased +### Features + +- Expose the iOS `enableMemoryIntrospection` option to omit memory contents from native crash reports ([#6547](https://github.com/getsentry/sentry-react-native/issues/6547)) + ### Dependencies - Bump Cocoa SDK from v9.26.1 to v9.27.0 ([#6670](https://github.com/getsentry/sentry-react-native/pull/6670)) diff --git a/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryStartTests.swift b/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryStartTests.swift index 682c651936..0bcd75dac7 100644 --- a/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryStartTests.swift +++ b/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryStartTests.swift @@ -226,6 +226,25 @@ final class RNSentryStartTests: XCTestCase { XCTAssertTrue(actualOptions.screenshot.maskAllImages) } + func testMemoryIntrospectionOption() throws { + try startFromRN(options: [ + "dsn": "https://abcd@efgh.ingest.sentry.io/123456", + "enableMemoryIntrospection": true + ]) + + let actualOptions = SentrySDK.internal.options + XCTAssertTrue(actualOptions.enableMemoryIntrospection) + } + + func testMemoryIntrospectionOptionDefault() throws { + try startFromRN(options: [ + "dsn": "https://abcd@efgh.ingest.sentry.io/123456" + ]) + + let actualOptions = SentrySDK.internal.options + XCTAssertFalse(actualOptions.enableMemoryIntrospection) + } + func startFromRN(options: [String: Any]) throws { var error: NSError? RNSentryStart.start(options: options, error: &error) diff --git a/packages/core/src/js/options.ts b/packages/core/src/js/options.ts index 3780539caf..d229628e8e 100644 --- a/packages/core/src/js/options.ts +++ b/packages/core/src/js/options.ts @@ -237,6 +237,21 @@ export interface BaseReactNativeOptions { */ enableMetricKit?: boolean; + /** + * When enabled, `SentryCrash` reads memory near the crash site while capturing a native crash + * (e.g. `EXC_BAD_ACCESS`) and embeds string-based stack contents in the event. This can help + * with debugging, but may also expose sensitive information (such as user IDs or personal data), + * which can even surface in the issue title. + * + * Disable this option to keep native crash reporting while omitting memory contents. + * + * iOS only + * + * @default false + * @platform ios + */ + enableMemoryIntrospection?: boolean; + /** * The max queue size for capping the number of envelopes waiting to be sent by Transport. */ From 4b591f17a5c41187463634aee1cad698370c86cc Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Fri, 4 Sep 2026 10:50:45 +0200 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76fc985744..356ca32f0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ ### Features -- Expose the iOS `enableMemoryIntrospection` option to omit memory contents from native crash reports ([#6547](https://github.com/getsentry/sentry-react-native/issues/6547)) +- Expose the iOS `enableMemoryIntrospection` option to omit memory contents from native crash reports ([#6547](https://github.com/getsentry/sentry-react-native/pull/6674)) ### Dependencies From f2280876551503a7f5af719a8f3001b95b8b53b0 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Fri, 4 Sep 2026 12:45:10 +0200 Subject: [PATCH 3/3] test(core): Verify enableMemoryIntrospection JS-to-native passthrough Add wrapper.test.ts coverage mirroring the enableMetricKit tests, so the bridge passthrough is validated at the boundary and future refactors can't silently drop the option. Co-Authored-By: Claude Opus 4.8 --- packages/core/test/wrapper.test.ts | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/packages/core/test/wrapper.test.ts b/packages/core/test/wrapper.test.ts index dee934f4bd..84e20bd64b 100644 --- a/packages/core/test/wrapper.test.ts +++ b/packages/core/test/wrapper.test.ts @@ -336,6 +336,41 @@ describe('Tests Native Wrapper', () => { expect(NATIVE.enableNative).toBe(true); }); + test('passes enableMemoryIntrospection to the Native SDK when set', async () => { + await NATIVE.initNativeSdk({ + dsn: VALID_DSN, + enableNative: true, + autoInitializeNativeSdk: true, + enableMemoryIntrospection: true, + devServerUrl: undefined, + defaultSidecarUrl: undefined, + mobileReplayOptions: undefined, + }); + + expect(RNSentry.initNativeSdk).toHaveBeenCalled(); + // @ts-expect-error mock value + const initParameter = RNSentry.initNativeSdk.mock.calls[0][0]; + expect(initParameter).toEqual(expect.objectContaining({ enableMemoryIntrospection: true })); + expect(NATIVE.enableNative).toBe(true); + }); + + test('does not pass enableMemoryIntrospection to the Native SDK when not set', async () => { + await NATIVE.initNativeSdk({ + dsn: VALID_DSN, + enableNative: true, + autoInitializeNativeSdk: true, + devServerUrl: undefined, + defaultSidecarUrl: undefined, + mobileReplayOptions: undefined, + }); + + expect(RNSentry.initNativeSdk).toHaveBeenCalled(); + // @ts-expect-error mock value + const initParameter = RNSentry.initNativeSdk.mock.calls[0][0]; + expect(initParameter).not.toHaveProperty('enableMemoryIntrospection'); + expect(NATIVE.enableNative).toBe(true); + }); + test('does not initialize with autoInitializeNativeSdk: false', async () => { NATIVE.enableNative = false; debug.warn = jest.fn();