Skip to content

Commit

Permalink
[Bug] Update Rule Formatter (#3668)
Browse files Browse the repository at this point in the history
* Update Rule Formatter

* Only apply fix to Note

(cherry picked from commit 094ef22)
  • Loading branch information
eric-forte-elastic authored and github-actions[bot] committed May 13, 2024
1 parent 191511b commit 293d427
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions detection_rules/rule_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ def _do_write(_data, _contents):
preserved_fields = ["params.message"]
v = [preserve_formatting_for_fields(action, preserved_fields) for action in v]

if k == 'note' and isinstance(v, str):
# Transform instances of \ to \\ as calling write will convert \\ to \.
# This will ensure that the output file has the correct number of backslashes.
v = v.replace("\\", "\\\\")

if isinstance(v, dict):
bottom[k] = OrderedDict(sorted(v.items()))
elif isinstance(v, list):
Expand Down

0 comments on commit 293d427

Please sign in to comment.