Skip to content

Conversation

@shashank-elastic
Copy link
Contributor

@shashank-elastic shashank-elastic commented Oct 28, 2025

Pull Request

Issue link(s): NA

Summary - What I changed

  • Collated Renovate Upgrades from the below PR into one single update.
  1. Update dependency Click to ~=8.3.0 #5098
  2. Update dependency PyGithub to v2.8.1 #5099
  3. Update dependency flake8 to v7.3.0 #5102
  4. Update dependency marko to v2.2.1 #5103
  5. Update dependency nodeenv to v1.9.1 #5117
  6. Update dependency pep8-naming to v0.15.1 #5120
  7. Update dependency pre-commit to v3.8.0 #5121
  8. Update dependency pyflakes to v3.4.0 #5126

How To Test

Installed Updated Packages
pip install Click~=8.3.0 marko==2.2.1 PyGithub==2.8.1 pep8-naming==0.15.1 flake8==7.3.0 pyflakes==3.4.0 nodeenv==1.9.1 pre-commit==3.8.0 
Looking in indexes: https://pypi.org/simple, https://shashank.suryanarayana%40elastic.co:****@artifactory.elastic.dev/artifactory/api/pypi/pypi-endgame/simple
Requirement already satisfied: Click~=8.3.0 in ./.venv/lib/python3.12/site-packages (8.3.0)
Collecting marko==2.2.1
  Downloading marko-2.2.1-py3-none-any.whl.metadata (4.5 kB)
Collecting PyGithub==2.8.1
  Using cached pygithub-2.8.1-py3-none-any.whl.metadata (3.9 kB)
Collecting pep8-naming==0.15.1
  Downloading pep8_naming-0.15.1-py3-none-any.whl.metadata (7.4 kB)
Collecting flake8==7.3.0
  Using cached flake8-7.3.0-py2.py3-none-any.whl.metadata (3.8 kB)
Collecting pyflakes==3.4.0
  Using cached pyflakes-3.4.0-py2.py3-none-any.whl.metadata (3.5 kB)
Collecting nodeenv==1.9.1
  Downloading nodeenv-1.9.1-py2.py3-none-any.whl.metadata (21 kB)
Collecting pre-commit==3.8.0
  Downloading pre_commit-3.8.0-py2.py3-none-any.whl.metadata (1.3 kB)
Requirement already satisfied: pynacl>=1.4.0 in ./.venv/lib/python3.12/site-packages (from PyGithub==2.8.1) (1.5.0)
Requirement already satisfied: requests>=2.14.0 in ./.venv/lib/python3.12/site-packages (from PyGithub==2.8.1) (2.31.0)
Requirement already satisfied: pyjwt>=2.4.0 in ./.venv/lib/python3.12/site-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.8.1) (2.10.1)
Requirement already satisfied: typing-extensions>=4.5.0 in ./.venv/lib/python3.12/site-packages (from PyGithub==2.8.1) (4.14.1)
Requirement already satisfied: urllib3>=1.26.0 in ./.venv/lib/python3.12/site-packages (from PyGithub==2.8.1) (2.5.0)
Requirement already satisfied: mccabe<0.8.0,>=0.7.0 in ./.venv/lib/python3.12/site-packages (from flake8==7.3.0) (0.7.0)
Collecting pycodestyle<2.15.0,>=2.14.0 (from flake8==7.3.0)
  Using cached pycodestyle-2.14.0-py2.py3-none-any.whl.metadata (4.5 kB)
