Skip to content

Commit d3c05a0

Browse files
Add all historical versions for v8.17.0 and above packages (#4279)
1 parent 801efb3 commit d3c05a0

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

detection_rules/devtools.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
f'[![ATT&CK navigator coverage](https://img.shields.io/badge/ATT&CK-Navigator-red.svg)]({NAVIGATOR_URL})'
6464
)
6565
RULES_CONFIG = parse_rules_config()
66+
# The base package version that we will start to include all versions of historical rules
67+
BASE_PKG_VERSION = Version(major=8, minor=17, patch=0)
6668

6769

6870
def get_github_token() -> Optional[str]:
@@ -124,7 +126,19 @@ def build_release(ctx: click.Context, config_file, update_version_lock: bool, ge
124126
registry_data['conditions']['kibana.version'].strip("^"))
125127
sde = SecurityDetectionEngine()
126128
historical_rules = sde.load_integration_assets(previous_pkg_version)
127-
limited_historical_rules = sde.keep_latest_versions(historical_rules)
129+
current_pkg_version = Version.parse(registry_data['version'])
130+
# pre-release versions are not included in the version comparison
131+
# Version 8.17.0-beta.1 is considered lower than 8.17.0
132+
current_pkg_version_no_prerelease = Version(major=current_pkg_version.major,
133+
minor=current_pkg_version.minor, patch=current_pkg_version.patch)
134+
if current_pkg_version_no_prerelease >= BASE_PKG_VERSION:
135+
click.echo(f'[+] Adding all historical rule versions in our release package for version \
136+
{current_pkg_version_no_prerelease}')
137+
limited_historical_rules = historical_rules
138+
else:
139+
click.echo(f'[+] Limit historical rule versions in our release package for version \
140+
{current_pkg_version_no_prerelease}')
141+
limited_historical_rules = sde.keep_latest_versions(historical_rules)
128142
package.add_historical_rules(limited_historical_rules, registry_data['version'])
129143
click.echo(f'[+] Adding historical rules from {previous_pkg_version} package')
130144

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "detection_rules"
3-
version = "0.2.1"
3+
version = "0.3.0"
44
description = "Detection Rules is the home for rules used by Elastic Security. This repository is used for the development, maintenance, testing, validation, and release of rules for Elastic Security’s Detection Engine."
55
readme = "README.md"
66
requires-python = ">=3.12"

0 commit comments

Comments
 (0)