In a few situations, a valid rule fails to be written (using -c or -i) with the following error:
./CCCS-Yara/yara-validator/yara_file_processor.py", line 184, in strings_of_rules_to_original_file
changed_rule_string = rule.rule_return.validated_rule.splitlines()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'splitlines'
In a few situations, a valid rule fails to be written (using
-c
or-i
) with the following error:These regular expressions appear to the cause of the issue: https://github.com/CybercentreCanada/CCCS-Yara/blob/4cca67453bee31e5cc4a2522b5aa9b1f6a488268/yara-validator/yara_validator.py#L246-L247
Based on these expressions:
meta
and:
must be on the same line, and be the only contents of that line.strings
orcondition
and:
must be on the same line, and be the only contents of that line.This breaks otherwise valid rules:
And on the most extreme end: