iOS: `Sentry.Unmask` / `Sentry.Mask` ignored when replay is started manually with both sample rates at 0
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 76/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- ios, objective-c, react-native, typescript
調査の方向性
RNSentryStart.mから始めて、issueで説明されているreplay初期化のガードを調べます。次にRNSentryReplay postInitを読み、何を登録するか確認します。報告されている修正は、両方のサンプルレートがゼロの場合でも、replayがサポートされていれば常にpostInitを呼び出すことです。これらの設定で、iOS上の手動replayがSentry.UnmaskとSentry.Maskの動作を維持すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
What React Native libraries do you use?
Expo (SDK 57, CNG / expo prebuild), Expo Router, React Native 0.86 (New Architecture), Hermes.
Are you using sentry.io or on-premise?
sentry.io (SaaS, EU region)
@sentry/react-native SDK Version
8.33.0 (sentry-cocoa 9.32.0). The same condition is still present in 8.34.0 and on main.
How does your development environment look like?
@sentry/react-native 8.33.0
sentry-cocoa 9.32.0 (prebuilt xcframework)
react-native 0.86.3, New Architecture enabled
expo 57
iOS TestFlight build, iPhone
Sentry.init()
Sentry.init({
dsn: '...',
sendDefaultPii: false,
// Replay is only recorded on one screen, started and stopped manually
// (Sentry.getReplay().start() / stop(), available since 8.27).
replaysSessionSampleRate: 0,
replaysOnErrorSampleRate: 0,
integrations: [
Sentry.mobileReplayIntegration({
maskAllText: true,
maskAllImages: true,
maskAllVectors: true,
}),
],
});
// Later, on the screen we want to record (with user consent):
Sentry.getReplay()?.start();
Steps to Reproduce
- Initialize the SDK with
replaysSessionSampleRate: 0andreplaysOnErrorSampleRate: 0, andmobileReplayIntegration({ maskAllText: true }). - Wrap a static label in
<Sentry.Unmask><Text>Continue</Text></Sentry.Unmask>. - Start the replay manually with
Sentry.getReplay().start()and navigate the screen. - Open the replay in Sentry.
Expected Result
The Text wrapped in Sentry.Unmask is visible in the replay, as it is on Android and as it is on iOS when a sample rate is positive. Sentry.Mask masks its subtree.
Actual Result
On iOS, the whole replay is masked: Sentry.Unmask has no effect (and Sentry.Mask is not registered either). Android is fine.
Cause
RNSentryStart.m only registers the replay container classes when a sample rate is positive:
[SentrySDK startWithOptions:options];
#if SENTRY_TARGET_REPLAY_SUPPORTED
if (options.sessionReplay.sessionSampleRate > 0
|| options.sessionReplay.onErrorSampleRate > 0) {
[RNSentryReplay postInit];
}
#endif
+[RNSentryReplay postInit] is what calls setReplayRedactContainerClass: (RNSentryReplayMask), setReplayIgnoreContainerClass: (RNSentryReplayUnmask) and configures the RN breadcrumb converter. Since 8.27, a replay can be started manually with both rates at 0, and sentry-cocoa 9.32.0 always installs SentrySessionReplayIntegration on iOS, whatever the rates. The replay therefore records, but without the container classes: Unmask is ignored, Mask is not applied as a container, and replay breadcrumbs go through the default converter instead of RNSentryReplayBreadcrumbConverter.
Raising a rate is not a workaround for us: it would record (or buffer) replays outside the screen the user consented to, without the on-screen recording indicator we show (App Store Review Guideline 2.5.14).
Suggested fix
Call postInit whenever the replay is supported, regardless of the sample rates:
#if SENTRY_TARGET_REPLAY_SUPPORTED
[RNSentryReplay postInit];
#endif
postInit does not start any recording: it only registers the two container classes and the breadcrumb converter on the installed integration (SentryInternalReplayApi calls are no-ops if the integration is missing). We apply exactly this change at prebuild time as a local workaround.
- 主要言語
- TypeScript
- スター
- 1.8k
- フォーク
- 373
- 平均マージ
- 1日 7時間
- マージ済み PR(30日)
- 105
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
getsentry/sentry-react-native のほかの issue
-
React-Native Replays Task
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
getsentry/sentry-react-native#6680 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Improvement React-Native
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
getsentry/sentry-react-native#6143 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
React-Native Task User Feedbacks
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
getsentry/sentry-react-native#5932 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
React-Native Replays Task
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
getsentry/sentry-react-native#5882 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Good First Issue React-Native Task
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
getsentry/sentry-react-native#5771 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
getsentry/sentry-react-native の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
pending close triaging
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
anomalyco/opencode#62582 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
feature request
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
callstack/react-native-paper#5189 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
live-codes/livecodes#1079 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Add: ESP 2 ROオープンapproved check:passed streams:add
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信