Skip to content

Commit bba8d50

Browse files
authored
Fix bug with None types and other (#53)
* Update metadata.py * Update metadata.py * Update pyproject.toml
1 parent fae4df0 commit bba8d50

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pySigma-validators-sigmahq"
3-
version = "0.12.0"
3+
version = "0.12.1"
44
description = "pySigma SigmaHQ validators"
55
authors = ["François Hubaut <frack113@users.noreply.github.com>"]
66
license = "LGPL-2.1-only"

sigma/validators/sigmahq/metadata.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,15 @@ class SigmahqUnknownFieldValidator(SigmaRuleValidator):
238238
def validate(self, rule: SigmaRuleBase) -> List[SigmaValidationIssue]:
239239
if len(rule.custom_attributes) > 0:
240240
custom_keys = list(rule.custom_attributes.keys())
241-
if "regression_tests_path" not in custom_keys or "simulation" not in custom_keys:
242-
return [SigmahqUnknownFieldIssue([rule], custom_keys)]
241+
allowed_fields = {"regression_tests_path", "simulation"}
242+
243+
# Find any custom attributes that are not in the allowed list
244+
unknown_fields = [key for key in custom_keys if key not in allowed_fields]
245+
246+
if unknown_fields:
247+
return [SigmahqUnknownFieldIssue([rule], unknown_fields)]
248+
else:
249+
return []
243250
else:
244251
return []
245252

0 commit comments

Comments
 (0)