Requirement already satisfied: cfgv>=2.0.0 in ./.venv/lib/python3.12/site-packages (from pre-commit==3.8.0) (3.4.0)
Requirement already satisfied: identify>=1.0.0 in ./.venv/lib/python3.12/site-packages (from pre-commit==3.8.0) (2.6.12)
Requirement already satisfied: pyyaml>=5.1 in ./.venv/lib/python3.12/site-packages (from pre-commit==3.8.0) (6.0.2)
Requirement already satisfied: virtualenv>=20.10.0 in ./.venv/lib/python3.12/site-packages (from pre-commit==3.8.0) (20.31.2)
Requirement already satisfied: cryptography>=3.4.0 in ./.venv/lib/python3.12/site-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.8.1) (45.0.4)
Requirement already satisfied: cffi>=1.14 in ./.venv/lib/python3.12/site-packages (from cryptography>=3.4.0->pyjwt[crypto]>=2.4.0->PyGithub==2.8.1) (1.17.1)
Requirement already satisfied: pycparser in ./.venv/lib/python3.12/site-packages (from cffi>=1.14->cryptography>=3.4.0->pyjwt[crypto]>=2.4.0->PyGithub==2.8.1) (2.22)
Requirement already satisfied: charset-normalizer<4,>=2 in ./.venv/lib/python3.12/site-packages (from requests>=2.14.0->PyGithub==2.8.1) (3.4.2)
Requirement already satisfied: idna<4,>=2.5 in ./.venv/lib/python3.12/site-packages (from requests>=2.14.0->PyGithub==2.8.1) (3.10)
Requirement already satisfied: certifi>=2017.4.17 in ./.venv/lib/python3.12/site-packages (from requests>=2.14.0->PyGithub==2.8.1) (2025.6.15)
Requirement already satisfied: distlib<1,>=0.3.7 in ./.venv/lib/python3.12/site-packages (from virtualenv>=20.10.0->pre-commit==3.8.0) (0.3.9)
Requirement already satisfied: filelock<4,>=3.12.2 in ./.venv/lib/python3.12/site-packages (from virtualenv>=20.10.0->pre-commit==3.8.0) (3.18.0)
Requirement already satisfied: platformdirs<5,>=3.9.1 in ./.venv/lib/python3.12/site-packages (from virtualenv>=20.10.0->pre-commit==3.8.0) (4.3.8)
Downloading marko-2.2.1-py3-none-any.whl (42 kB)
Using cached pygithub-2.8.1-py3-none-any.whl (432 kB)
Downloading pep8_naming-0.15.1-py3-none-any.whl (9.6 kB)
Using cached flake8-7.3.0-py2.py3-none-any.whl (57 kB)
Using cached pyflakes-3.4.0-py2.py3-none-any.whl (63 kB)
Downloading nodeenv-1.9.1-py2.py3-none-any.whl (22 kB)
Downloading pre_commit-3.8.0-py2.py3-none-any.whl (204 kB)
Using cached pycodestyle-2.14.0-py2.py3-none-any.whl (31 kB)
Installing collected packages: pyflakes, pycodestyle, nodeenv, marko, pre-commit, flake8, pep8-naming, PyGithub
  Attempting uninstall: pyflakes
    Found existing installation: pyflakes 3.2.0
    Uninstalling pyflakes-3.2.0:
      Successfully uninstalled pyflakes-3.2.0
  Attempting uninstall: pycodestyle
    Found existing installation: pycodestyle 2.11.1
    Uninstalling pycodestyle-2.11.1:
      Successfully uninstalled pycodestyle-2.11.1
  Attempting uninstall: nodeenv
    Found existing installation: nodeenv 1.8.0
    Uninstalling nodeenv-1.8.0:
      Successfully uninstalled nodeenv-1.8.0
  Attempting uninstall: marko
    Found existing installation: marko 2.0.3
    Uninstalling marko-2.0.3:
      Successfully uninstalled marko-2.0.3
  Attempting uninstall: pre-commit
    Found existing installation: pre-commit 3.6.2
    Uninstalling pre-commit-3.6.2:
      Successfully uninstalled pre-commit-3.6.2
  Attempting uninstall: flake8
    Found existing installation: flake8 7.0.0
    Uninstalling flake8-7.0.0:
      Successfully uninstalled flake8-7.0.0
  Attempting uninstall: pep8-naming
    Found existing installation: pep8-naming 0.13.0
    Uninstalling pep8-naming-0.13.0:
      Successfully uninstalled pep8-naming-0.13.0
  Attempting uninstall: PyGithub
    Found existing installation: PyGithub 2.2.0
    Uninstalling PyGithub-2.2.0:
      Successfully uninstalled PyGithub-2.2.0

