only allow supported scopes

This commit is contained in:
Moritz Raabe
2020-07-02 22:26:18 +02:00
parent af06f4d815
commit 8708d254a2

View File

@@ -535,6 +535,9 @@ class Rule(object):
if isinstance(statements[0], capa.engine.Subscope):
raise InvalidRule("top level statement may not be a subscope")
if scope not in SUPPORTED_FEATURES.keys():
raise InvalidRule("{:s} is not a supported scope".format(scope))
return cls(name, scope, build_statements(statements[0], scope), d["rule"]["meta"], s)
@classmethod