diff --git a/capa/rules/__init__.py b/capa/rules/__init__.py index 43fb9f7bd..00eb4863b 100644 --- a/capa/rules/__init__.py +++ b/capa/rules/__init__.py @@ -1218,11 +1218,6 @@ def __init__( ): super().__init__() - if rules_filter_func: - # this allows for filtering the ruleset based on - # the execution context (static or dynamic) - rules = list(filter(rules_filter_func, rules)) - ensure_rules_are_unique(rules) # in the next step we extract subscope rules, @@ -1237,6 +1232,11 @@ def __init__( ensure_rule_dependencies_are_met(rules) + if rules_filter_func: + # this allows for filtering the ruleset based on + # the execution context (static or dynamic) + rules = list(filter(rules_filter_func, rules)) + if len(rules) == 0: raise InvalidRuleSet("no rules selected")