Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(replays): Lower segment_id cap to one hour #3280

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

Check failure on line 3 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / Changelogs

Missing changelog entry.

Please consider adding a changelog entry for the next release.

**Internal**:

- Decrease max allowed segment_id for replays. ([#3280]https://github.com/getsentry/relay/pull/3280)

## 24.6.0

**Bug fixes**:
Expand Down
6 changes: 6 additions & 0 deletions py/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

**Internal**:
cmanallen marked this conversation as resolved.
Show resolved Hide resolved

- Decrease max allowed segment_id for replays. ([#3280]https://github.com/getsentry/relay/pull/3280)

## 0.8.67

### Various fixes & improvements
Expand Down
12 changes: 5 additions & 7 deletions relay-event-normalization/src/replay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ pub fn validate(replay: &Replay) -> Result<(), ReplayError> {
.value()
.ok_or_else(|| ReplayError::InvalidPayload("missing segment_id".to_string()))?;

if segment_id > u16::MAX as u64 {
if segment_id > 720 {
return Err(ReplayError::InvalidPayload(
"segment_id exceeded u16 limit".to_string(),
"segment_id limit exceeded".to_string(),
));
}

Expand Down Expand Up @@ -365,22 +365,20 @@ mod tests {
}

#[test]
fn test_validate_u16_segment_id() {
// Does not fit within a u16.
fn test_validate_segment_id() {
let replay_id =
Annotated::new(EventId("52df9022835246eeb317dbd739ccd059".parse().unwrap()));
let segment_id: Annotated<u64> = Annotated::new(u16::MAX as u64 + 1);
let segment_id: Annotated<u64> = Annotated::new(721);
let mut replay = Annotated::new(Replay {
replay_id,
segment_id,
..Default::default()
});
assert!(validate(replay.value_mut().as_mut().unwrap()).is_err());

// Fits within a u16.
let replay_id =
Annotated::new(EventId("52df9022835246eeb317dbd739ccd059".parse().unwrap()));
let segment_id: Annotated<u64> = Annotated::new(u16::MAX as u64);
let segment_id: Annotated<u64> = Annotated::new(720);
let mut replay = Annotated::new(Replay {
replay_id,
segment_id,
Expand Down
Loading