Successfully installed PyGithub-2.8.1 flake8-7.3.0 marko-2.2.1 nodeenv-1.9.1 pep8-naming-0.15.1 pre-commit-3.8.0 pycodestyle-2.14.0 pyflakes-3.4.0

[notice] A new release of pip is available: 25.1.1 -> 25.3
[notice] To update, run: pip install --upgrade pip
Click Upgrade
python -m detection_rules  -h                 
Loaded config file: /Users/shashankks/elastic_workspace/detection-rules/.detection-rules-cfg.json

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

Usage: detection_rules [OPTIONS] COMMAND [ARGS]...

  Commands for detection-rules repository.

Options:
  -D, --debug / -N, --no-debug  Print full exception stacktrace on errors
  -h, --help                    Show this message and exit.

Commands:
  build-limited-rules     Import rules from json, toml, or Kibana exported rule file(s), filter out unsupported ones, and write to output NDJSON file.
  build-threat-map-entry  Build a threat map entry.
  create-rule             Create a detection rule.
  custom-rules            Commands for supporting custom rules.
  dev                     Commands related to the Elastic Stack rules release lifecycle.
  es                      Commands for integrating with Elasticsearch.
  export-rules-from-repo  Export rule(s) and exception(s) into an importable ndjson file.
  generate-rules-index    Generate enriched indexes of rules, based on a KQL search, for indexing/importing into elasticsearch/kibana.
  import-rules-to-repo    Import rules from json, toml, or yaml files containing Kibana exported rule(s).
  kibana                  Commands for integrating with Kibana.
  mass-update             Update multiple rules based on eql results.
  normalize-data          Normalize Elasticsearch data timestamps and sort.
  rule-search             Use KQL or EQL to find matching rules.
  test                    Run unit tests over all of the rules.
  toml-lint               Cleanup files with some simple toml formatting.
  typosquat               Commands for generating typosquat detections.
  validate-all            Check if all rules validates against a schema.
  validate-rule           Check if a rule staged in rules dir validates against a schema.
  view-rule               View an internal rule or specified rule file.

detection-rules on  renovate_updates [$?] is 📦 v1.5.6 via 🐍 v3.12.8 (.venv) on ☁️  [email protected] 

click is used in basic BANNER display as well

PyGithub Testing
check-version-lock command uses Github operations and clients python -m detection_rules dev check-version-lock --pr-number 5247
Loaded config file: /Users/shashankks/elastic_workspace/detection-rules/.detection-rules-cfg.json

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

Fetching version lock file from PR #5247
No double bumps detected.

detection-rules on  renovate_updates [$?] is 📦 v1.5.6 via 🐍 v3.12.8 (.venv) on ☁️  [email protected] took 8s 
marko

view-rule Uses marko to parse the note field into a new setup restricted field

python -m detection_rules view-rule rules/integrations/aws/ml_cloudtrail_error_message_spike.toml --api-format
Loaded config file: /Users/shashankks/elastic_workspace/detection-rules/.detection-rules-cfg.json

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

