File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 2222 DEFAULT_PREBUILT_RULES_DIRS , RuleCollection ,
2323 dict_filter )
2424from .schemas import definitions
25- from .utils import clear_caches
25+ from .utils import clear_caches , rulename_to_filename
2626
2727
2828def single_collection (f ):
@@ -95,6 +95,15 @@ def get_collection(*args, **kwargs):
9595 if len (rules ) == 0 :
9696 client_error ("No rules found" )
9797
98+ # TODO add check here for rule directory path
99+ # Either fix or warn if the path is not correct
100+ for rule in rules :
101+ threat = rule .contents .data .get ("threat" )
102+ first_tactic = threat [0 ].tactic .name if threat else ""
103+ rule_name = rulename_to_filename (rule .contents .data .name , tactic_name = first_tactic )
104+ if rule .path .name != rule_name :
105+ click .secho (f"WARNING: Rule path does not match expected path: { rule .path .name } != { rule_name } " , fg = "yellow" )
106+
98107 kwargs ["rules" ] = rules
99108 return f (* args , ** kwargs )
100109
You can’t perform that action at this time.
0 commit comments