Repository navigation
fix: keep integer literals above 2^53 exact - #610
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #609; merge that first.
Closes #593.
Rule integers became
f64at lowering, so any literal above 2^53 rounded to a neighbor before eval or conversion saw it.pid: 9007199254740993matched9007199254740992and not itself,pid|gt: 9007199254740992missed9007199254740993, an integer keyword searched for the rounded digits, and every backend (plusbackend reversefrom Lucene) emitted the rounded number.Changes
rsigma-irgainsNumericLiteral(Integer(i64)orFloat(f64)), andIrNumber::Literalholds it. Lowering keeps YAML integers and integer strings asInteger; raising maps them back toSigmaValue::Integerunchanged.HIR_SCHEMA_VERSIONgoes from 3 to 4 because the serialized shape changed.CompiledMatcher::NumericEq/Gt/Gte/Lt/Ltehold aNumericLiteral. An integer literal compares exactly against integer events, against strings that parse asi64, and against floats through an exact float-to-integer ordering (so9007199254740992.0equals...992and is less than...993). Float literals keep the existingf64behavior. Integer keywords search for the exact digits.Backendnumeric leaves (convert_field_eq_num,convert_field_compare_op,convert_keyword_num) take aNumericLiteral. ItsDisplayreplaces the four per-backend whole-number formatters, so PostgreSQL, LynxDB, Fibratus, and the test backend all render the exact digits. This is a breaking change for custom backends; the fix isvalue.to_string().Testing
modifier_conformance: equality,gt/gte/lt/lte, and keywords at 2^53 + 1 against integer, string, and float events. All three tests fail onmain.large_integersgolden cases for PostgreSQL, LynxDB, Fibratus, and the Lucene reverse frontend. All four fail onmainwith9007199254740992.i64::MIN/i64::MAX, negative fractions) and forNumericLiteralparsing and display.rules,rules-threat-hunting,rules-emerging-threats,rules-compliance,rules-dfir,rules-placeholder): identical tomain, 3748 compiled and 0 errors.cargo fmt,clippy -D warnings,cargo doc, the full workspace test suite, anddocs:build/docs:validatepass locally. CI does not run on this PR because its base is notmain.