{
  "anomaly_threshold": 50,
  "author": [
    "Elastic"
  ],
  "description": "A machine learning job detected a significant spike in the rate of a particular error in the CloudTrail messages. Spikes in error messages may accompany attempts at privilege escalation, lateral movement, or discovery.",
  "false_positives": [
    "Spikes in error message activity can also be due to bugs in cloud automation scripts or workflows; changes to cloud automation scripts or workflows; adoption of new services; changes in the way services are used; or changes to IAM privileges."
  ],
  "from": "now-60m",
  "interval": "15m",
  "license": "Elastic License v2",
  "machine_learning_job_id": "high_distinct_count_error_message",
  "name": "Spike in AWS Error Messages",
  "note": "## Triage and analysis\n\n### Investigating Spike in AWS Error Messages\n\nCloudTrail logging provides visibility on actions taken within an AWS environment. By monitoring these events and understanding what is considered normal behavior within an organization, you can spot suspicious or malicious activity when deviations occur.\n\nThis rule uses a machine learning job to detect a significant spike in the rate of a particular error in the CloudTrail messages. Spikes in error messages may accompany attempts at privilege escalation, lateral movement, or discovery.\n\n#### Possible investigation steps\n\n- Examine the history of the error. If the error only manifested recently, it might be related to recent changes in an automation module or script. You can find the error in the `aws.cloudtrail.error_code field` field.\n- Investigate other alerts associated with the user account during the past 48 hours.\n- Validate the activity is not related to planned patches, updates, or network administrator activity.\n- Examine the request parameters. These may indicate the source of the program or the nature of the task being performed when the error occurred.\n    - Check whether the error is related to unsuccessful attempts to enumerate or access objects, data, or secrets.\n- Considering the source IP address and geolocation of the user who issued the command:\n    - Do they look normal for the calling user?\n    - If the source is an EC2 IP address, is it associated with an EC2 instance in one of your accounts or is the source IP from an EC2 instance that's not under your control?\n    - If it is an authorized EC2 instance, is the activity associated with normal behavior for the instance role or roles? Are there any other alerts or signs of suspicious activity involving this instance?\n- Consider the time of day. If the user is a human (not a program or script), did the activity take place during a normal time of day?\n- Contact the account owner and confirm whether they are aware of this activity if suspicious.\n- If you suspect the account has been compromised, scope potentially compromised assets by tracking servers, services, and data accessed by the account in the last 24 hours.\n\n### False positive analysis\n\n- Examine the history of the command. If the command only manifested recently, it might be part of a new automation module or script. If it has a consistent cadence (for example, it appears in small numbers on a weekly or monthly cadence), it might be part of a housekeeping or maintenance process. You can find the command in the `event.action field` field.\n- The adoption of new services or the addition of new functionality to scripts may generate false positives.\n\n### Related Rules\n\n- Unusual City For an AWS Command - 809b70d3-e2c3-455e-af1b-2626a5a1a276\n- Unusual Country For an AWS Command - dca28dee-c999-400f-b640-50a081cc0fd1\n- Unusual AWS Command for a User - ac706eae-d5ec-4b14-b4fd-e8ba8086f0e1\n- Rare AWS Error Code - 19de8096-e2b0-4bd8-80c9-34a820813fff\n\n### Response and remediation\n\n- Initiate the incident response process based on the outcome of the triage.\n- Disable or limit the account during the investigation and response.\n- Identify the possible impact of the incident and prioritize accordingly; the following actions can help you gain context:\n    - Identify the account role in the cloud environment.\n    - Assess the criticality of affected services and servers.\n    - Work with your IT team to identify and minimize the impact on users.\n    - Identify if the attacker is moving laterally and compromising other accounts, servers, or services.\n    - Identify any regulatory or legal ramifications related to this activity.\n- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords or delete API keys as needed to revoke the attacker's access to the environment. Work with your IT teams to minimize the impact on business operations during these actions.\n- Check if unauthorized new users were created, remove unauthorized new accounts, and request password resets for other IAM users.\n- Consider enabling multi-factor authentication for users.\n- Review the permissions assigned to the implicated user to ensure that the least privilege principle is being followed.\n- Implement security best practices [outlined](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/) by AWS.\n- Take the actions needed to return affected systems, data, or services to their normal operational levels.\n- Identify the initial vector abused by the attacker and take action to prevent reinfection via the same vector.\n- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).\n",
  "references": [
    "https://www.elastic.co/guide/en/security/current/prebuilt-ml-jobs.html"
  ],
  "related_integrations": [
    {
      "package": "aws",
      "version": "^4.0.0"
    }
  ],
  "risk_score": 21,
  "rule_id": "78d3d8d9-b476-451d-a9e0-7a5addd70670",
  "setup": "## Setup\n\nThis rule requires the installation of associated Machine Learning jobs, as well as data coming in from AWS.\n\n### Anomaly Detection Setup\n\nOnce the rule is enabled, the associated Machine Learning job will start automatically. You can view the Machine Learning job linked under the \"Definition\" panel of the detection rule. If the job does not start due to an error, the issue must be resolved for the job to commence successfully. For more details on setting up anomaly detection jobs, refer to the [helper guide](https://www.elastic.co/guide/en/kibana/current/xpack-ml-anomalies.html).\n\n### AWS Integration Setup\nThe AWS integration allows you to collect logs and metrics from Amazon Web Services (AWS) with Elastic Agent.\n\n#### The following steps should be executed in order to add the Elastic Agent System integration \"aws\" to your system:\n- Go to the Kibana home page and click \u201cAdd integrations\u201d.\n- In the query bar, search for \u201cAWS\u201d and select the integration to see more details about it.\n- Click \u201cAdd AWS\u201d.\n- Configure the integration name and optionally add a description.\n- Review optional and advanced settings accordingly.\n- Add the newly installed \u201caws\u201d to an existing or a new agent policy, and deploy the agent on your system from which aws log files are desirable.\n- Click \u201cSave and Continue\u201d.\n- For more details on the integration refer to the [helper guide](https://www.elastic.co/docs/current/integrations/aws).\n",
  "severity": "low",
  "tags": [
    "Domain: Cloud",
    "Data Source: AWS",
    "Data Source: Amazon Web Services",
    "Rule Type: ML",
    "Rule Type: Machine Learning",
    "Resources: Investigation Guide"
  ],
  "type": "machine_learning",
  "version": 211
}

