Skip to content

Conversation

@elramen
Copy link
Member

@elramen elramen commented Feb 9, 2026

Remove integer attribute values larger than I64::MAX as EAP only supports signed 64 bit ints. Add an error along with the removed value to the attribute's metadata.

Fixes #5612

@elramen elramen requested a review from a team as a code owner February 9, 2026 14:00
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.
@Dav1dde
Copy link
Member

Dav1dde commented Feb 9, 2026

As discussed, next steps to add an integration test and verify code behaves as desired.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@elramen elramen marked this pull request as draft February 11, 2026 09:54
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enforces EAP’s signed 64-bit integer limitation by removing integer attribute values that exceed i64::MAX, while preserving the removed original value and an invalid_data error in _meta (per #5612).

Changes:

  • Drop integer attributes whose JSON numbers deserialize as u64 and exceed i64::MAX, and record the original value in metadata.
  • Extend Rust unit tests and Python integration tests to cover the overflow case and the boundary value (i64::MAX).
  • Add a changelog entry documenting the behavior change.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
relay-event-normalization/src/eap/mod.rs Removes overflowing u64 integer attributes and records invalid_data + original value in _meta; adds unit test coverage.
tests/integration/test_spansv2.py Adds integration coverage for i64::MAX (kept) and i64::MAX + 1 (removed with _meta).
CHANGELOG.md Documents the bugfix (but currently has a broken Markdown link).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@elramen elramen marked this pull request as ready for review February 11, 2026 11:47
(Annotated(Some(Integer), _), Annotated(Some(Value::I64(_)), _)) => (),
(Annotated(Some(Integer), _), Annotated(Some(Value::U64(_)), _)) => (),
(Annotated(Some(Integer), _), Annotated(Some(Value::U64(u)), _)) => {
if *u > i64::MAX as u64 {
Copy link
Member

Choose a reason for hiding this comment

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

I think I would write this as i64::try_from(*u).is_ok()

(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(u)), _)) => {
Copy link
Member

Choose a reason for hiding this comment

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

Since the code in this branch is equivalent to the default error branch, you can also write this as:

Suggested change
(Annotated(Some(Integer), _), Annotated(Some(Value::U64(u)), _)) => {
(Annotated(Some(Integer), _), Annotated(Some(Value::U64(u)), _))
if i64::try_from(*u).is_ok() => {}

- 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))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- 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))

Or maybe:

Suggested change
- Remove EAP integer attributes larger than I64::MAX. ([#5621](https://github.com/getsentry/relay/pull/5621))
- Validate log/span/metric attribute integers to fit within an `i64`. ([#5621](https://github.com/getsentry/relay/pull/5621))

Copy link
Member

@Dav1dde Dav1dde left a comment

Choose a reason for hiding this comment

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

Oops, meant to approve before, it's really just nits.

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.

Validate u64 > i64::MAX for EAP item attributes

3 participants