fix(replay)!: Filter captured network headers - #8566
Draft
philprime wants to merge 2 commits into
Draft
Conversation
Make Replay header capture inherit global data collection by default and use explicit integration overrides when configured. Always filter sensitive header and cookie values before serialization. BREAKING CHANGE: Gated Replay request and response header options now use NetworkHeaderCapture instead of arrays. Fixes #8554
Contributor
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Fixes
- Filter captured network headers ([#8566](https://github.com/getsentry/sentry-cocoa/pull/8566))If none of the above apply, you can opt out of this check by adding |
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:
|
📲 Install BuildsiOS
|
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 8eb08df | 1211.00 ms | 1237.21 ms | 26.21 ms |
| 88197b2 | 1228.98 ms | 1266.60 ms | 37.62 ms |
| cfbf8df | 1217.66 ms | 1255.25 ms | 37.59 ms |
| 0cae876 | 1211.96 ms | 1240.32 ms | 28.36 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 8eb08df | 24.14 KiB | 1.25 MiB | 1.23 MiB |
| 88197b2 | 24.14 KiB | 1.25 MiB | 1.23 MiB |
| cfbf8df | 24.14 KiB | 1.25 MiB | 1.23 MiB |
| 0cae876 | 24.14 KiB | 1.25 MiB | 1.23 MiB |
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
Replay network header capture now inherits
dataCollection.httpHeadersanddataCollection.cookiesby default. Request and response directions remain independent, parsed cookies are serialized separately, and malformed cookie values use the whole-value"[Filtered]"fallback.The gated Replay header API now uses
NetworkHeaderCapture:.inheritfollows global header and cookie collection..headers([...])selects exactly the listed headers as an integration-level override.Explicit Replay selection overrides global header selection, including global
.off, but it cannot disable the built-in sensitive denylist.Authorization,X-Auth-Token,X-API-Key, and other partial case-insensitive matches are always filtered.The stable array API and its default-header merge behavior remain unchanged outside the gated code.
💡 Motivation and Context
Replay previously selected configured headers and serialized their values unchanged, which allowed integration overrides to expose credentials and raw cookie values. This aligns Replay with the data-collection specification's integration precedence and mandatory filtering requirements.
Fixes #8554
💚 How did you test it?
make formatmake analyzemake generate-public-apimake build-ios-v10 FOR_AGENTS=truemake build-macos-v10 FOR_AGENTS=truemake test-ios-v10 FOR_AGENTS=true ONLY_TESTING=SentryTests/SentryReplayOptionsTests,SentryTests/SentryReplayOptionsNetworkTests,SentryTests/SentryReplayNetworkDetailsHeaderTests,SentryTests/SentryReplayNetworkDetailsIntegrationTests,SentryTests/SentryNetworkTrackerTestsmake test-ios FOR_AGENTS=true ONLY_TESTING=SentryTests/SentryReplayOptionsTests,SentryTests/SentryReplayOptionsNetworkTests,SentryTests/SentryReplayNetworkDetailsHeaderTests,SentryTests/SentryReplayNetworkDetailsIntegrationTests,SentryTests/SentryNetworkTrackerTestsmake test-macos-v10 FOR_AGENTS=true TEST_SCHEME=SentryObjCTests ONLY_TESTING=SentryObjCTests/SentryObjCReplayOptionsTests📝 Checklist
You have to check all boxes before merging:
sendDefaultPIIis enabled.