From 740061a27af548c36685b174e58263e747b3c1f2 Mon Sep 17 00:00:00 2001 From: elramen Date: Mon, 9 Feb 2026 14:54:56 +0100 Subject: [PATCH 1/5] fix(eap): Remove integer attribute values larger than I64::MAX Remove integer attribute values larger than I64::MAX as EAP only supports signed 64 bit ints. An error along with the removed value is added to the attribute's metadata. --- CHANGELOG.md | 1 + relay-event-normalization/src/eap/mod.rs | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 850ac0f1a9..ce6feec27b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Emit outcomes for spans trimmed from a transaction. ([#5410](https://github.com/getsentry/relay/pull/5410)) - Support `sample` alias in CSP reports. ([#5554](https://github.com/getsentry/relay/pull/5554)) - Fix inconsistencies with Insights' expected attributes. ([#5561](https://github.com/getsentry/relay/pull/5561)) +- Remove EAP integer attributes larger than I64::MAX. ([#5621](https://github.com/getsentry/relay/pull/5621) **Features**: diff --git a/relay-event-normalization/src/eap/mod.rs b/relay-event-normalization/src/eap/mod.rs index 84e2ec7ef5..49010b75cc 100644 --- a/relay-event-normalization/src/eap/mod.rs +++ b/relay-event-normalization/src/eap/mod.rs @@ -123,7 +123,11 @@ pub fn normalize_attribute_types(attributes: &mut Annotated) { match (&mut inner.value.ty, &mut inner.value.value) { (Annotated(Some(Boolean), _), Annotated(Some(Value::Bool(_)), _)) => (), (Annotated(Some(Integer), _), Annotated(Some(Value::I64(_)), _)) => (), - (Annotated(Some(Integer), _), Annotated(Some(Value::U64(_)), _)) => (), + (Annotated(Some(Integer), _), Annotated(Some(Value::U64(_)), _)) => { + attribute.meta_mut().add_error(ErrorKind::InvalidData); + let original = attribute.value_mut().take(); + attribute.meta_mut().set_original_value(original); + } (Annotated(Some(Double), _), Annotated(Some(Value::I64(_)), _)) => (), (Annotated(Some(Double), _), Annotated(Some(Value::U64(_)), _)) => (), (Annotated(Some(Double), _), Annotated(Some(Value::F64(_)), _)) => (), @@ -766,6 +770,10 @@ mod tests { "type": "integer", "value": "abc" }, + "invalid_int_i64": { + "type": "integer", + "value": 9223372036854775808 + }, "missing_type": { "value": "value with missing type" }, @@ -808,6 +816,7 @@ mod tests { "value": -42 }, "invalid_int_from_invalid_string": null, + "invalid_int_i64": null, "missing_type": null, "missing_value": null, "supported_array_double": { @@ -878,6 +887,17 @@ mod tests { } } }, + "invalid_int_i64": { + "": { + "err": [ + "invalid_data" + ], + "val": { + "type": "integer", + "value": 9223372036854775808 + } + } + }, "missing_type": { "": { "err": [ From aeecb63038ec9c4e181a6c08480ae764c1b058fc Mon Sep 17 00:00:00 2001 From: elramen Date: Wed, 11 Feb 2026 10:49:41 +0100 Subject: [PATCH 2/5] Don't filter away u64s smaller than i64max, and add integ test. --- relay-event-normalization/src/eap/mod.rs | 22 ++++++++++++---------- tests/integration/test_spansv2.py | 12 +++++++++++- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/relay-event-normalization/src/eap/mod.rs b/relay-event-normalization/src/eap/mod.rs index 49010b75cc..843cb37506 100644 --- a/relay-event-normalization/src/eap/mod.rs +++ b/relay-event-normalization/src/eap/mod.rs @@ -123,10 +123,12 @@ pub fn normalize_attribute_types(attributes: &mut Annotated) { match (&mut inner.value.ty, &mut inner.value.value) { (Annotated(Some(Boolean), _), Annotated(Some(Value::Bool(_)), _)) => (), (Annotated(Some(Integer), _), Annotated(Some(Value::I64(_)), _)) => (), - (Annotated(Some(Integer), _), Annotated(Some(Value::U64(_)), _)) => { - attribute.meta_mut().add_error(ErrorKind::InvalidData); - let original = attribute.value_mut().take(); - attribute.meta_mut().set_original_value(original); + (Annotated(Some(Integer), _), Annotated(Some(Value::U64(u)), _)) => { + if *u > i64::MAX as u64 { + let original = attribute.value_mut().take(); + attribute.meta_mut().add_error(ErrorKind::InvalidData); + attribute.meta_mut().set_original_value(original); + } } (Annotated(Some(Double), _), Annotated(Some(Value::I64(_)), _)) => (), (Annotated(Some(Double), _), Annotated(Some(Value::U64(_)), _)) => (), @@ -770,7 +772,7 @@ mod tests { "type": "integer", "value": "abc" }, - "invalid_int_i64": { + "invalid_int": { "type": "integer", "value": 9223372036854775808 }, @@ -815,8 +817,8 @@ mod tests { "type": "double", "value": -42 }, + "invalid_int": null, "invalid_int_from_invalid_string": null, - "invalid_int_i64": null, "missing_type": null, "missing_value": null, "supported_array_double": { @@ -876,25 +878,25 @@ mod tests { "some_other_field": "some_other_value" }, "_meta": { - "invalid_int_from_invalid_string": { + "invalid_int": { "": { "err": [ "invalid_data" ], "val": { "type": "integer", - "value": "abc" + "value": 9223372036854775808 } } }, - "invalid_int_i64": { + "invalid_int_from_invalid_string": { "": { "err": [ "invalid_data" ], "val": { "type": "integer", - "value": 9223372036854775808 + "value": "abc" } } }, diff --git a/tests/integration/test_spansv2.py b/tests/integration/test_spansv2.py index b58ef9aaaf..b43de57c87 100644 --- a/tests/integration/test_spansv2.py +++ b/tests/integration/test_spansv2.py @@ -73,6 +73,8 @@ def test_spansv2_basic( "attributes": { "foo": {"value": "bar", "type": "string"}, "array": {"value": ["foo", "bar"], "type": "array"}, + "valid_int": {"value": 9223372036854775807, "type": "integer"}, + "invalid_int": {"value": 9223372036854775808, "type": "integer"}, "invalid": {"value": True, "type": "string"}, "http.response_content_length": {"value": 17, "type": "integer"}, }, @@ -96,6 +98,8 @@ def test_spansv2_basic( "foo": {"type": "string", "value": "bar"}, "http.response_content_length": {"value": 17, "type": "integer"}, "http.response.body.size": {"value": 17, "type": "integer"}, + "valid_int": {"value": 9223372036854775807, "type": "integer"}, + "invalid_int": None, "invalid": None, "sentry.browser.name": {"type": "string", "value": "Python Requests"}, "sentry.browser.version": {"type": "string", "value": "2.32"}, @@ -118,12 +122,18 @@ def test_spansv2_basic( }, "_meta": { "attributes": { + "invalid_int": { + "": { + "err": ["invalid_data"], + "val": {"type": "integer", "value": 9223372036854775808}, + } + }, "invalid": { "": { "err": ["invalid_data"], "val": {"type": "string", "value": True}, } - } + }, } }, "name": "some op", From d55af42084c00f6f8090ae5d96dcd50b941bafe8 Mon Sep 17 00:00:00 2001 From: elramen <158566966+elramen@users.noreply.github.com> Date: Wed, 11 Feb 2026 11:40:41 +0100 Subject: [PATCH 3/5] Update CHANGELOG.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 214324ba72..c9b9c2f777 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ - Emit outcomes for spans trimmed from a transaction. ([#5410](https://github.com/getsentry/relay/pull/5410)) - Support `sample` alias in CSP reports. ([#5554](https://github.com/getsentry/relay/pull/5554)) - Fix inconsistencies with Insights' expected attributes. ([#5561](https://github.com/getsentry/relay/pull/5561)) -- Remove EAP integer attributes larger than I64::MAX. ([#5621](https://github.com/getsentry/relay/pull/5621) +- Remove EAP integer attributes larger than I64::MAX. ([#5621](https://github.com/getsentry/relay/pull/5621)) **Features**: From fd4d693e2b5614c9be0cd51600b95beb9a830789 Mon Sep 17 00:00:00 2001 From: elramen Date: Wed, 11 Feb 2026 16:35:04 +0100 Subject: [PATCH 4/5] Simplify --- CHANGELOG.md | 2 +- relay-event-normalization/src/eap/mod.rs | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9b9c2f777..c89b6d4183 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ - Emit outcomes for spans trimmed from a transaction. ([#5410](https://github.com/getsentry/relay/pull/5410)) - Support `sample` alias in CSP reports. ([#5554](https://github.com/getsentry/relay/pull/5554)) - Fix inconsistencies with Insights' expected attributes. ([#5561](https://github.com/getsentry/relay/pull/5561)) -- Remove EAP integer attributes larger than I64::MAX. ([#5621](https://github.com/getsentry/relay/pull/5621)) +- Remove EAP integer attributes larger than `I64::MAX`. ([#5621](https://github.com/getsentry/relay/pull/5621)) **Features**: diff --git a/relay-event-normalization/src/eap/mod.rs b/relay-event-normalization/src/eap/mod.rs index 843cb37506..085c8728ae 100644 --- a/relay-event-normalization/src/eap/mod.rs +++ b/relay-event-normalization/src/eap/mod.rs @@ -123,13 +123,8 @@ pub fn normalize_attribute_types(attributes: &mut Annotated) { match (&mut inner.value.ty, &mut inner.value.value) { (Annotated(Some(Boolean), _), Annotated(Some(Value::Bool(_)), _)) => (), (Annotated(Some(Integer), _), Annotated(Some(Value::I64(_)), _)) => (), - (Annotated(Some(Integer), _), Annotated(Some(Value::U64(u)), _)) => { - if *u > i64::MAX as u64 { - let original = attribute.value_mut().take(); - attribute.meta_mut().add_error(ErrorKind::InvalidData); - attribute.meta_mut().set_original_value(original); - } - } + (Annotated(Some(Integer), _), Annotated(Some(Value::U64(u)), _)) + if i64::try_from(*u).is_ok() => {} (Annotated(Some(Double), _), Annotated(Some(Value::I64(_)), _)) => (), (Annotated(Some(Double), _), Annotated(Some(Value::U64(_)), _)) => (), (Annotated(Some(Double), _), Annotated(Some(Value::F64(_)), _)) => (), From 6fbc61237c94f2e66d50a42ecedd083c60030fd6 Mon Sep 17 00:00:00 2001 From: elramen Date: Wed, 11 Feb 2026 16:55:48 +0100 Subject: [PATCH 5/5] Clarify changelog msg --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c89b6d4183..58a574b541 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ - Emit outcomes for spans trimmed from a transaction. ([#5410](https://github.com/getsentry/relay/pull/5410)) - Support `sample` alias in CSP reports. ([#5554](https://github.com/getsentry/relay/pull/5554)) - Fix inconsistencies with Insights' expected attributes. ([#5561](https://github.com/getsentry/relay/pull/5561)) -- Remove EAP integer attributes larger than `I64::MAX`. ([#5621](https://github.com/getsentry/relay/pull/5621)) +- Validate that EAP integer attributes fit into `i64`. ([#5621](https://github.com/getsentry/relay/pull/5621)) **Features**: