Apply pipelines to correlation rules also #221
Merged
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.
Hi,
I´m currently testing correlation rules (using the latest release of pysigma 0.11.5 and ES|QL target from the Elastic-Backend-Repo) and realised that processing pipelines are only applied to the "regular" Sigma rule containing the
detection
and not to the correlation rule.For example, I have the following pipeline which contains
FieldMappingTransformations
to change various field-names:I tested this rule from the example section for correlation rules of the sigma specification:
After the translation with
sigma convert failed_logons_correlation.yaml -t esql -p wit_winlog_mapping
I get following query:This shows that
User
was correctly updated toevt.data.User
, howeverTargetUserName
andTargetDomainName
which are used in the correlation rule were not updated.I think this issue is because in contrast to the method
convert_rule
where the pipeline is processed withself.last_processing_pipeline.apply(rule)
(https://github.com/SigmaHQ/pySigma/blob/main/sigma/conversion/base.py#L177)In the method
convert_correlation_rule
the pipeline is not applied: https://github.com/SigmaHQ/pySigma/blob/main/sigma/conversion/base.py#L527Because I don´t think that this behaviour is intentational and the issue is easy to fix, I added the line
self.last_processing_pipeline.apply(rule)
to theconvert_correlation_rule
for this Pull Request.With this change, the fieldnames were correctly updated as expected, as I got this query:
Feel free to comment and change :)