diff --git a/CHANGELOG.md b/CHANGELOG.md index ab6106252f..30a559fa2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,10 @@ }); ``` +### Changes + +- Default `mobileReplayIntegration({ networkCaptureBodies })` to `true`, matching the iOS and Android native SDK defaults ([#6372](https://github.com/getsentry/sentry-react-native/pull/6372)) + ### Fixes - The Sentry Babel transformer no longer injects `@sentry/babel-plugin-component-annotate` unless `annotateReactComponents` is explicitly enabled ([#6347](https://github.com/getsentry/sentry-react-native/pull/6347)) diff --git a/packages/core/src/js/replay/mobilereplay.ts b/packages/core/src/js/replay/mobilereplay.ts index 2d465523b6..27e048e4de 100644 --- a/packages/core/src/js/replay/mobilereplay.ts +++ b/packages/core/src/js/replay/mobilereplay.ts @@ -181,14 +181,18 @@ export interface MobileReplayOptions { /** * If request and response bodies should be captured for URLs matched by - * `networkDetailAllowUrls`. When `false` (the default), only headers are - * captured for allow-listed URLs — opt in explicitly to record bodies, since - * they can contain sensitive payloads. + * `networkDetailAllowUrls`. Enabled by default — set to `false` to capture + * only headers for allow-listed URLs when you cannot tolerate body payloads + * being recorded. * * Bodies are truncated at ~150 KB; truncated payloads include a - * `MAX_BODY_SIZE_EXCEEDED` warning. + * `MAX_BODY_SIZE_EXCEEDED` warning. URLs only enter the capture path after + * being explicitly allow-listed via `networkDetailAllowUrls`, so the + * default-on behaviour does not implicitly capture every request body. * - * @default false + * Aligned with the iOS and Android native SDK defaults. + * + * @default true */ networkCaptureBodies?: boolean; @@ -222,7 +226,7 @@ const defaultOptions: MobileReplayOptions = { screenshotStrategy: 'pixelCopy', networkDetailAllowUrls: [], networkDetailDenyUrls: [], - networkCaptureBodies: false, + networkCaptureBodies: true, networkRequestHeaders: [], networkResponseHeaders: [], }; @@ -388,7 +392,7 @@ export const mobileReplayIntegration = (initOptions: MobileReplayOptions = defau const networkOptions: ResolvedNetworkOptions = { allowUrls: options.networkDetailAllowUrls ?? [], denyUrls: options.networkDetailDenyUrls ?? [], - captureBodies: options.networkCaptureBodies ?? false, + captureBodies: options.networkCaptureBodies ?? true, requestHeaders: options.networkRequestHeaders ?? [], responseHeaders: options.networkResponseHeaders ?? [], };