Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] Add max_signal note, unit test, and rule tuning #3669

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ integration = ["cloud_defend"]
maturity = "production"
min_stack_comments = "Initial version of the Container Workload Protection alerts"
min_stack_version = "8.8.0"
updated_date = "2023/06/22"
updated_date = "2024/05/13"

[rule]
author = ["Elastic"]
Expand All @@ -19,6 +19,10 @@ language = "kuery"
license = "Elastic License v2"
max_signals = 10000
name = "Container Workload Protection"
note = """## Setup

The `max_signals` field is set to a value greater than the default value (1000) set by `system_limit`. This is to ensure that all alerts are captured.
To bypass this default, configure the `xpack.alerting.rules.run.alerts.max` setting in the Kibana config."""
risk_score = 47
rule_id = "4b4e9c99-27ea-4621-95c8-82341bc6e512"
rule_name_override = "message"
Expand Down
6 changes: 5 additions & 1 deletion rules/integrations/endpoint/elastic_endpoint_security.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ integration = ["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 = "2024/05/13"
promotion = true

[rule]
Expand All @@ -20,6 +20,10 @@ language = "kuery"
license = "Elastic License v2"
max_signals = 10000
name = "Endpoint Security"
note = """## Setup

The `max_signals` field is set to a value greater than the default value (1000) set by `system_limit`. This is to ensure that all alerts are captured.
To bypass this default, configure the `xpack.alerting.rules.run.alerts.max` setting in the Kibana config."""
risk_score = 47
rule_id = "9a1a2dae-0b5f-4c3d-8305-a268d404c306"
rule_name_override = "message"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ creation_date = "2020/02/18"
maturity = "production"
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
min_stack_version = "8.3.0"
updated_date = "2024/01/17"
updated_date = "2024/05/13"
promotion = true

[rule]
Expand All @@ -19,6 +19,10 @@ language = "kuery"
license = "Elastic License v2"
max_signals = 10000
name = "Credential Dumping - Detected - Elastic Endgame"
note = """## Setup

The `max_signals` field is set to a value greater than the default value (1000) set by `system_limit`. This is to ensure that all alerts are captured.
To bypass this default, configure the `xpack.alerting.rules.run.alerts.max` setting in the Kibana config."""
risk_score = 73
rule_id = "571afc56-5ed9-465d-a2a9-045f099f6e7e"
severity = "high"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ creation_date = "2020/02/18"
maturity = "production"
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
min_stack_version = "8.3.0"
updated_date = "2024/01/17"
updated_date = "2024/05/13"
promotion = true

[rule]
Expand All @@ -19,6 +19,10 @@ language = "kuery"
license = "Elastic License v2"
max_signals = 10000
name = "Credential Dumping - Prevented - Elastic Endgame"
note = """## Setup

The `max_signals` field is set to a value greater than the default value (1000) set by `system_limit`. This is to ensure that all alerts are captured.
Mikaayenson marked this conversation as resolved.
Show resolved Hide resolved
To bypass this default, configure the `xpack.alerting.rules.run.alerts.max` setting in the Kibana config."""
risk_score = 47
rule_id = "db8c33a8-03cd-4988-9e2c-d0a4863adb13"
severity = "medium"
Expand Down
6 changes: 5 additions & 1 deletion rules/promotions/endgame_adversary_behavior_detected.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ creation_date = "2020/02/18"
maturity = "production"
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
min_stack_version = "8.3.0"
updated_date = "2024/01/17"
updated_date = "2024/05/13"
promotion = true

[rule]
Expand All @@ -19,6 +19,10 @@ language = "kuery"
license = "Elastic License v2"
max_signals = 10000
name = "Adversary Behavior - Detected - Elastic Endgame"
note = """## Setup

The `max_signals` field is set to a value greater than the default value (1000) set by `system_limit`. This is to ensure that all alerts are captured.
To bypass this default, configure the `xpack.alerting.rules.run.alerts.max` setting in the Kibana config."""
risk_score = 47
rule_id = "77a3c3df-8ec4-4da4-b758-878f551dee69"
severity = "medium"
Expand Down
6 changes: 5 additions & 1 deletion rules/promotions/endgame_malware_detected.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ creation_date = "2020/02/18"
maturity = "production"
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
min_stack_version = "8.3.0"
updated_date = "2024/01/17"
updated_date = "2024/05/13"
promotion = true

[rule]
Expand All @@ -19,6 +19,10 @@ language = "kuery"
license = "Elastic License v2"
max_signals = 10000
name = "Malware - Detected - Elastic Endgame"
note = """## Setup

The `max_signals` field is set to a value greater than the default value (1000) set by `system_limit`. This is to ensure that all alerts are captured.
To bypass this default, configure the `xpack.alerting.rules.run.alerts.max` setting in the Kibana config."""
risk_score = 99
rule_id = "0a97b20f-4144-49ea-be32-b540ecc445de"
severity = "critical"
Expand Down
6 changes: 5 additions & 1 deletion rules/promotions/endgame_malware_prevented.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ creation_date = "2020/02/18"
maturity = "production"
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
min_stack_version = "8.3.0"
updated_date = "2024/01/17"
updated_date = "2024/05/13"
promotion = true

[rule]
Expand All @@ -19,6 +19,10 @@ language = "kuery"
license = "Elastic License v2"
max_signals = 10000
name = "Malware - Prevented - Elastic Endgame"
note = """## Setup

The `max_signals` field is set to a value greater than the default value (1000) set by `system_limit`. This is to ensure that all alerts are captured.
To bypass this default, configure the `xpack.alerting.rules.run.alerts.max` setting in the Kibana config."""
risk_score = 73
rule_id = "3b382770-efbb-44f4-beed-f5e0a051b895"
severity = "high"
Expand Down
6 changes: 5 additions & 1 deletion rules/promotions/endgame_ransomware_detected.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ creation_date = "2020/02/18"
maturity = "production"
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
min_stack_version = "8.3.0"
updated_date = "2024/01/17"
updated_date = "2024/05/13"
promotion = true

[rule]
Expand All @@ -19,6 +19,10 @@ language = "kuery"
license = "Elastic License v2"
max_signals = 10000
name = "Ransomware - Detected - Elastic Endgame"
note = """## Setup

The `max_signals` field is set to a value greater than the default value (1000) set by `system_limit`. This is to ensure that all alerts are captured.
To bypass this default, configure the `xpack.alerting.rules.run.alerts.max` setting in the Kibana config."""
risk_score = 99
rule_id = "8cb4f625-7743-4dfb-ae1b-ad92be9df7bd"
severity = "critical"
Expand Down
6 changes: 5 additions & 1 deletion rules/promotions/endgame_ransomware_prevented.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ creation_date = "2020/02/18"
maturity = "production"
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
min_stack_version = "8.3.0"
updated_date = "2024/01/17"
updated_date = "2024/05/13"
promotion = true

[rule]
Expand All @@ -19,6 +19,10 @@ language = "kuery"
license = "Elastic License v2"
max_signals = 10000
name = "Ransomware - Prevented - Elastic Endgame"
note = """## Setup

The `max_signals` field is set to a value greater than the default value (1000) set by `system_limit`. This is to ensure that all alerts are captured.
To bypass this default, configure the `xpack.alerting.rules.run.alerts.max` setting in the Kibana config."""
risk_score = 73
rule_id = "e3c5d5cb-41d5-4206-805c-f30561eae3ac"
severity = "high"
Expand Down
6 changes: 5 additions & 1 deletion rules/promotions/execution_endgame_exploit_detected.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ creation_date = "2020/02/18"
maturity = "production"
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
min_stack_version = "8.3.0"
updated_date = "2024/01/17"
updated_date = "2024/05/13"
promotion = true

[rule]
Expand All @@ -19,6 +19,10 @@ language = "kuery"
license = "Elastic License v2"
max_signals = 10000
name = "Exploit - Detected - Elastic Endgame"
note = """## Setup

The `max_signals` field is set to a value greater than the default value (1000) set by `system_limit`. This is to ensure that all alerts are captured.
To bypass this default, configure the `xpack.alerting.rules.run.alerts.max` setting in the Kibana config."""
risk_score = 73
rule_id = "2003cdc8-8d83-4aa5-b132-1f9a8eb48514"
severity = "high"
Expand Down
6 changes: 5 additions & 1 deletion rules/promotions/execution_endgame_exploit_prevented.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ creation_date = "2020/02/18"
maturity = "production"
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
min_stack_version = "8.3.0"
updated_date = "2024/01/17"
updated_date = "2024/05/13"
promotion = true

[rule]
Expand All @@ -19,6 +19,10 @@ language = "kuery"
license = "Elastic License v2"
max_signals = 10000
name = "Exploit - Prevented - Elastic Endgame"
note = """## Setup

The `max_signals` field is set to a value greater than the default value (1000) set by `system_limit`. This is to ensure that all alerts are captured.
To bypass this default, configure the `xpack.alerting.rules.run.alerts.max` setting in the Kibana config."""
risk_score = 47
rule_id = "2863ffeb-bf77-44dd-b7a5-93ef94b72036"
severity = "medium"
Expand Down
6 changes: 5 additions & 1 deletion rules/promotions/external_alerts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ creation_date = "2020/07/08"
maturity = "production"
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
min_stack_version = "8.3.0"
updated_date = "2024/01/17"
updated_date = "2024/05/13"
promotion = true

[rule]
Expand All @@ -17,6 +17,10 @@ language = "kuery"
license = "Elastic License v2"
max_signals = 10000
name = "External Alerts"
note = """## Setup

The `max_signals` field is set to a value greater than the default value (1000) set by `system_limit`. This is to ensure that all alerts are captured.
To bypass this default, configure the `xpack.alerting.rules.run.alerts.max` setting in the Kibana config."""
risk_score = 47
rule_id = "eb079c62-4481-4d6e-9643-3ca499df7aaa"
rule_name_override = "message"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ creation_date = "2020/02/18"
maturity = "production"
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
min_stack_version = "8.3.0"
updated_date = "2024/01/17"
updated_date = "2024/05/13"
promotion = true

[rule]
Expand All @@ -19,6 +19,10 @@ language = "kuery"
license = "Elastic License v2"
max_signals = 10000
name = "Credential Manipulation - Detected - Elastic Endgame"
note = """## Setup

The `max_signals` field is set to a value greater than the default value (1000) set by `system_limit`. This is to ensure that all alerts are captured.
To bypass this default, configure the `xpack.alerting.rules.run.alerts.max` setting in the Kibana config."""
risk_score = 73
rule_id = "c0be5f31-e180-48ed-aa08-96b36899d48f"
severity = "high"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ creation_date = "2020/02/18"
maturity = "production"
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
min_stack_version = "8.3.0"
updated_date = "2024/01/17"
updated_date = "2024/05/13"
promotion = true

[rule]
Expand All @@ -19,6 +19,10 @@ language = "kuery"
license = "Elastic License v2"
max_signals = 10000
name = "Credential Manipulation - Prevented - Elastic Endgame"
note = """## Setup

The `max_signals` field is set to a value greater than the default value (1000) set by `system_limit`. This is to ensure that all alerts are captured.
To bypass this default, configure the `xpack.alerting.rules.run.alerts.max` setting in the Kibana config."""
risk_score = 47
rule_id = "c9e38e64-3f4c-4bf3-ad48-0e61a60ea1fa"
severity = "medium"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ creation_date = "2020/02/18"
maturity = "production"
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
min_stack_version = "8.3.0"
updated_date = "2024/01/17"
updated_date = "2024/05/13"
promotion = true

[rule]
Expand All @@ -19,6 +19,10 @@ language = "kuery"
license = "Elastic License v2"
max_signals = 10000
name = "Permission Theft - Detected - Elastic Endgame"
note = """## Setup

The `max_signals` field is set to a value greater than the default value (1000) set by `system_limit`. This is to ensure that all alerts are captured.
To bypass this default, configure the `xpack.alerting.rules.run.alerts.max` setting in the Kibana config."""
risk_score = 73
rule_id = "c3167e1b-f73c-41be-b60b-87f4df707fe3"
severity = "high"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ creation_date = "2020/02/18"
maturity = "production"
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
min_stack_version = "8.3.0"
updated_date = "2024/01/17"
updated_date = "2024/05/13"
promotion = true

[rule]
Expand All @@ -19,6 +19,10 @@ language = "kuery"
license = "Elastic License v2"
max_signals = 10000
name = "Permission Theft - Prevented - Elastic Endgame"
note = """## Setup

The `max_signals` field is set to a value greater than the default value (1000) set by `system_limit`. This is to ensure that all alerts are captured.
To bypass this default, configure the `xpack.alerting.rules.run.alerts.max` setting in the Kibana config."""
risk_score = 47
rule_id = "453f659e-0429-40b1-bfdb-b6957286e04b"
severity = "medium"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ creation_date = "2020/02/18"
maturity = "production"
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
min_stack_version = "8.3.0"
updated_date = "2024/01/17"
updated_date = "2024/05/13"
promotion = true

[rule]
Expand All @@ -19,6 +19,10 @@ language = "kuery"
license = "Elastic License v2"
max_signals = 10000
name = "Process Injection - Detected - Elastic Endgame"
note = """## Setup

The `max_signals` field is set to a value greater than the default value (1000) set by `system_limit`. This is to ensure that all alerts are captured.
To bypass this default, configure the `xpack.alerting.rules.run.alerts.max` setting in the Kibana config."""
risk_score = 73
rule_id = "80c52164-c82a-402c-9964-852533d58be1"
severity = "high"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ creation_date = "2020/02/18"
maturity = "production"
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
min_stack_version = "8.3.0"
updated_date = "2024/01/17"
updated_date = "2024/05/13"
promotion = true

[rule]
Expand All @@ -19,6 +19,10 @@ language = "kuery"
license = "Elastic License v2"
max_signals = 10000
name = "Process Injection - Prevented - Elastic Endgame"
note = """## Setup

The `max_signals` field is set to a value greater than the default value (1000) set by `system_limit`. This is to ensure that all alerts are captured.
To bypass this default, configure the `xpack.alerting.rules.run.alerts.max` setting in the Kibana config."""
risk_score = 47
rule_id = "990838aa-a953-4f3e-b3cb-6ddf7584de9e"
severity = "medium"
Expand Down
16 changes: 15 additions & 1 deletion tests/test_all_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,20 @@ def build_rule(query, bbr_type="default", from_field="now-120m", interval="60m")
with self.assertRaises(ValidationError):
build_rule(query=query, from_field="now-10m", interval="10m")

def test_max_signals_note(self):
"""Ensure the max_signals note is present when max_signals > 1000."""
max_signal_standard_note = 'The `max_signals` field is set to a value greater than the default value (1000) ' \
'set by `system_limit`. This is to ensure that all alerts are captured.\n' \
'To bypass this default, configure the `xpack.alerting.rules.run.alerts.max` '\
'setting in the Kibana config.'
for rule in self.all_rules:
if rule.contents.data.max_signals and rule.contents.data.max_signals > 1000:
self.assertIsNotNone(rule.contents.data.note, f'{self.rule_str(rule)} note required for max_signals > 1000') # noqa: E501
if max_signal_standard_note not in rule.contents.data.note:
self.fail(f'{self.rule_str(rule)} expected max_signals note missing\n\n'
f'Expected: {max_signal_standard_note}\n\n'
f'Actual: {rule.contents.data.note}')


class TestThreatMappings(BaseRuleTest):
"""Test threat mapping data for rules."""
Expand Down Expand Up @@ -870,7 +884,7 @@ def test_integration_guide(self):
note_str = integration_notes.get(integration)

if note_str:
self.assert_(rule.contents.data.note, f'{self.rule_str(rule)} note required for config information')
self.assertIsNotNone(rule.contents.data.note, f'{self.rule_str(rule)} note required for config information') # noqa: E501
Mikaayenson marked this conversation as resolved.
Show resolved Hide resolved

if note_str not in rule.contents.data.note:
self.fail(f'{self.rule_str(rule)} expected {integration} config missing\n\n'
Expand Down
Loading