Skip to content

Commit f70cda5

Browse files
Add all historical versions for v8.17.0 and above pacakges
1 parent 53cfeb7 commit f70cda5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

detection_rules/devtools.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +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-
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)
6768

6869
def get_github_token() -> Optional[str]:
6970
"""Get the current user's GitHub token."""
@@ -124,7 +125,16 @@ def build_release(ctx: click.Context, config_file, update_version_lock: bool, ge
124125
registry_data['conditions']['kibana.version'].strip("^"))
125126
sde = SecurityDetectionEngine()
126127
historical_rules = sde.load_integration_assets(previous_pkg_version)
127-
limited_historical_rules = sde.keep_latest_versions(historical_rules)
128+
current_pkg_version = Version.parse(registry_data['version'])
129+
# pre-release versions are not included in the version comparison
130+
# Version 8.17.0-beta.1 is considered lower than 8.17.0
131+
current_pkg_version_no_prerelease = Version(major=current_pkg_version.major,minor=current_pkg_version.minor,patch=current_pkg_version.patch)
132+
if current_pkg_version_no_prerelease>= BASE_PKG_VERSION:
133+
click.echo(f'[+] Adding all historical rule versions in our release package for version {current_pkg_version_no_prerelease}')
134+
limited_historical_rules = historical_rules
135+
else:
136+
click.echo(f'[+] Limit historical rule versions in our release package for version {current_pkg_version_no_prerelease}')
137+
limited_historical_rules = sde.keep_latest_versions(historical_rules)
128138
package.add_historical_rules(limited_historical_rules, registry_data['version'])
129139
click.echo(f'[+] Adding historical rules from {previous_pkg_version} package')
130140

0 commit comments

Comments
 (0)