Skip to content

[Rule Tuning] ESQL Query Field Dynamic Field Standardization #4912

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

Open
wants to merge 86 commits into
base: main
Choose a base branch
from

Conversation

terrancedejesus
Copy link
Contributor

Pull Request

Issue link(s):

Summary - What I changed

Adjusts all ESQL queries in detection rules to standard field names based on previously established guidelines. Please see related issue and other related issues for more details.

How To Test

Almost all queries have been tested in the TRADE serverless stack to confirm logic was not adjusted unintentionally. It is recommended that anyone reviewing - if a query was written by them to test it on their own dataset to ensure logic has not changed.

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

@botelastic botelastic bot added bbr Building Block Rules Domain: Cloud Domain: Endpoint Integration: AWS AWS related rules Integration: Azure azure related rules Integration: Microsoft 365 Integration: Okta okta related rules OS: Linux OS: Windows windows related rules Rule: Deprecation removal of a rule labels Jul 24, 2025
@tradebot-elastic
Copy link

tradebot-elastic commented Jul 24, 2025

⛔️ Test failed

Results
  • ❌ Potential PowerShell Obfuscation via Concatenated Dynamic Command Invocation (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS Bedrock Guardrails Detected Multiple Violations by a Single User Over a Session (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Microsoft Entra ID Session Reuse with Suspicious Graph Access (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS Access Token Used from Multiple Addresses (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual High Denied Sensitive Information Policy Blocks Detected (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ M365 OneDrive Excessive File Downloads with OAuth Token (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS S3 Static Site JavaScript File Uploaded (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS Bedrock Detected Multiple Attempts to use Denied Models by a Single User (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS Service Quotas Multi-Region GetServiceQuota Requests (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS Signin Single Factor Console Login with Federated User (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ High Number of Egress Network Connections from Unusual Executable (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ High Number of Okta Device Token Cookies Generated for Authentication (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual High Denied Topic Blocks Detected (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Microsoft 365 User Account Brute Force (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Widespread Malware Infection Across Multiple Hosts (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Account Discovery Command via SYSTEM Account (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Microsoft Entra ID Exccessive Account Lockouts Detected (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Okta User Sessions Started from Different Geolocations (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual High Word Policy Blocks Detected (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Microsoft 365 Brute Force via Entra ID Sign-Ins (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Suspicious Microsoft 365 UserLoggedIn via OAuth Code (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Suspicious Microsoft OAuth Flow via Auth Broker to DRS (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS EC2 Multi-Region DescribeInstances API Calls (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Azure Entra MFA TOTP Brute Force Attempts (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Azure OpenAI Model Theft (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS EC2 EBS Snapshot Shared or Made Public (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual High Confidence Content Filter Blocks Detected (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS S3 Bucket Enumeration or Brute Force (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential PowerShell Obfuscation via Invalid Escape Sequences (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Rare Connection to WebDAV Target (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS IAM User Created Access Keys For Another User (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Port Scanning Activity from Compromised Host (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential PowerShell Obfuscation via Special Character Overuse (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS EC2 EBS Snapshot Access Removed (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS Bedrock Detected Multiple Validation Exception Errors by a Single User (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS Discovery API Calls via CLI from a Single Resource (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Malware-Driven SSH Brute Force Attempt (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential AWS S3 Bucket Ransomware Note Uploaded (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential PowerShell Obfuscation via Character Array Reconstruction (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Subnet Scanning Activity from Compromised Host (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual Command Execution from Web Server Parent (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual File Transfer Utility Launched (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Multiple Okta User Authentication Events with Client Address (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Multiple Okta User Authentication Events with Same Device Token Hash (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual Process Spawned from Web Server Parent (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS IAM AdministratorAccess Policy Attached to User (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ PowerShell Obfuscation via Negative Index String Reversal (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Dynamic IEX Reconstruction via Method String Access (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS S3 Object Encryption Using External KMS Key (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Denial of Azure OpenAI ML Service (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Dynamic IEX Reconstruction via Environment Variables (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Abuse of Resources by High Token Count and Large Response Sizes (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS STS Role Chaining (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS IAM Login Profile Added for Root (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Excessive Secret or Key Retrieval from Azure Key Vault (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual Base64 Encoding/Decoding Activity (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Deprecated - Azure Entra Sign-in Brute Force Microsoft 365 Accounts by Repeat Source (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Multiple Device Token Hashes for Single Okta Session (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Microsoft Entra ID Sign-In Brute Force Activity (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential PowerShell Obfuscation via Backtick-Escaped Variable Expansion (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS IAM AdministratorAccess Policy Attached to Role (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Multiple Microsoft 365 User Account Lockouts in Short Time Window (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS IAM AdministratorAccess Policy Attached to Group (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Microsoft Entra ID Concurrent Sign-Ins with Suspicious Properties (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential PowerShell Obfuscation via String Reordering (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Microsoft Azure or Mail Sign-in from a Suspicious Source (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS Bedrock Invocations without Guardrails Detected by a Single User Over a Session (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential PowerShell Obfuscation via Reverse Keywords (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS Bedrock Guardrails Detected Multiple Policy Violations Within a Single Blocked Request (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential PowerShell Obfuscation via String Concatenation (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Malicious PowerShell Based on Alert Correlation (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential PowerShell Obfuscation via High Numeric Character Proportion (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Azure OpenAI Insecure Output Handling (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@tradebot-elastic
Copy link

tradebot-elastic commented Jul 25, 2025

⛔️ Test failed

Results
  • ❌ Potential PowerShell Obfuscation via Concatenated Dynamic Command Invocation (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS Bedrock Guardrails Detected Multiple Violations by a Single User Over a Session (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Microsoft Entra ID Session Reuse with Suspicious Graph Access (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS Access Token Used from Multiple Addresses (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual High Denied Sensitive Information Policy Blocks Detected (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ M365 OneDrive Excessive File Downloads with OAuth Token (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS S3 Static Site JavaScript File Uploaded (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS Bedrock Detected Multiple Attempts to use Denied Models by a Single User (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS Service Quotas Multi-Region GetServiceQuota Requests (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS Signin Single Factor Console Login with Federated User (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ High Number of Egress Network Connections from Unusual Executable (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ High Number of Okta Device Token Cookies Generated for Authentication (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual High Denied Topic Blocks Detected (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Microsoft 365 User Account Brute Force (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Widespread Malware Infection Across Multiple Hosts (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Account Discovery Command via SYSTEM Account (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Microsoft Entra ID Exccessive Account Lockouts Detected (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Okta User Sessions Started from Different Geolocations (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual High Word Policy Blocks Detected (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Microsoft 365 Brute Force via Entra ID Sign-Ins (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Suspicious Microsoft 365 UserLoggedIn via OAuth Code (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Suspicious Microsoft OAuth Flow via Auth Broker to DRS (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS EC2 Multi-Region DescribeInstances API Calls (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Azure Entra MFA TOTP Brute Force Attempts (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Azure OpenAI Model Theft (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS EC2 EBS Snapshot Shared or Made Public (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual High Confidence Content Filter Blocks Detected (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS S3 Bucket Enumeration or Brute Force (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential PowerShell Obfuscation via Invalid Escape Sequences (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Rare Connection to WebDAV Target (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS IAM User Created Access Keys For Another User (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Port Scanning Activity from Compromised Host (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential PowerShell Obfuscation via Special Character Overuse (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS EC2 EBS Snapshot Access Removed (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS Bedrock Detected Multiple Validation Exception Errors by a Single User (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS Discovery API Calls via CLI from a Single Resource (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Malware-Driven SSH Brute Force Attempt (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential AWS S3 Bucket Ransomware Note Uploaded (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential PowerShell Obfuscation via Character Array Reconstruction (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Subnet Scanning Activity from Compromised Host (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual Command Execution from Web Server Parent (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual File Transfer Utility Launched (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Multiple Okta User Authentication Events with Client Address (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Multiple Okta User Authentication Events with Same Device Token Hash (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual Process Spawned from Web Server Parent (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS IAM AdministratorAccess Policy Attached to User (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ PowerShell Obfuscation via Negative Index String Reversal (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Dynamic IEX Reconstruction via Method String Access (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS S3 Object Encryption Using External KMS Key (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Denial of Azure OpenAI ML Service (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Dynamic IEX Reconstruction via Environment Variables (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Abuse of Resources by High Token Count and Large Response Sizes (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS STS Role Chaining (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS IAM Login Profile Added for Root (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Excessive Secret or Key Retrieval from Azure Key Vault (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual Base64 Encoding/Decoding Activity (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Deprecated - Azure Entra Sign-in Brute Force Microsoft 365 Accounts by Repeat Source (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Multiple Device Token Hashes for Single Okta Session (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Microsoft Entra ID Sign-In Brute Force Activity (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential PowerShell Obfuscation via Backtick-Escaped Variable Expansion (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS IAM AdministratorAccess Policy Attached to Role (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Multiple Microsoft 365 User Account Lockouts in Short Time Window (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS IAM AdministratorAccess Policy Attached to Group (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Microsoft Entra ID Concurrent Sign-Ins with Suspicious Properties (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential PowerShell Obfuscation via String Reordering (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Microsoft Azure or Mail Sign-in from a Suspicious Source (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS Bedrock Invocations without Guardrails Detected by a Single User Over a Session (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential PowerShell Obfuscation via Reverse Keywords (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ AWS Bedrock Guardrails Detected Multiple Policy Violations Within a Single Blocked Request (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential PowerShell Obfuscation via String Concatenation (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Malicious PowerShell Based on Alert Correlation (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential PowerShell Obfuscation via High Numeric Character Proportion (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Azure OpenAI Insecure Output Handling (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

| sort violations desc

// Keep relevant ECS + model fields
| keep
Copy link
Contributor

@Mikaayenson Mikaayenson Jul 25, 2025

Choose a reason for hiding this comment

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

Any reason we're mixing case for ES|QL functions? FROM vs keep vs stats vs COUNT

Copy link
Contributor Author

@terrancedejesus terrancedejesus Jul 28, 2025

Choose a reason for hiding this comment

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

Not only the processing functions or commands, but logical operators can be lowercase or uppercase. There is variation amongst ESQL rules based on personal preference of the rule author. Since there are no inherit downsides, best practice against or for - I'd suggest leaving these as-is.

Copy link
Contributor

Choose a reason for hiding this comment

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

Im just not sure if it's best. It's really a nit, but seeing them mixed when we're already touching all the rules appears odd.

// Aggregate all violation types per user
| stats
Esql.ml_policy_blocked_violation_total_count = SUM(Esql.ml_policy_blocked_violation_count)
by
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I think single line is easier to read, but im assuming its just really long now.

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. I think we have an opportunity to standardize esql function case.

otherwise great work!

Copy link

@JDKurma JDKurma left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@Aegrah Aegrah left a comment

Choose a reason for hiding this comment

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

Other than my comments, it looks g2g for Linux.

process.args IN ("-d", "-base64", "-a")
) OR
(
process.name RLIKE "^python.*" AND (
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this modified to RLIKE?

)
) OR
(
process.name RLIKE "^perl.*" AND
Copy link
Contributor

Choose a reason for hiding this comment

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

++

process.command_line LIKE "*decode_base64*"
) OR
(
process.name RLIKE "^ruby.*" AND
Copy link
Contributor

Choose a reason for hiding this comment

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

++

Comment on lines +108 to +109
host.name.values = VALUES(host.name),
agent.id.values = VALUES(agent.id)
Copy link
Contributor

Choose a reason for hiding this comment

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

These two don't need an Esql. prefix?

Comment on lines +107 to +108
host.name.values = VALUES(host.name),
agent.id.values = VALUES(agent.id)
Copy link
Contributor

Choose a reason for hiding this comment

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

++

Comment on lines +120 to +121
host.name.values = VALUES(host.name),
agent.id.values = VALUES(agent.id)
Copy link
Contributor

Choose a reason for hiding this comment

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

++

Comment on lines +142 to +143
host.name.values = VALUES(host.name),
agent.id.values = VALUES(agent.id)
Copy link
Contributor

Choose a reason for hiding this comment

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

++

Comment on lines +152 to +153
host.name.values = VALUES(host.name),
agent.id.values = VALUES(agent.id)
Copy link
Contributor

Choose a reason for hiding this comment

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

++

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport: auto bbr Building Block Rules Domain: Cloud Domain: Endpoint Integration: AWS AWS related rules Integration: Azure azure related rules Integration: Microsoft 365 Integration: Okta okta related rules OS: Linux OS: Windows windows related rules Rule: Deprecation removal of a rule Rule: Tuning tweaking or tuning an existing rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Rule Tuning] ESQL Query Field Dynamic Field Standardization
6 participants