Skip to content

Commit 4054eb4

Browse files
patch fix for 2503 (#2527)
1 parent fb2b452 commit 4054eb4

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

detection_rules/rule.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ def lock_info(self, bump=True) -> dict:
678678
@property
679679
def is_dirty(self) -> Optional[bool]:
680680
"""Determine if the rule has changed since its version was locked."""
681-
min_stack = Version.parse(self.get_supported_version())
681+
min_stack = Version.parse(self.get_supported_version(), optional_minor_and_patch=True)
682682
existing_sha256 = self.version_lock.get_locked_hash(self.id, str(min_stack).rstrip(".0"))
683683

684684
if existing_sha256 is not None:
@@ -743,7 +743,7 @@ def get_supported_version(self) -> str:
743743
"""Get the lowest stack version for the rule that is currently supported in the form major.minor."""
744744
rule_min_stack = self.metadata.get('min_stack_version')
745745
min_stack = self.convert_supported_version(rule_min_stack)
746-
return str(min_stack)
746+
return f"{min_stack.major}.{min_stack.minor}"
747747

748748
def _post_dict_transform(self, obj: dict) -> dict:
749749
"""Transform the converted API in place before sending to Kibana."""

detection_rules/version_lock.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ def log_changes(r, route_taken, new_rule_version, *msg):
202202
for rule in rules:
203203
if rule.contents.metadata.maturity == "production" or rule.id in newly_deprecated:
204204
# assume that older stacks are always locked first
205-
min_stack = Version.parse(rule.contents.get_supported_version())
205+
min_stack = Version.parse(rule.contents.get_supported_version(),
206+
optional_minor_and_patch=True)
206207

207208
lock_from_rule = rule.contents.lock_info(bump=not exclude_version_update)
208209
lock_from_file: dict = lock_file_contents.setdefault(rule.id, {})

0 commit comments

Comments
 (0)