detection-rules on  renovate_updates [$?] is 📦 v1.5.6 via 🐍 v3.12.8 (.venv) on ☁️  [email protected] 

For project.optional-dependencies --> Code checks should pass

  • Fixed some code checks
  • Currently Code Checks are passing in the PR
  • This covers Lint Format and pyright Tests
make test-cli
loading rules to determine all integration tags
loaded endpoint manifests from the following package versions: ['9.2.0', '9.1.0', '9.0.2', '9.0.1', '9.0.0', '8.19.0', '8.18.1', '8.18.0', '8.17.1', '8.17.0', '8.16.1', '8.16.0', '8.15.2', '8.15.1', '8.15.0', '8.14.0', '8.13.0', '8.12.0', '8.11.1', '8.11.0', '8.10.2', '8.10.1', '8.10.0', '8.9.1', '8.9.0', '8.8.0', '8.7.1', '8.7.0', '8.6.1', '8.6.0', '8.5.0', '8.4.1', '8.4.0', '8.3.0', '8.2.0', '1.5.0', '1.4.1', '1.4.0', '1.3.0', '1.2.2', '1.2.1', '1.2.0', '1.1.1', '1.1.0', '1.0.0']
final integrations manifests dumped: /Users/shashankks/elastic_workspace/detection-rules/detection_rules/etc/integration-manifests.json.gz
Building schemas for integrations
Loaded config file: /Users/shashankks/elastic_workspace/detection-rules/.detection-rules-cfg.json

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

Building integration schemas...
processing endpoint
final integrations manifests dumped: /Users/shashankks/elastic_workspace/detection-rules/detection_rules/etc/integration-schemas.json.gz
Detection-rules CLI tests completed!

detection-rules on  renovate_updates [$✘!?] is 📦 v1.5.6 via 🐍 v3.12.8 (.venv) on ☁️  [email protected] took 8m46s 
make test-remote-cli
Running detection-rules remote CLI tests...
Performing a quick rule alerts search...
Requires .detection-rules-cfg.json credentials file set.
Loaded config file: /Users/shashankks/elastic_workspace/detection-rules/.detection-rules-cfg.json

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

==================================================================================================================================================
                                                                                      kibana                                                      
                                                                                      alert                                                       
 host                           rule                                                                                                              
 hostname                       name                                                                            status   original_time            
