Skip to content

[FR] Add support for New Terms Fields and Window Start History #2360

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

Merged

Conversation

terrancedejesus
Copy link
Contributor

@terrancedejesus terrancedejesus commented Oct 16, 2022

Issues

Summary

Adds support for new_terms_field and window_start_history fields in detection rules. These rules are compatible with stack versions 8.4+. The following needs to be completed for this PR.

  • Update Definitions.py to include new fields and minimum stack requirements
  • Add NewTermsRuleData data class in rule.py for the new rule type
  • Create validate method in NewTermsRuleData class to add specific validation for New Terms rule types
  • Create transform method in NewTermsRuleData class to pop new terms key:value to root of JSON after validation
  • Add multiple assertions in validate method

Testing

The following rule was made locally to test this by using the command -> python -m detection_rules view-rule /Users/tdejesus/code/src/detection-rules/rules/network/command_and_control_uncommon_well_known_port.toml

Example Rule
[metadata]
creation_date = "2020/10/16"
maturity = "production"
min_stack_comments = "New fields available: new_terms_fields and window_start_history"
min_stack_version = "8.4.0"
updated_date = "2022/10/16"

[rule]
author = ["Elastic"]
description = "This rule detects outbound network connections to a well known port that has not been seen within the last 30 days."
false_positives = [
    """
    Introducing new services that used well-known ports may cause outbound traffic to specific ports that would meet the
    criteria of this rule.
    """,
]
from = "now-9m"
index = ["logs-endpoint.events.*"]
language = "kuery"
license = "Elastic License v2"
name = "Outbound Traffic to Uncommon Well Known Port"
risk_score = 21
rule_id = "ecaa877a-6abc-11ed-82c5-f661ea17fbcd"
severity = "low"
tags = ["Elastic", "Host", "Network", "Threat Detection", "Command and Control", "Host"]
timestamp_override = "event.ingested"
type = "new_terms"

query = '''
event.category:(network or network_traffic) and destination.port < 1024
'''


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1021"
name = "Remote Services"
reference = "https://attack.mitre.org/techniques/T1021/"


