feat: add typo check for related field

This commit is contained in:
Nasreddine Bencherchali
2023-06-07 12:29:02 +02:00
parent 695e0bd5e3
commit 098746574c
+13
View File
@@ -427,6 +427,19 @@ class TestRules(unittest.TestCase):
print(
Fore.YELLOW + "Rule {} has a 'related/type' invalid value.".format(file))
faulty_rules.append(file)
else:
typo_list = []
# Add more typos
typo_list.append(self.get_rule_part(file_path=file, part_name="realted"))
typo_list.append(self.get_rule_part(file_path=file, part_name="relatde"))
typo_list.append(self.get_rule_part(file_path=file, part_name="relted"))
typo_list.append(self.get_rule_part(file_path=file, part_name="rlated"))
for i in typo_list:
if i != None:
print(
Fore.YELLOW + "Rule {} has a typo in it's 'related' field.".format(file))
faulty_rules.append(file)
self.assertEqual(faulty_rules, [], Fore.RED +
"There are rules with malformed optional 'related' fields. (check https://github.com/SigmaHQ/sigma-specification)")