==================================================================================================================================================
 e2e-release-test-instance-2    Malicious Behavior Detection Alert: DARKRADIATION Ransomware Infection          active   2025-10-29T07:02:14.868Z 
 trade-test-local-vm.local      Malicious Behavior Detection Alert: DARKRADIATION Ransomware Infection          active   2025-10-29T07:02:09.455Z 
 e2e-release-windows-server-2   Malicious Behavior Detection Alert: Suspicious Bitsadmin Activity               active   2025-10-29T06:57:57.063Z 
 e2e-release-windows-server-2   Malicious Behavior Detection Alert: Suspicious Microsoft Office Child Process   active   2025-10-29T06:57:57.098Z 
 trade-test-local-vm.local      Malicious Behavior Detection Alert: DARKRADIATION Ransomware Infection          active   2025-10-27T19:54:51.784Z 
 e2e-release-windows-server-2   Malicious Behavior Detection Alert: Suspicious Microsoft Office Child Process   active   2025-10-27T19:53:00.502Z 
 e2e-release-windows-server-2   Malicious Behavior Detection Alert: Suspicious Bitsadmin Activity               active   2025-10-27T19:53:00.543Z 
 e2e-release-test-instance-2    Malicious Behavior Detection Alert: DARKRADIATION Ransomware Infection          active   2025-10-27T19:52:02.888Z 
==================================================================================================================================================
Setting Up Custom Directory...
Loaded config file: /Users/shashankks/elastic_workspace/detection-rules/.detection-rules-cfg.json

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

Created directory: tmp-custom/actions
Created directory: tmp-custom/action_connectors
Created directory: tmp-custom/exceptions
Created directory: tmp-custom/rules
Created directory: tmp-custom/rules_building_block
Created directory: tmp-custom/etc
Created file with default content: tmp-custom/etc/deprecated_rules.json
Created file with default content: tmp-custom/etc/version.lock.json
Created file with default content: tmp-custom/etc/packages.yaml
Created file with default content: tmp-custom/etc/stack-schema-map.yaml
Created file with default content: tmp-custom/etc/test_config.yaml
Created file with default content: tmp-custom/_config.yaml

# For details on how to configure the _config.yaml file,
# consult: /Users/shashankks/elastic_workspace/detection-rules/detection_rules/etc/_config.yaml
# or the docs: /Users/shashankks/elastic_workspace/detection-rules/docs-dev/custom-rules-management.md
Performing a rule conversion from ndjson to toml files...
Loaded config file: /Users/shashankks/elastic_workspace/detection-rules/.detection-rules-cfg.json

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

[+] Building rule for tmp-custom/rules/test_kql_rule.toml
risk_score (required): 21
[+] Building rule for tmp-custom/rules/test_kql_with_alert_supprestion_and_investigation_fileds.toml
risk_score (required): 21
[+] Building rule for tmp-custom/rules/test_kql_with_alert_suppression.toml
risk_score (required): 21
[+] Building rule for tmp-custom/rules/test_eql_rule.toml
risk_score (required): 21
[+] Building rule for tmp-custom/rules/test_esql_rule_with_shared_rule_exception.toml
risk_score (required): 21
/Users/shashankks/elastic_workspace/detection-rules/detection_rules/index_mappings.py:344: ElasticsearchWarning: No limit defined, adding default limit of [1000]
  response = elastic_client.esql.query(query=query)
[+] Building rule for tmp-custom/rules/test_new_terms_rule_with_shared_rule_exception.toml
risk_score (required): 21
[+] Building rule for tmp-custom/rules/test_indicator_match_rule_with_email_actions.toml
risk_score (required): 21
[+] Building rule for tmp-custom/rules/test_threshold_with_rule_exception.toml
risk_score (required): 21
[+] Building rule for tmp-custom/rules/test_machine_learning_rule_with_index_action_connector.toml
risk_score (required): 21
[+] Building exception(s) for /Users/shashankks/elastic_workspace/detection-rules/tmp-custom/exceptions/1c8a1378-8f0d-4565-9ae0-abeeaf3981ca_exceptions.toml
[+] Building exception(s) for /Users/shashankks/elastic_workspace/detection-rules/tmp-custom/exceptions/0a4124f8-2074-450b-8689-d7dee319c666_exceptions.toml
[+] Building action connector(s) for /Users/shashankks/elastic_workspace/detection-rules/tmp-custom/action_connectors/e1b418e7-78df-4042-bfb0-1cc5fb6f7a4e_actions.toml
14 results exported
9 rules converted
4 exceptions exported
1 actions connectors exported
Performing a rule import to kibana...
Loaded config file: /Users/shashankks/elastic_workspace/detection-rules/.detection-rules-cfg.json

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

