Add rule ID field to alert structure#70
Conversation
|
Thanks for the contribution. The implementation looks solid overall, but I found one blocking interaction with alert deduplication. Blocking issueThe dedup key still uses Since deduplication is enabled by default, two rules with the same title and process context but different IDs are treated as the same alert. The second rule can be suppressed, and the resulting rollup is attributed to the first rule. This conflicts with the goal of distinguishing identical rule names across rule packs. Please use Once the deduplication issue is fixed, this should be ready to merge. |
|
Thanks for the review! I have made the rule ID a primary de-duplicator with fallback to |
Summary
This PR adds
rule.idfield to the rule JSON alert's data in compliance with ECS Rule fields. This will allow to match the alert with exact rule even in case multiple rule packs are enabled, which can be used to gain insights into which rules/rule packs are responsible for which percentage of overall alert volume. Using rule ID instead of rule name keeps this future-proof in case the name changes.The ID is prefixed with the engine (
yara,sigma,ioc) so that is is assured to be unique within the rustinel rules (as the specs require).Detailed changes
rule.id(<type>::<actual id>):sigma::<uuid>. If no ID is specified, therule.idfield is omitted from the JSON alert entirely.id = "yara-lnx-xmrig-coinminer"), formats the output rule.id field asyara::<metadata_id>. Otherwise, the field is omitted from the JSON alert.ioc::<kind>::<indicator>(e.g.ioc::domain::example.comor ioc::hash::0c2674... ), referencing the type of indicator matched and the indicator value itself.test_rule_id_mapping_and_omit_behaviortotests/ecs_contract.rsto verify that whenrule_idis defined, it is formatted and serialized correctly, and when it is absent, it is omitted from the alert JSON payload.Type of change
feat/enhancement— new featurebug— bug fixrefactor— refactoring, no behaviour changedocumentation— docs onlyci— CI/CD changesdependencies— dependency updateTest plan
cargo test)Checklist