-
Notifications
You must be signed in to change notification settings - Fork 108
fix(eap): Remove integer attribute values larger than I64::MAX #5621
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
base: master
Are you sure you want to change the base?
Conversation
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.
|
As discussed, next steps to add an integration test and verify code behaves as desired. |
There was a problem hiding this 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.
There was a problem hiding this 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
integerattributes whose JSON numbers deserialize asu64and exceedi64::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>
| (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 { |
There was a problem hiding this comment.
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)), _)) => { |
There was a problem hiding this comment.
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:
| (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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - 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:
| - 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)) |
Dav1dde
left a comment
There was a problem hiding this 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.
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