Unify custom_rule_attributes into custom_attributes#27
Merged
Conversation
Merges the two per-rule dictionaries into a single `custom_attributes` field on `SigmaRule` and `CorrelationRule`, typed as `HashMap<String, serde_yaml::Value>` to preserve nested structures and non-string values. Mirrors pySigma's single `custom_attributes` dict. Sources, applied in order (last-write-wins): 1. Arbitrary top-level YAML keys not in the standard Sigma schema. 2. Entries of the optional top-level `custom_attributes:` mapping. 3. Pipeline `SetCustomAttribute` transformations, applied after parsing. Follow-on changes: - `MatchResult` and `CorrelationResult` expose a single `custom_attributes: Arc<HashMap<String, serde_json::Value>>` (renamed from `custom_rule_attributes`). - `apply_custom_attributes` in the correlation engine and all `rsigma.*` readers now look up `serde_yaml::Value::as_str()`. - Pipeline `SetCustomAttribute` stores `Value::String(...)`. - Parser tests cover the explicit-block override of arbitrary keys; compiler tests cover pipeline overriding the rule YAML. BREAKING: `custom_rule_attributes` is removed from the public AST and runtime types. Code reading `rule.custom_attributes` must now treat values as `serde_yaml::Value` (use `.as_str()` to recover the old string view).
Contributor
|
Looks good to me :) |
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.
Merges the two per-rule dictionaries into a single
custom_attributesfield onSigmaRuleandCorrelationRule, typed asHashMap<String, serde_yaml::Value>to preserve nested structures and non-string values. Mirrors pySigma's singlecustom_attributesdict.Sources, applied in order (last-write-wins):
custom_attributes:mapping.SetCustomAttributetransformations, applied after parsing.Follow-on changes:
MatchResultandCorrelationResultexpose a singlecustom_attributes: Arc<HashMap<String, serde_json::Value>>(renamed fromcustom_rule_attributes).apply_custom_attributesin the correlation engine and allrsigma.*readers now look upserde_yaml::Value::as_str().SetCustomAttributestoresValue::String(...).BREAKING:
custom_rule_attributesis removed from the public AST and runtime types. Code readingrule.custom_attributesmust now treat values asserde_yaml::Value(use.as_str()to recover the old string view). Since #26 was merged recently and not released, this is okay.xref #20 (comment)
@fwosar I'd appreciate your review! 🙏