/Users/shashankks/elastic_workspace/detection-rules/detection_rules/index_mappings.py:344: ElasticsearchWarning: No limit defined, adding default limit of [1000]
  response = elastic_client.esql.query(query=query)
9 rule(s) successfully imported
 - 2cc8f325-e1b1-4201-8b8d-88a51c94992b
 - 7e0f6dae-5847-465f-89e9-a6de0e9ef918
 - 4c589d81-2622-4036-8cc7-372ea8f0e038
 - bcbd5906-fc38-4cbe-8b54-c2dba5d4b127
 - 2c6c5352-11cb-40a5-9294-e61ef5f1954f
 - 742feb36-ac4c-45e0-b8a5-3b3cfa66b6d2
 - 8a3296e2-4a74-4d51-b819-8d4e58377bf7
 - 2390c9dd-ad90-4af6-97a4-1d607ba0f092
 - d46a29ca-9b5b-4cbd-b11f-35c6b59f207b
1 exception list(s) successfully imported
 - 0a4124f8-2074-450b-8689-d7dee319c666
1 action connector(s) successfully imported
 - e1b418e7-78df-4042-bfb0-1cc5fb6f7a4e
Performing a rule export...
Loaded config file: /Users/shashankks/elastic_workspace/detection-rules/.detection-rules-cfg.json

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

/Users/shashankks/elastic_workspace/detection-rules/detection_rules/index_mappings.py:344: ElasticsearchWarning: No limit defined, adding default limit of [1000]
  response = elastic_client.esql.query(query=query)
14 results exported
9 rules converted
2 exceptions exported
1 action connectors exported
9 rules saved to tmp-custom
2 exception lists saved to /Users/shashankks/elastic_workspace/detection-rules/tmp-custom/exceptions
1 action connectors saved to /Users/shashankks/elastic_workspace/detection-rules/tmp-custom/action_connectors
Testing ESQL Rules...
============================================================================================================ test session starts =============================================================================================================
platform darwin -- Python 3.12.8, pytest-8.4.2, pluggy-1.6.0
rootdir: /Users/shashankks/elastic_workspace/detection-rules
configfile: pyproject.toml
plugins: typeguard-4.4.4
collected 11 items                                                                                                                                                                                                                           

tests/test_rules_remote.py ...........                                                                                                                                                                                                 [100%]

============================================================================================================== warnings summary ==============================================================================================================
tests/test_rules_remote.py::TestRemoteRules::test_esql_endpoint_alerts_index
tests/test_rules_remote.py::TestRemoteRules::test_esql_endpoint_alerts_index_endpoint_fields
tests/test_rules_remote.py::TestRemoteRules::test_esql_filtered_index
tests/test_rules_remote.py::TestRemoteRules::test_esql_non_dataset_package_related_integrations
tests/test_rules_remote.py::TestRemoteRules::test_esql_related_integrations
  /Users/shashankks/elastic_workspace/detection-rules/detection_rules/index_mappings.py:344: ElasticsearchWarning: No limit defined, adding default limit of [1000]
    response = elastic_client.esql.query(query=query)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================================= 11 passed, 5 warnings in 117.24s (0:01:57) =================================================================================================
Removing generated files...
Detection-rules Remote CLI tests completed!

detection-rules on  renovate_updates [$!?] is 📦 v1.5.6 via 🐍 v3.12.8 (.venv) on ☁️  [email protected] took 3m4s 
## Checklist
  • Added a label for the type of pr: bug, enhancement, schema, maintenance, Rule: New, Rule: Deprecation, Rule: Tuning, Hunt: New, or Hunt: Tuning so guidelines can be generated
  • Added the meta:rapid-merge label if planning to merge within 24 hours
  • Secret and sensitive material has been managed correctly
  • Automated testing was updated or added to match the most common scenarios
  • Documentation and comments were added for features that require explanation

Contributor checklist

@github-actions
Copy link
Contributor

Enhancement - Guidelines

These guidelines serve as a reminder set of considerations when addressing adding a feature to the code.

Documentation and Context

  • Describe the feature enhancement in detail (alternative solutions, description of the solution, etc.) if not already documented in an issue.
  • Include additional context or screenshots.
  • Ensure the enhancement includes necessary updates to the documentation and versioning.

