Adding related integrations to ML rules (#2972)
* Adding related integrations to ML rules * added adjustments to determine related integrations for ML rules * fixed lint errors * Empty commit * Empty commit * Empty commit --------- Co-authored-by: Apoorva Joshi <apoorvajoshi@Apoorvas-MBP.lan> Co-authored-by: Terrance DeJesus <99630311+terrancedejesus@users.noreply.github.com> Co-authored-by: terrancedejesus <terrance.dejesus@elastic.co> Co-authored-by: Apoorva Joshi <apoorvajoshi@Apoorvas-MBP.fritz.box>
This commit is contained in:
+24
-21
@@ -1001,30 +1001,33 @@ class TOMLRuleContents(BaseRuleContents, MarshmallowDataclassMixin):
|
||||
current_stack_version = load_current_package_version()
|
||||
|
||||
if self.check_restricted_field_version(field_name):
|
||||
if isinstance(self.data, QueryRuleData) and self.data.language != 'lucene':
|
||||
package_integrations = self.get_packaged_integrations(self.data, self.metadata, packages_manifest)
|
||||
if (isinstance(self.data, QueryRuleData) or isinstance(self.data, MachineLearningRuleData)):
|
||||
if (self.data.get('language') is not None and self.data.get('language') != 'lucene') or \
|
||||
self.data.get('type') == 'machine_learning':
|
||||
package_integrations = self.get_packaged_integrations(self.data, self.metadata,
|
||||
packages_manifest)
|
||||
|
||||
if not package_integrations:
|
||||
return
|
||||
if not package_integrations:
|
||||
return
|
||||
|
||||
for package in package_integrations:
|
||||
package["version"] = find_least_compatible_version(
|
||||
package=package["package"],
|
||||
integration=package["integration"],
|
||||
current_stack_version=current_stack_version,
|
||||
packages_manifest=packages_manifest)
|
||||
for package in package_integrations:
|
||||
package["version"] = find_least_compatible_version(
|
||||
package=package["package"],
|
||||
integration=package["integration"],
|
||||
current_stack_version=current_stack_version,
|
||||
packages_manifest=packages_manifest)
|
||||
|
||||
# if integration is not a policy template remove
|
||||
if package["version"]:
|
||||
policy_templates = packages_manifest[
|
||||
package["package"]][package["version"].strip("^")]["policy_templates"]
|
||||
if package["integration"] not in policy_templates:
|
||||
del package["integration"]
|
||||
# if integration is not a policy template remove
|
||||
if package["version"]:
|
||||
policy_templates = packages_manifest[
|
||||
package["package"]][package["version"].strip("^")]["policy_templates"]
|
||||
if package["integration"] not in policy_templates:
|
||||
del package["integration"]
|
||||
|
||||
# remove duplicate entries
|
||||
package_integrations = list({json.dumps(d, sort_keys=True):
|
||||
d for d in package_integrations}.values())
|
||||
obj.setdefault("related_integrations", package_integrations)
|
||||
# remove duplicate entries
|
||||
package_integrations = list({json.dumps(d, sort_keys=True):
|
||||
d for d in package_integrations}.values())
|
||||
obj.setdefault("related_integrations", package_integrations)
|
||||
|
||||
def _convert_add_required_fields(self, obj: dict) -> None:
|
||||
"""Add restricted field required_fields to the obj, derived from the query AST."""
|
||||
@@ -1123,7 +1126,7 @@ class TOMLRuleContents(BaseRuleContents, MarshmallowDataclassMixin):
|
||||
rule_integrations = meta.get("integration", [])
|
||||
if rule_integrations:
|
||||
for integration in rule_integrations:
|
||||
if integration in definitions.NON_DATASET_PACKAGES:
|
||||
if integration in definitions.NON_DATASET_PACKAGES or isinstance(data, MachineLearningRuleData):
|
||||
packaged_integrations.append({"package": integration, "integration": None})
|
||||
|
||||
for value in sorted(datasets):
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["endpoint", "network_traffic"]
|
||||
maturity = "production"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
|
||||
[rule]
|
||||
anomaly_threshold = 50
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["endpoint", "network_traffic"]
|
||||
maturity = "production"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
|
||||
[rule]
|
||||
anomaly_threshold = 50
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["endpoint", "network_traffic"]
|
||||
maturity = "production"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
|
||||
[rule]
|
||||
anomaly_threshold = 50
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["endpoint", "network_traffic"]
|
||||
maturity = "production"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
|
||||
[rule]
|
||||
anomaly_threshold = 50
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2021/06/10"
|
||||
integration = ["auditd_manager", "endpoint", "system"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2021/06/10"
|
||||
integration = ["auditd_manager", "endpoint", "system"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2021/06/10"
|
||||
integration = ["auditd_manager", "endpoint", "system"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/09/22"
|
||||
integration = ["auditd_manager", "endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/09/22"
|
||||
integration = ["auditd_manager", "endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["auditd_manager", "endpoint", "system"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/09/22"
|
||||
integration = ["endpoint", "windows"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/09/22"
|
||||
integration = ["endpoint", "windows"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/09/03"
|
||||
integration = ["auditd_manager", "endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
[metadata]
|
||||
creation_date = "2020/09/03"
|
||||
integration = ["auditd_manager", "endpoint"]
|
||||
maturity = "production"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
|
||||
[rule]
|
||||
anomaly_threshold = 25
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/09/03"
|
||||
integration = ["auditd_manager", "endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/09/03"
|
||||
integration = ["auditd_manager", "endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/09/03"
|
||||
integration = ["auditd_manager", "endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["endpoint", "windows"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2021/06/10"
|
||||
integration = ["auditd_manager", "endpoint", "system"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2021/06/10"
|
||||
integration = ["auditd_manager", "endpoint", "system"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2021/06/10"
|
||||
integration = ["auditd_manager", "endpoint", "system"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["auditd_manager", "endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["endpoint", "windows"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["endpoint", "windows"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
[metadata]
|
||||
creation_date = "2021/04/05"
|
||||
integration = ["endpoint", "network_traffic"]
|
||||
maturity = "production"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
|
||||
[rule]
|
||||
anomaly_threshold = 75
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
[metadata]
|
||||
creation_date = "2021/04/05"
|
||||
integration = ["endpoint", "network_traffic"]
|
||||
maturity = "production"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
|
||||
[rule]
|
||||
anomaly_threshold = 75
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["auditd_manager", "endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["auditd_manager", "endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["auditd_manager", "endpoint"]
|
||||
maturity = "production"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
|
||||
[rule]
|
||||
anomaly_threshold = 50
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
[metadata]
|
||||
creation_date = "2021/04/05"
|
||||
integration = ["endpoint", "network_traffic"]
|
||||
maturity = "production"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
|
||||
[rule]
|
||||
anomaly_threshold = 75
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
[metadata]
|
||||
creation_date = "2021/04/05"
|
||||
integration = ["endpoint", "network_traffic"]
|
||||
maturity = "production"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
|
||||
[rule]
|
||||
anomaly_threshold = 75
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["endpoint", "windows"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["auditd_manager", "endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["auditd_manager", "endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["endpoint", "windows"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["endpoint", "windows"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["endpoint", "windows"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["endpoint", "windows"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["endpoint", "windows"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/09/03"
|
||||
integration = ["auditd_manager", "endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/03/25"
|
||||
integration = ["endpoint", "windows"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[metadata]
|
||||
creation_date = "2020/09/03"
|
||||
integration = ["auditd_manager", "endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2023/06/22"
|
||||
updated_date = "2023/07/27"
|
||||
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
|
||||
min_stack_version = "8.3.0"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user