Repository navigation
fix(ir): make boolean keywords search for the word - #609
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 #608; merge that first.
A
keywords:detection with a YAML boolean (keywords: [true]) parsed, compiled, and passed lint, but never fired. Keyword lowering turned the value intoIrMatcher::BoolEq, and keyword evaluation runs only string matchers, which return false for it.backend convertrejected the same rule withUnsupportedKeyword, so eval was silently dead while convert errored.Fix
Sigma keywords are strings, so keyword lowering now turns a boolean into a case-insensitive
Containsof the wordtrueorfalse, like any other keyword value. This fixes eval and convert together, and raising round-trips the keyword as the string'true'.Keyword search still does not visit JSON booleans: the three event walkers (including the one the candidate index uses) yield only strings and numbers. Changing that would make every string keyword
truestart matching JSON booleans, so it is left as is and pinned by a test. The keywords reference now says so and points to a field match such asa: true.Tests
bool_keywords_search_for_the_word(IR compile path andEnginewith its candidate index):keywords: [true]matches{"a": "true"},flag is TRUE now, and a plain-text event, and does not match{"a": "false"}.{"a": true}does not match, which pins the JSON boolean behavior.test_bool_keyword_converts_as_text: the test backend converts the rule to_="true"instead of failing.Both fail on the previous lowering. The SigmaHQ corpus regression (3,748 rules) is unchanged.
Fixes #587