Merge pull request #1283 from mandiant/fix/issue-1282

better detect invalid rules
This commit is contained in:
Willi Ballenthin
2023-01-12 12:56:25 +01:00
committed by GitHub
2 changed files with 4 additions and 0 deletions

View File

@@ -82,6 +82,7 @@
- dotnet: address unhandled exceptions with improved type checking #1230 @mike-hunhoff
- fix import-to-ida script formatting #1208 @williballenthin
- render: fix verbose rendering of scopes #1263 @williballenthin
- rules: better detect invalid rules #1282 @williballenthin
- show-features: better render strings with embedded whitespace #1267 @williballenthin
### capa explorer IDA Pro plugin

View File

@@ -29,6 +29,7 @@ from typing import Any, Set, Dict, List, Tuple, Union, Iterator
import yaml
import pydantic
import ruamel.yaml
import yaml.parser
import capa.perf
import capa.engine as ceng
@@ -836,6 +837,8 @@ class Rule:
raise InvalidRuleWithPath(path, str(e)) from e
except pydantic.ValidationError as e:
raise InvalidRuleWithPath(path, str(e)) from e
except yaml.parser.ParserError as e:
raise InvalidRuleWithPath(path, str(e)) from e
def to_yaml(self) -> str:
# reformat the yaml document with a common style.