Skip to content

Commit e10ec0a

Browse files
[Bug] Threshold Rule Importing Failures (#3560)
* remove threshold specific req * fix test event override --------- Co-authored-by: shashank-elastic <91139415+shashank-elastic@users.noreply.github.com> (cherry picked from commit a9cc323)
1 parent 58e1a75 commit e10ec0a

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

detection_rules/cli_utils.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,6 @@ def rule_prompt(path=None, rule_type=None, required_only=True, save=True, verbos
161161
contents[name] = threat_map
162162
continue
163163

164-
if name == 'threshold':
165-
contents[name] = {n: schema_prompt(f'threshold {n}', is_required=n in options['required'], **opts.copy())
166-
for n, opts in options['properties'].items()}
167-
continue
168-
169164
if kwargs.get(name):
170165
contents[name] = schema_prompt(name, value=kwargs.pop(name))
171166
continue

tests/test_all_rules.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ def test_event_override(self):
963963
for rule in self.all_rules:
964964
# skip rules that do not leverage queries (i.e. machine learning)
965965
# filters to acceptable query languages in definitions.FilterLanguages
966-
# QueryRuleData should inheritenly ignore machine learning rules
966+
# QueryRuleData should inherently ignore machine learning rules
967967
if isinstance(rule.contents.data, QueryRuleData):
968968
rule_language = rule.contents.data.language
969969
has_event_ingested = rule.contents.data.get('timestamp_override') == 'event.ingested'
@@ -973,7 +973,7 @@ def test_event_override(self):
973973
# TODO: determine if we expand this to ES|QL
974974
# ignores any rule that does not use EQL or KQL queries specifically
975975
# this does not avoid rule types where variants of KQL are used (e.g. new terms)
976-
if rule_language not in ('eql', 'kuery') or rule.contents.data.is_sequence:
976+
if rule_language not in ('eql', 'kuery') or getattr(rule.contents.data, 'is_sequence', False):
977977
continue
978978
else:
979979
errors.append(f'{rule_str} - rule must have `timestamp_override: event.ingested`')

0 commit comments

Comments
 (0)