Repository navigation
fix: keep correlation event_type unquoted with pySigma >= 1.5.1 - #9
Merged
wayne-csrs merged 1 commit intoOct 6, 2026
Merged
Conversation
pySigma 1.5.1 added TextQueryBackend.convert_correlation_ruleid(), which
converts the rule id like a string value and wraps it in str_quote ('). The
subsearch template already wraps {ruleid} in double quotes, so multi-rule
correlations produced set event_type="'base_rule_1'" while the temporal
aggregation still referenced eventtypes=base_rule_1, and the two no longer
matched.
Strip the single quotes in an override so the output is the same as with
earlier pySigma versions.
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.
pyproject.tomlallowspysigma>=1.0.0, so a freshpip install pysigma-backend-signalsnow pulls pySigma 2.0.0. With pySigma 1.5.1 or later, temporal correlations come out like this:event_typeis set to'base_rule_1'with the single quotes included, buteventtypes=refers tobase_rule_1, so the two no longer match.test_temporal_correlation_rule_stats_queryandtest_temporal_ordered_correlation_rule_stats_queryfail on pySigma 1.5.1 and 2.0.0. CI doesn't catch it becausepoetry.lockpins pySigma 1.3.3.Cause: SigmaHQ/pySigma#534 (released in 1.5.1) passes
{ruleid}through the newconvert_correlation_ruleid(). That method quotes the id withstr_quote(') and only removes the quotes again when the template itself wraps{ruleid}instr_quote. The Signals template uses double quotes (set event_type="{ruleid}"), so the single quotes stay.Fix:
SignalsBackendoverridesconvert_correlation_ruleid()and strips the surroundingstr_quote. Output is the same as before 1.5.1. On older pySigma versions the method is never called, so nothing changes there.Testing:
pytest, 18 passed with each of pySigma 1.3.3 (lock file), 1.5.1 and 2.0.0. Before this change, the two temporal correlation tests fail on 1.5.1 and 2.0.0.