feat(data-collection): Gate session replay network body collection - #8547
Open
philprime wants to merge 2 commits into
Open
feat(data-collection): Gate session replay network body collection#8547philprime wants to merge 2 commits into
philprime wants to merge 2 commits into
Conversation
Resolve Session Replay request and response body capture from dataCollection.httpBodies unless Replay explicitly overrides it. Scrub sensitive top-level JSON and form values, and filter raw bodies that cannot be parsed safely. Change the v10 Replay body capture option to a three-state enum so inheritance is explicit. Fixes #8250
9 tasks
…data-collection-bodies
Contributor
🚨 Detected changes in high risk code 🚨High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:
|
Contributor
|
philprime
marked this pull request as ready for review
July 24, 2026 07:48
philprime
requested review from
a team,
NinjaLikesCheez,
itaybre,
noahsmartin and
philipphofmann
as code owners
July 24, 2026 07:48
📲 Install BuildsiOS
|
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| a91cc39 | 1224.22 ms | 1256.36 ms | 32.14 ms |
| 602ee98 | 1213.90 ms | 1245.86 ms | 31.96 ms |
| 602ee98 | 1236.15 ms | 1265.19 ms | 29.04 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| a91cc39 | 24.14 KiB | 1.26 MiB | 1.24 MiB |
| 602ee98 | 24.14 KiB | 1.26 MiB | 1.23 MiB |
| 602ee98 | 24.14 KiB | 1.26 MiB | 1.23 MiB |
NinjaLikesCheez
approved these changes
Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
Wire Session Replay network body capture to
options.dataCollection.httpBodieson top of the SwiftSentryNetworkTrackerconversion in #8502.Replay requests resolve as
outgoingRequestbodies and responses resolve asincomingResponsebodies. The Replay integration can override the global setting through the newSentryReplayOptions.NetworkBodyCapturevalues:.inheritfollowsdataCollection.httpBodiesfor each direction and is the default.enabledcaptures both Replay request and response bodies.disabledcaptures neitherParseable JSON objects and form-urlencoded bodies apply the canonical sensitive denylist to top-level keys. Filtering is intentionally non-recursive. JSON values without a top-level key-value structure, malformed bodies, text, HTML, XML, binary data, and unknown content types are replaced with
[Filtered].The hybrid SDK dictionary option continues accepting Boolean values, mapping
trueto.enabled,falseto.disabled, and an omitted value to.inherit. The RRWeb options event serializes the three states asinherit,enabled, ordisabled.💡 Motivation and Context
The data collection specification makes
dataCollectionthe default source of truth while allowing integration-level overrides to take precedence. It also requires automatically captured raw bodies that cannot be parsed into key-value data to be replaced with[Filtered].This is a stacked PR based on
philprime/network-tracker-conversionbecause the request and response capture decisions belong in the SwiftSentryNetworkTracker.Fixes #8250
💚 How did you test it?
make test-ios-v10 FOR_AGENTS=true ONLY_TESTING=SentryTests/SentryReplayOptionsTests,SentryTests/SentryReplayNetworkDetailsBodyTests,SentryTests/SentryNetworkTrackerTestsmake test-ios FOR_AGENTS=true ONLY_TESTING=SentryTests/SentryReplayOptionsTests,SentryTests/SentryReplayNetworkDetailsBodyTests,SentryTests/SentryNetworkTrackerTestsmake test-macos-v10 FOR_AGENTS=true TEST_SCHEME=SentryObjCTests ONLY_TESTING=SentryObjCTests/SentryObjCReplayOptionsTests,SentryObjCCompatTests/SentryObjCCompatEnumConversionTestsmake analyzemake build-ios-v10 FOR_AGENTS=truemake generate-public-apimake build-xcframework-sentryobjc-static SDKS=iphoneosmake build-xcframework-sentryobjc-dynamic SDKS=iphoneos📝 Checklist
You have to check all boxes before merging:
sendDefaultPIIis enabled.#skip-changelog