[rule.threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"


[rule.new_terms]
field = "new_terms_fields"
value = ["destination.port"]

[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-30d"

The view-rule CLI command from devtools was used to view this rule which will then transform it to API format and produce the expected JSON ouput. This process calls on existing data validators and schemas which would fail if the new fields were unrecognized or did not follow proper schema.

View Rule Output
detection-rules on  2346-fr-add-support-for-new-terms-field-in-rules [$!?] via 🐍 v3.9.13 (detection-rules-dev) on ☁️   
❯  cd /Users/tdejesus/code/src/detection-rules ; /usr/bin/env /Users/tdejesus/.virtualenvs/detection-rules-dev/bin/python /Users/tdejesus/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 60439 -- -m detection_rules view-rule /Users/tdejesus/code/src/detection-rules/rules/network/command_and_control_uncommon_well_known_port.toml 
Loaded config file: /Users/tdejesus/code/src/detection-rules/.detection-rules-cfg.json

█▀▀▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄   ▄      █▀▀▄ ▄  ▄ ▄   ▄▄▄ ▄▄▄
█  █ █▄▄  █  █▄▄ █    █   █  █ █ █▀▄ █      █▄▄▀ █  █ █   █▄▄ █▄▄
█▄▄▀ █▄▄  █  █▄▄ █▄▄  █  ▄█▄ █▄█ █ ▀▄█      █ ▀▄ █▄▄█ █▄▄ █▄▄ ▄▄█

{
  "author": [
    "Elastic"
  ],
  "description": "This rule detects outbound network connections to a well known port that has not been seen within the last 30 days.",
  "false_positives": [
    "Introducing new services that used well-known ports may cause outbound traffic to specific ports that would meet the criteria of this rule."
  ],
  "from": "now-9m",
  "history_window_start": "now-30d",
  "index": [
    "logs-endpoint.events.*"
  ],
  "language": "kuery",
  "license": "Elastic License v2",
  "name": "Outbound Traffic to Uncommon Well Known Port",
  "new_terms_fields": [
    "destination.port"
  ],
  "query": "event.category:(network or network_traffic) and destination.port < 1024\n",
  "required_fields": [
    {
      "ecs": true,
      "name": "destination.port",
      "type": "long"
    },
    {
      "ecs": true,
      "name": "event.category",
      "type": "keyword"
    }
  ],
  "risk_score": 21,
  "rule_id": "ecaa877a-6abc-11ed-82c5-f661ea17fbcd",
  "severity": "low",
  "tags": [
    "Elastic",
    "Host",
    "Network",
    "Threat Detection",
    "Command and Control",
    "Host"
  ],
  "threat": [
    {
      "framework": "MITRE ATT&CK",
      "tactic": {
        "id": "TA0011",
        "name": "Command and Control",
        "reference": "https://attack.mitre.org/tactics/TA0011/"
      },
      "technique": [
        {
          "id": "T1021",
          "name": "Remote Services",
          "reference": "https://attack.mitre.org/techniques/T1021/"
        }
      ]
    }
  ],
  "timestamp_override": "event.ingested",
  "type": "new_terms",
  "version": 1
}

@terrancedejesus terrancedejesus added enhancement New feature or request python Internal python for the repository labels Oct 16, 2022
@terrancedejesus terrancedejesus self-assigned this Oct 16, 2022
@terrancedejesus terrancedejesus linked an issue Oct 16, 2022 that may be closed by this pull request
@botelastic botelastic bot added the schema label Oct 16, 2022
@terrancedejesus
Copy link
Contributor Author

terrancedejesus commented Nov 17, 2022

@brokensound77 the following marshmallow error appears when attempting to run the following command (TOML rule is in the original comment).

Command: python -m detection_rules view-rule rules/network/command_and_control_new_terms_destination_port.toml

marshmallow.exceptions.ValidationError: {'rule': [ValidationError({'type': ['Must be equal to eql.'], 'language': ['Must be equal to eql.'], 'new_terms': ['Unknown field.']}), ValidationError({'threshold': ['Missing data for required field.'], 'type': ['Must be equal to threshold.'], 'new_terms': ['Unknown field.']}), ValidationError({'type': ['Must be equal to threat_match.'], 'threat_mapping': ['Missing data for required field.'], 'threat_index': ['Missing data for required field.'], 'new_terms': ['Unknown field.']}), ValidationError({'type': ['Must be equal to machine_learning.'], 'machine_learning_job_id': ['Missing data for required field.'], 'anomaly_threshold': ['Missing data for required field.'], 'index': ['Unknown field.'], 'new_terms': ['Unknown field.'], 'query': ['Unknown field.'], 'language': ['Unknown field.']}), ValidationError({'type': ['Must be equal to query.'], 'new_terms': ['Unknown field.']}), ValidationError({'new_terms': ['Unknown field.']})]}

I assume it is related to the NewTermsRuleData class in rule.py but I am unable to determine what exactly is the issue. Any ideas?

@terrancedejesus
Copy link
Contributor Author

I have identified the issue with the NewTermsRuleData class. Addressed issues and the view-rule CLI command returns the rule in JSON format, meaning it passed validation and converted the rule.

Results
❯ python -m detection_rules view-rule rules/network/command_and_control_new_terms_destination_port.toml                                               
Loaded config file: /Users/tdejesus/code/src/detection-rules/.detection-rules-cfg.json

█▀▀▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄   ▄      █▀▀▄ ▄  ▄ ▄   ▄▄▄ ▄▄▄
█  █ █▄▄  █  █▄▄ █    █   █  █ █ █▀▄ █      █▄▄▀ █  █ █   █▄▄ █▄▄
█▄▄▀ █▄▄  █  █▄▄ █▄▄  █  ▄█▄ █▄█ █ ▀▄█      █ ▀▄ █▄▄█ █▄▄ █▄▄ ▄▄█

{
  "author": [
    "Elastic"
  ],
  "description": "This rule detects outbound network connections to a well known port that has not been seen within the last 30 days.",
  "false_positives": [
    "Introducing new services that used well-known ports may cause outbound traffic to specific ports that would meet the criteria of this rule."
  ],
  "from": "now-9m",
  "index": [
    "logs-endpoint.events.*"
  ],
  "language": "kuery",
  "license": "Elastic License v2",
  "name": "Outbound Traffic to Uncommon Well Known Port",
  "new_terms": {
    "field": "new_terms_field",
    "history_window_start": [
      {
        "field": "history_window_start",
        "value": "now-30d"
      }
    ],
    "value": [
      "destination.port"
    ]
  },
  "query": "event.category:(network or network_traffic) and destination.port < 1024\n",
  "required_fields": [
    {
      "ecs": true,
      "name": "destination.port",
      "type": "long"
    },
    {
      "ecs": true,
      "name": "event.category",
      "type": "keyword"
    }
  ],
  "risk_score": 21,
  "rule_id": "34fde489-94b0-4500-a76f-b8a157cf9269",
  "severity": "low",
  "tags": [
    "Elastic",
    "Host",
    "Network",
    "Threat Detection",
    "Command and Control",
    "Host"
  ],
  "threat": [
    {
      "framework": "MITRE ATT&CK",
      "tactic": {
        "id": "TA0011",
        "name": "Command and Control",
        "reference": "https://attack.mitre.org/tactics/TA0011/"
      },
      "technique": [
        {
          "id": "T1021",
          "name": "Remote Services",
          "reference": "https://attack.mitre.org/techniques/T1021/"
        }
      ]
    }
  ],
  "timestamp_override": "event.ingested",
  "type": "new_terms",
  "version": 101
}

@@ -51,7 +51,7 @@

"8.4.0":
beats: "main"
ecs: "8.3.1"
ecs: "8.4.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated this to be current and match the stack version.

Copy link
Contributor

@eric-forte-elastic eric-forte-elastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great walk-through and discussion from @terrancedejesus and @Mikaayenson about this on Friday 12/02. Local test results on my machine match expected output. All looks good to me!

Local Test Output
detection-rules on  2346-fr-add-support-for-new-terms-field-in-rules [?] via  v3.8.10 (venv) on  eric.forte
❯ python -m detection_rules view-rule test_rule.toml

█▀▀▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄   ▄      █▀▀▄ ▄  ▄ ▄   ▄▄▄ ▄▄▄
█  █ █▄▄  █  █▄▄ █    █   █  █ █ █▀▄ █      █▄▄▀ █  █ █   █▄▄ █▄▄
█▄▄▀ █▄▄  █  █▄▄ █▄▄  █  ▄█▄ █▄█ █ ▀▄█      █ ▀▄ █▄▄█ █▄▄ █▄▄ ▄▄█

{
  "author": [
    "Elastic"
  ],
  "description": "This rule detects outbound network connections to a well known port that has not been seen within the last 30 days.",
  "false_positives": [
    "Introducing new services that used well-known ports may cause outbound traffic to specific ports that would meet the criteria of this rule."
  ],
  "from": "now-9m",
  "history_window_start": "now-30d",
  "index": [
    "logs-endpoint.events.*"
  ],
  "language": "kuery",
  "license": "Elastic License v2",
  "name": "Outbound Traffic to Uncommon Well Known Port",
  "new_terms_fields": [
    "destination.port"
  ],
  "query": "event.category:(network or network_traffic) and destination.port < 1024\n",
  "required_fields": [
    {
      "ecs": true,
      "name": "destination.port",
      "type": "long"
    },
    {
      "ecs": true,
      "name": "event.category",
      "type": "keyword"
    }
  ],
  "risk_score": 21,
  "rule_id": "ecaa877a-6abc-11ed-82c5-f661ea17fbcd",
  "severity": "low",
  "tags": [
    "Elastic",
    "Host",
    "Network",
    "Threat Detection",
    "Command and Control",
    "Host"
  ],
  "threat": [
    {
      "framework": "MITRE ATT&CK",
      "tactic": {
        "id": "TA0011",
        "name": "Command and Control",
        "reference": "https://attack.mitre.org/tactics/TA0011/"
      },
      "technique": [
        {
          "id": "T1021",
          "name": "Remote Services",
          "reference": "https://attack.mitre.org/techniques/T1021/"
        }
      ]
    }
  ],
  "timestamp_override": "event.ingested",
  "type": "new_terms",
  "version": 1
}

Copy link
Contributor

@Mikaayenson Mikaayenson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. tested with sample rule new_terms load as expected
  2. tested field name is correct (recommending add an assert)
  3. tested schemas with no min_stack (recommending add a default)
  4. tested the values (no validation on window)
  5. tested number of new terms for 8.4.0
  6. tested duplicated of terms
  7. tested number of terms (more than 3, less than 1)
  8. observed new_terms_field added to root of output.

Left a couple small recommendations.

@dataclass(frozen=True)
class HistoryWindowStart:
field: definitions.NonEmptyStr
value: definitions.NonEmptyStr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: It's a shame that we don't add validation to the value.

Copy link
Contributor Author

@terrancedejesus terrancedejesus Dec 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Digging into this at the moment. In L188 in rule.py we only ensure that the value of this field is a string.

In reference to L478 of rule.py, it seems that we have some additional logic for EQL rules because the possibility of conflicts between maxspax, lookback, and interval fields which is why they are methods of the EQLRuleData class and not inside QueryRuleData.

The look_back method of the EQLRuleData class is only called in the unit test test_all_rules.test_eql_lookback and converts, for example now-9m into milliseconds, ultimately to compare it with the maxspan value of an EQL rule to ensure it is greater than.

So in all, it appears we have no validation of the from field for rules, but we have comparison logic to ensure rule devs have entered maxspan and interval ranges that would not conflict. It is up to the rule developer to determine. If we do add logic, it should probably be in another PR where we determine what is compatible with Kibana, cover test/edge cases, etc while referencing https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#date-math.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added new issue for this -> #2416

Copy link
Contributor

@Mikaayenson Mikaayenson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Great work!

@terrancedejesus terrancedejesus merged commit 7e459dd into main Dec 5, 2022
@terrancedejesus terrancedejesus deleted the 2346-fr-add-support-for-new-terms-field-in-rules branch December 5, 2022 19:07
protectionsmachine pushed a commit that referenced this pull request Dec 5, 2022
* adding support new_terms_fields and window_start_history

* adjusted rule.py to address flake errors

* added assertion error if history_window_start does not exist

* removed sample rule

* removed self.rule_id from DataValidator

* added new_terms to RuleType

* changed new terms to its own class in rule.py

* removed nonexisting function call in DataValidator class

* adjusted new_terms field value in dataclass

* changed literal type for history_window_start; view-rule working

* removing test TOML rule

* addressed flake errors for missing newlines

* added validation option and adjusted object referencing

* adjusted validation method call in post_validation

* addressed flake errors for multiple spaces

* added transform method to NewTermsRuleData class

* added validation for min stack version and new terms array length restraints

* added validation for unique new terms array

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* removed historywindowstart definition and adjusted subclass

* removed test rule from commit

* adjusted if/else for data transform method check

* adjusted stack-schema-map; validation method name

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* added assertion for history_window_start field value

* added variables for feature min stack and extended field min stack

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* addressed flake errors for continuation line with same indent

Co-authored-by: Mika Ayenson <[email protected]>

(cherry picked from commit 7e459dd)
protectionsmachine pushed a commit that referenced this pull request Dec 5, 2022
* adding support new_terms_fields and window_start_history

* adjusted rule.py to address flake errors

* added assertion error if history_window_start does not exist

* removed sample rule

* removed self.rule_id from DataValidator

* added new_terms to RuleType

* changed new terms to its own class in rule.py

* removed nonexisting function call in DataValidator class

* adjusted new_terms field value in dataclass

* changed literal type for history_window_start; view-rule working

* removing test TOML rule

* addressed flake errors for missing newlines

* added validation option and adjusted object referencing

* adjusted validation method call in post_validation

* addressed flake errors for multiple spaces

* added transform method to NewTermsRuleData class

* added validation for min stack version and new terms array length restraints

* added validation for unique new terms array

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* removed historywindowstart definition and adjusted subclass

* removed test rule from commit

* adjusted if/else for data transform method check

* adjusted stack-schema-map; validation method name

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* added assertion for history_window_start field value

* added variables for feature min stack and extended field min stack

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* addressed flake errors for continuation line with same indent

Co-authored-by: Mika Ayenson <[email protected]>

(cherry picked from commit 7e459dd)
protectionsmachine pushed a commit that referenced this pull request Dec 5, 2022
* adding support new_terms_fields and window_start_history

* adjusted rule.py to address flake errors

* added assertion error if history_window_start does not exist

* removed sample rule

* removed self.rule_id from DataValidator

* added new_terms to RuleType

* changed new terms to its own class in rule.py

* removed nonexisting function call in DataValidator class

* adjusted new_terms field value in dataclass

* changed literal type for history_window_start; view-rule working

* removing test TOML rule

* addressed flake errors for missing newlines

* added validation option and adjusted object referencing

* adjusted validation method call in post_validation

* addressed flake errors for multiple spaces

* added transform method to NewTermsRuleData class

* added validation for min stack version and new terms array length restraints

* added validation for unique new terms array

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* removed historywindowstart definition and adjusted subclass

* removed test rule from commit

* adjusted if/else for data transform method check

* adjusted stack-schema-map; validation method name

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* added assertion for history_window_start field value

* added variables for feature min stack and extended field min stack

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* addressed flake errors for continuation line with same indent

Co-authored-by: Mika Ayenson <[email protected]>

(cherry picked from commit 7e459dd)
protectionsmachine pushed a commit that referenced this pull request Dec 5, 2022
* adding support new_terms_fields and window_start_history

* adjusted rule.py to address flake errors

* added assertion error if history_window_start does not exist

* removed sample rule

* removed self.rule_id from DataValidator

* added new_terms to RuleType

* changed new terms to its own class in rule.py

* removed nonexisting function call in DataValidator class

* adjusted new_terms field value in dataclass

* changed literal type for history_window_start; view-rule working

* removing test TOML rule

* addressed flake errors for missing newlines

* added validation option and adjusted object referencing

* adjusted validation method call in post_validation

* addressed flake errors for multiple spaces

* added transform method to NewTermsRuleData class

* added validation for min stack version and new terms array length restraints

* added validation for unique new terms array

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* removed historywindowstart definition and adjusted subclass

* removed test rule from commit

* adjusted if/else for data transform method check

* adjusted stack-schema-map; validation method name

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* added assertion for history_window_start field value

* added variables for feature min stack and extended field min stack

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* addressed flake errors for continuation line with same indent

Co-authored-by: Mika Ayenson <[email protected]>

(cherry picked from commit 7e459dd)
protectionsmachine pushed a commit that referenced this pull request Dec 5, 2022
* adding support new_terms_fields and window_start_history

* adjusted rule.py to address flake errors

* added assertion error if history_window_start does not exist

* removed sample rule

* removed self.rule_id from DataValidator

* added new_terms to RuleType

* changed new terms to its own class in rule.py

* removed nonexisting function call in DataValidator class

* adjusted new_terms field value in dataclass

* changed literal type for history_window_start; view-rule working

* removing test TOML rule

* addressed flake errors for missing newlines

* added validation option and adjusted object referencing

* adjusted validation method call in post_validation

* addressed flake errors for multiple spaces

* added transform method to NewTermsRuleData class

* added validation for min stack version and new terms array length restraints

* added validation for unique new terms array

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* removed historywindowstart definition and adjusted subclass

* removed test rule from commit

* adjusted if/else for data transform method check

* adjusted stack-schema-map; validation method name

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* added assertion for history_window_start field value

* added variables for feature min stack and extended field min stack

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* addressed flake errors for continuation line with same indent

Co-authored-by: Mika Ayenson <[email protected]>

(cherry picked from commit 7e459dd)
protectionsmachine pushed a commit that referenced this pull request Dec 5, 2022
* adding support new_terms_fields and window_start_history

* adjusted rule.py to address flake errors

* added assertion error if history_window_start does not exist

* removed sample rule

* removed self.rule_id from DataValidator

* added new_terms to RuleType

* changed new terms to its own class in rule.py

* removed nonexisting function call in DataValidator class

* adjusted new_terms field value in dataclass

* changed literal type for history_window_start; view-rule working

* removing test TOML rule

* addressed flake errors for missing newlines

* added validation option and adjusted object referencing

* adjusted validation method call in post_validation

* addressed flake errors for multiple spaces

* added transform method to NewTermsRuleData class

* added validation for min stack version and new terms array length restraints

* added validation for unique new terms array

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* removed historywindowstart definition and adjusted subclass

* removed test rule from commit

* adjusted if/else for data transform method check

* adjusted stack-schema-map; validation method name

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* added assertion for history_window_start field value

* added variables for feature min stack and extended field min stack

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* addressed flake errors for continuation line with same indent

Co-authored-by: Mika Ayenson <[email protected]>

(cherry picked from commit 7e459dd)
protectionsmachine pushed a commit that referenced this pull request Dec 5, 2022
* adding support new_terms_fields and window_start_history

* adjusted rule.py to address flake errors

* added assertion error if history_window_start does not exist

* removed sample rule

* removed self.rule_id from DataValidator

* added new_terms to RuleType

* changed new terms to its own class in rule.py

* removed nonexisting function call in DataValidator class

* adjusted new_terms field value in dataclass

* changed literal type for history_window_start; view-rule working

* removing test TOML rule

* addressed flake errors for missing newlines

* added validation option and adjusted object referencing

* adjusted validation method call in post_validation

* addressed flake errors for multiple spaces

* added transform method to NewTermsRuleData class

* added validation for min stack version and new terms array length restraints

* added validation for unique new terms array

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* removed historywindowstart definition and adjusted subclass

* removed test rule from commit

* adjusted if/else for data transform method check

* adjusted stack-schema-map; validation method name

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* added assertion for history_window_start field value

* added variables for feature min stack and extended field min stack

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* addressed flake errors for continuation line with same indent

Co-authored-by: Mika Ayenson <[email protected]>

(cherry picked from commit 7e459dd)
protectionsmachine pushed a commit that referenced this pull request Dec 5, 2022
* adding support new_terms_fields and window_start_history

* adjusted rule.py to address flake errors

* added assertion error if history_window_start does not exist

* removed sample rule

* removed self.rule_id from DataValidator

* added new_terms to RuleType

* changed new terms to its own class in rule.py

* removed nonexisting function call in DataValidator class

* adjusted new_terms field value in dataclass

* changed literal type for history_window_start; view-rule working

* removing test TOML rule

* addressed flake errors for missing newlines

* added validation option and adjusted object referencing

* adjusted validation method call in post_validation

* addressed flake errors for multiple spaces

* added transform method to NewTermsRuleData class

* added validation for min stack version and new terms array length restraints

* added validation for unique new terms array

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* removed historywindowstart definition and adjusted subclass

* removed test rule from commit

* adjusted if/else for data transform method check

* adjusted stack-schema-map; validation method name

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* added assertion for history_window_start field value

* added variables for feature min stack and extended field min stack

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* Update detection_rules/rule.py

Co-authored-by: Mika Ayenson <[email protected]>

* addressed flake errors for continuation line with same indent

Co-authored-by: Mika Ayenson <[email protected]>

(cherry picked from commit 7e459dd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport: auto enhancement New feature or request python Internal python for the repository schema
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FR] Add Support for "New Terms" Field in Rules
4 participants