Skip to content

Commit 5960fc1

Browse files
committed
Correct a Zircolite output format error
1 parent cfc3aec commit 5960fc1

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

sigma/backends/sqlite/sqlite.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -687,23 +687,18 @@ def finalize_query_zircolite(
687687
channels = self._extract_field_values_from_rule(rule, "Channel")
688688
event_ids = self._extract_field_values_from_rule(rule, "EventID")
689689

690-
rule_as_dict = rule.to_dict()
691-
690+
# Access rule properties directly instead of using to_dict() to avoid
691+
# SigmaValueError when pipeline transformations have modified detection items
692+
# in ways that make them non-serializable back to plain data types.
692693
zircolite_rule = {
693-
"title": rule_as_dict["title"],
694-
"id": rule_as_dict["id"] if "id" in rule_as_dict else "",
695-
"status": rule_as_dict["status"] if "status" in rule_as_dict else "",
696-
"description": (
697-
rule_as_dict["description"] if "description" in rule_as_dict else ""
698-
),
699-
"author": rule_as_dict["author"] if "author" in rule_as_dict else "",
700-
"tags": rule_as_dict["tags"] if "tags" in rule_as_dict else [],
701-
"falsepositives": (
702-
rule_as_dict["falsepositives"]
703-
if "falsepositives" in rule_as_dict
704-
else []
705-
),
706-
"level": rule_as_dict["level"] if "level" in rule_as_dict else "",
694+
"title": rule.title,
695+
"id": str(rule.id) if rule.id else "",
696+
"status": rule.status.name.lower() if rule.status else "",
697+
"description": rule.description if rule.description else "",
698+
"author": rule.author if rule.author else "",
699+
"tags": [str(tag) for tag in rule.tags] if rule.tags else [],
700+
"falsepositives": list(rule.falsepositives) if rule.falsepositives else [],
701+
"level": rule.level.name.lower() if rule.level else "",
707702
"rule": [sqlite_query],
708703
"filename": "",
709704
"channel": channels,

0 commit comments

Comments
 (0)