From 5dab487ba047cf3f4ac9a45b60a55aa031f0680a Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Wed, 23 Sep 2026 13:17:48 +0200 Subject: [PATCH 1/2] feat(core): Expose reportAccessibilityIdentifier option Expose reportAccessibilityIdentifier (iOS) so apps can omit each view's accessibilityIdentifier from the captured view hierarchy. Accessibility identifiers are developer-defined and may contain PII. Read by cocoa's dictionary parser; forwarded as a plain boolean. Part of #6747. Co-Authored-By: Claude Opus 4.8 --- CHANGELOG.md | 1 + packages/core/etc/sentry-react-native.api.md | 1 + packages/core/src/js/options.ts | 14 ++++++++++++++ packages/core/test/wrapper.test.ts | 17 +++++++++++++++++ 4 files changed, 33 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29b8df1fc6..8cb8ce5726 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Expose `enableNetworkBreadcrumbs` (iOS) to disable native HTTP request breadcrumbs ([#6764](https://github.com/getsentry/sentry-react-native/pull/6764)) - Expose `enableNetworkEventBreadcrumbs` (Android) to disable native network connectivity breadcrumbs ([#6764](https://github.com/getsentry/sentry-react-native/pull/6764)) - Expose native breadcrumb off-switches: `enableAutoBreadcrumbTracking` (iOS); `enableActivityLifecycleBreadcrumbs`, `enableAppLifecycleBreadcrumbs`, `enableSystemEventBreadcrumbs`, `enableAppComponentBreadcrumbs` (Android) ([#6768](https://github.com/getsentry/sentry-react-native/pull/6768)) +- Expose `reportAccessibilityIdentifier` (iOS) to omit PII accessibility identifiers from the view hierarchy ([#XXXX](https://github.com/getsentry/sentry-react-native/pull/XXXX)) ### Fixes diff --git a/packages/core/etc/sentry-react-native.api.md b/packages/core/etc/sentry-react-native.api.md index 81d56e48d9..a172cb95d9 100644 --- a/packages/core/etc/sentry-react-native.api.md +++ b/packages/core/etc/sentry-react-native.api.md @@ -215,6 +215,7 @@ export interface BaseReactNativeOptions { replaysOnErrorSampleRate?: number; replaysSessionQuality?: SentryReplayQuality; replaysSessionSampleRate?: number; + reportAccessibilityIdentifier?: boolean; screenshot?: { maskAllText?: boolean; maskAllImages?: boolean; diff --git a/packages/core/src/js/options.ts b/packages/core/src/js/options.ts index 8b735588a0..b77b0dc115 100644 --- a/packages/core/src/js/options.ts +++ b/packages/core/src/js/options.ts @@ -401,6 +401,20 @@ export interface BaseReactNativeOptions { */ attachViewHierarchy?: boolean; + /** + * When enabled, the native iOS SDK includes each view's `accessibilityIdentifier` in the + * captured view hierarchy (see `attachViewHierarchy`). + * + * Accessibility identifiers are developer-defined and may contain personally identifiable + * information (PII). Set this to `false` to omit them from the view hierarchy. Note that the + * native SDK does not gate this on `sendDefaultPii`, so it defaults to `true` regardless of + * that option. + * + * @default true + * @platform ios + */ + reportAccessibilityIdentifier?: boolean; + /** * When enabled, Sentry will capture failed XHR/Fetch requests. This option also enabled HTTP Errors on iOS. * [Sentry Android Gradle Plugin](https://docs.sentry.io/platforms/android/configuration/integrations/okhttp/) diff --git a/packages/core/test/wrapper.test.ts b/packages/core/test/wrapper.test.ts index d536db278f..5501c45146 100644 --- a/packages/core/test/wrapper.test.ts +++ b/packages/core/test/wrapper.test.ts @@ -274,6 +274,23 @@ describe('Tests Native Wrapper', () => { expect(initParameter.enableAppComponentBreadcrumbs).toBe(false); }); + test('forwards reportAccessibilityIdentifier to the Native SDK', async () => { + await NATIVE.initNativeSdk({ + dsn: VALID_DSN, + enableNative: true, + autoInitializeNativeSdk: true, + reportAccessibilityIdentifier: false, + 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.reportAccessibilityIdentifier).toBe(false); + }); + test('filter beforeSend when initializing Native SDK', async () => { await NATIVE.initNativeSdk({ dsn: VALID_DSN, From e915fee3a17dd5a7c6844ec583bdfccb8f004315 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Wed, 23 Sep 2026 13:18:15 +0200 Subject: [PATCH 2/2] docs: Point CHANGELOG entry at PR #6771 Co-Authored-By: Claude Opus 4.8 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cb8ce5726..8eb448395a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ - Expose `enableNetworkBreadcrumbs` (iOS) to disable native HTTP request breadcrumbs ([#6764](https://github.com/getsentry/sentry-react-native/pull/6764)) - Expose `enableNetworkEventBreadcrumbs` (Android) to disable native network connectivity breadcrumbs ([#6764](https://github.com/getsentry/sentry-react-native/pull/6764)) - Expose native breadcrumb off-switches: `enableAutoBreadcrumbTracking` (iOS); `enableActivityLifecycleBreadcrumbs`, `enableAppLifecycleBreadcrumbs`, `enableSystemEventBreadcrumbs`, `enableAppComponentBreadcrumbs` (Android) ([#6768](https://github.com/getsentry/sentry-react-native/pull/6768)) -- Expose `reportAccessibilityIdentifier` (iOS) to omit PII accessibility identifiers from the view hierarchy ([#XXXX](https://github.com/getsentry/sentry-react-native/pull/XXXX)) +- Expose `reportAccessibilityIdentifier` (iOS) to omit PII accessibility identifiers from the view hierarchy ([#6771](https://github.com/getsentry/sentry-react-native/pull/6771)) ### Fixes