Repository navigation
Conversation
Detection identifiers may contain "-" (identifier_chars = alphanums + "_-") and parse fine when referenced by name, but the pattern used by "1 of x-*" / "all of x-*" only accepted alphanums + "*_". Referencing a dashed identifier through a wildcard pattern therefore raised SigmaConditionError, even though the same identifier works when named directly. "_" was added to this pattern in 2021 (c86073b) for the same reason; this reuses identifier_chars so the wildcard pattern accepts exactly the characters identifiers already allow (plus "*").
This branch has not been deployed
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.
What
Detection identifiers may contain
-(identifier_chars = alphanums + "_-") and parse fine when referenced by name. But the pattern used by1 of x-*/all of x-*only acceptedalphanums + "*_", so referencing a dashed identifier through a wildcard pattern raisedSigmaConditionError.Reproduction
1 of sel-*raisesSigmaConditionError: Expected end of text, found '-', while the equivalentsel-img or sel-cliparses fine. The project already expects dashed identifiers elsewhere (test fixtures usekeyword-list,field-value;filters.pybuilds a pattern containing-), and the Sigma spec does not restrict identifier characters.Change
identifier_patternnow reusesidentifier_chars(plus*), so the wildcard pattern accepts exactly the characters identifiers already allow._was added to this same pattern in 2021 (c86073b) for the same reason; this adds-alongside it.Tests
Added
test_selector_pattern_with_dash, covering1 of/any of/all ofover a dashed wildcard pattern. The three cases fail before the change (SigmaConditionError) and pass after it. Fulltests/test_conditions.pyis green andblack --checkis clean on both files.