Code Standards and Practices

  • Code follows established design patterns within the repo and avoids duplication.
  • Ensure that the code is modular and reusable where applicable.

Testing

  • New unit tests have been added to cover the enhancement.
  • Existing unit tests have been updated to reflect the changes.
  • Provide evidence of testing and validating the enhancement (e.g., test logs, screenshots).
  • Validate that any rules affected by the enhancement are correctly updated.
  • Ensure that performance is not negatively impacted by the changes.
  • Verify that any release artifacts are properly generated and tested.
  • Conducted system testing, including fleet, import, and create APIs (e.g., run make test-cli, make test-remote-cli, make test-hunting-cli)

Additional Checks

  • Verify that the enhancement works across all relevant environments (e.g., different OS versions).
  • Confirm that the proper version label is applied to the PR patch, minor, major.

@shashank-elastic shashank-elastic marked this pull request as draft October 28, 2025 18:09
@shashank-elastic
Copy link
Contributor Author

shashank-elastic commented Oct 29, 2025

Wed 29 Oct Update

  • We did some code changes to make sure ruff checks are passed.
  • The make test works as expected.
  • The make test-remote-cli is running into issues.
  • Some of the issues are fixed in PR - [Bug] [DAC] Auto Gen Schema Fails on Certain Subqueries  #5256
  • Although I pulled in the new ndjson we continue to run into one export error like below
Performing a rule import to kibana...
Loaded config file: /Users/shashankks/elastic_workspace/detection-rules/.detection-rules-cfg.json

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

/Users/shashankks/elastic_workspace/detection-rules/detection_rules/index_mappings.py:344: ElasticsearchWarning: No limit defined, adding default limit of [1000]
  response = elastic_client.esql.query(query=query)
8 rule(s) successfully imported
 - 2cc8f325-e1b1-4201-8b8d-88a51c94992b
 - 4c589d81-2622-4036-8cc7-372ea8f0e038
 - bcbd5906-fc38-4cbe-8b54-c2dba5d4b127
 - 2c6c5352-11cb-40a5-9294-e61ef5f1954f
 - 742feb36-ac4c-45e0-b8a5-3b3cfa66b6d2
 - 8a3296e2-4a74-4d51-b819-8d4e58377bf7
 - 2390c9dd-ad90-4af6-97a4-1d607ba0f092
 - d46a29ca-9b5b-4cbd-b11f-35c6b59f207b
1 rule(s) failed to import!
 - 7e0f6dae-5847-465f-89e9-a6de0e9ef918: (400) params invalid: [
  {
    "code": "invalid_union",
    "unionErrors": [
      {
        "issues": [
          {
            "received": "esql",
            "code": "invalid_literal",
            "expected": "query",
            "path": [
              "type"
            ],
            "message": "Invalid literal value, expected \"query\""
          },
          {
            "received": "esql",
            "code": "invalid_enum_value",
            "options": [
              "kuery",
              "lucene"
            ],
            "path": [
              "language"
            ],
            "message": "Invalid enum value. Expected 'kuery' | 'lucene', received 'esql'"
          }
        ],
        "name": "ZodError"
      },
      {
        "issues": [
          {
            "received": "esql",
            "code": "invalid_literal",
            "expected": "saved_query",
            "path": [
              "type"
            ],
            "message": "Invalid literal value, expected \"saved_query\""
          },
          {
            "received": "esql",
            "code": "invalid_enum_value",
            "options": [
              "kuery",
              "lucene"
            ],
            "path": [
              "language"
            ],
            "message": "Invalid enum value. Expected 'kuery' | 'lucene', received 'esql'"
          },
          {
            "code": "invalid_type",
            "expected": "string",
            "received": "undefined",
            "path": [
              "savedId"
            ],
            "message": "Required"
          }
        ],
        "name": "ZodError"
      }
    ],
    "path": [],
    "message": "Invalid input"
  }
]
Performing a rule export...

Conclusion

@shashank-elastic shashank-elastic marked this pull request as ready for review October 29, 2025 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants