Skip to content

fix(replays): Bound recording uncompressed size without scrubbing - #6587

Open
sentry-junior[bot] wants to merge 7 commits into
masterfrom
dominikbuszowiecki/replay-994-bound-recording-uncompressed-size
Open

sentry-junior[bot] wants to merge 7 commits into
masterfrom
dominikbuszowiecki/replay-994-bound-recording-uncompressed-size

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Companion to getsentry/sentry#129541.

Relay already caps a replay recording at max_replay_uncompressed_size (100 MiB by default) once it is decompressed, but only inside RecordingScrubber. That code runs only for projects that have recording scrubbing turned on and a non-empty PII config. For every other project, only the 10 MiB compressed limit is checked, so a small zlib payload can be stored that inflates to any size every time it is read.

The check now lives in the recording scrubbing step, which runs after filtering and quotas, so each recording is decompressed at most once:

  • When recording scrubbing runs, its own decompression enforces the limit. It now reads one byte past the limit and returns ParseRecordingError::TooLarge, instead of truncating and failing on JSON parsing. That maps to TooLarge, which records an ItemTooLarge(ReplayRecording) outcome instead of InvalidReplayRecordingEvent.
  • When recording scrubbing does not run, processing Relays call relay_replays::recording::validate_recording. It uses the same header split and decompression helper as the scrubber, but inflates into a sink, so it never buffers the output. Only TooLarge is rejected there. Other malformed recordings, including bodies that are not valid zlib, are left to the consumer as before. Uncompressed JSON bodies are not checked.

TooLarge loses its processing cfg gate because scrubbing can now return it in both configurations.

Refs REPLAY-994

via @DominikB2014.

--

View Session [Sentry]

Recording scrubbing already enforces max_replay_uncompressed_size, but
only for projects that scrub recordings. Check the inflated size of every
recording in processing Relays so the limit applies regardless.

Refs REPLAY-994

Co-Authored-By: Dominik Buszowiecki <44422760+DominikB2014@users.noreply.github.com>
@linear-code

linear-code Bot commented Oct 28, 2026

Copy link
Copy Markdown

REPLAY-994

Co-Authored-By: Dominik Buszowiecki <44422760+DominikB2014@users.noreply.github.com>
@DominikB2014

Copy link
Copy Markdown
Contributor

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit db985d1. Configure here.

Move the size check out of validation, which ran before filtering and
quotas, into the recording scrubbing step. Scrubbing now reports an
explicit TooLarge error from its own decompression, and processing
Relays without recording scrubbing run the same decompression helper
to check the size, so each recording is decompressed at most once.
…replay-994-bound-recording-uncompressed-size

# Conflicts:
#	CHANGELOG.md
Comment thread relay-replays/src/recording.rs Resolved
Comment thread relay-replays/src/recording.rs Resolved
Comment thread relay-replays/src/recording.rs Resolved
Rename validate_recording to check_recording_size and document that
callers may pass malformed recordings through, and rename
scrub_recordings to process_recordings since it also enforces the
size limit without scrubbing.

Add integration tests for processing Relays without recording
scrubbing and without a PII config, covering recordings at and over
max_replay_uncompressed_size.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants