Commit Graph

280 Commits

Author SHA1 Message Date
github-actions[bot] 0b15511ef5 Lock versions for releases: 8.19,9.2,9.3,9.4 (#6044) 2026-05-04 21:29:14 +05:30
shashank-elastic a6fba3c728 Monthly Manifest and Schema Updation (#6036) 2026-05-04 18:01:56 +05:30
Eric Forte aad0e4ed11 Fix percentages (#6002) 2026-05-01 19:13:53 -04:00
Mika Ayenson, PhD cc66323d1d [Bug] Omit ES|QL engine columns from required_fields (#6027)
* Omit Esql.* columns from ES|QL rule required_fields

Kibana treats required_fields as index mappings. ES|QL stats and
similar commands expose Esql.* and Esql_priv.* result columns that
are not mapped on source indices, which produced noisy validation
warnings for shipped rules.

Filter those names when building required_fields. Add a check in
test_esql_endpoint_alerts_index when remote ES|QL validation runs.

Fixes #6026.

* Move required_fields check to its own remote test

* Iterate production rules in required_fields test

* Use direct get_required_fields call in remote test

Skip to_api_format() and call data.get_required_fields(index) directly,
gated on ESQLRuleData. Mirrors the ESQLValidator scope of the fix and
avoids the unrelated packaging steps that to_api_format runs per rule.

* Bump version to 1.6.30

* Centralize ES|QL dynamic field prefix tuple

Define ESQL_DYNAMIC_FIELD_PREFIXES = ("Esql.", "Esql_priv.") in
schemas/definitions.py and reuse it in QueryValidator.get_required_fields,
ESQLValidator.validate_columns_index_mapping, and the remote test.
Single source of truth and consistent ordering across the codebase.
2026-05-01 17:37:31 -05:00
Eric Forte f7387bb10d [FR] [DAC] Add Exception Duplication Checking (#5689)
* Add Exception Duplication Checking
2026-04-29 08:57:07 -04:00
github-actions[bot] cb3c342b31 Lock versions for releases: 8.19,9.2,9.3,9.4 (#5998) 2026-04-29 00:52:04 +05:30
wingiti 0f521a0848 Fix value lists within exception lists (#5963)
* Fix value lists within exception lists
2026-04-24 12:23:06 -04:00
Eric Forte ff369b4e44 [Bug] Lock Pyright Version (#5977) 2026-04-23 09:22:10 -04:00
Mika Ayenson, PhD b6886f310c [FR] Add enforcement for deprecated_reason (#5953) 2026-04-23 17:15:47 +05:30
github-actions[bot] 2dac152094 Lock versions for releases: 8.19,9.2,9.3,9.4 (#5972)
* Locked versions for releases: 8.19,9.2,9.3,9.4

---------

Co-authored-by: shashank-elastic <shashank-elastic@users.noreply.github.com>
2026-04-22 20:15:10 -04:00
Eric Forte 2029654e79 ESQL validation support fix (#5970) 2026-04-22 16:52:37 -04:00
shashank-elastic 7a54f8be99 Prep for Release 9.4 (#5965) 2026-04-23 00:13:05 +05:30
Mika Ayenson, PhD 876e4ed535 [Bug ]Fix Kibana version parsing for package version (#5962)
* [Bug ]Fix kibana version parsing for package version

---------

Co-authored-by: Shashank K S <Shashank.Suryanarayana@elastic.co>
2026-04-22 11:25:06 -04:00
Susan d8a39869c5 Add Entity related integrations ML rules with _ea job IDs and min_stack_version 9.4.0 (#5909)
Co-authored-by: Shashank K S <Shashank.Suryanarayana@elastic.co>
2026-04-22 17:36:35 +05:30
Jonhnathan 8d25a7ddce [Rule Tuning] Update MDE tags to "Microsoft Defender XDR" (#5927)
* [Rule Tuning] Fix MS Defender XDR tag

* bump upodated_date
2026-04-20 18:38:09 -03:00
Mika Ayenson, PhD ff73f13446 [Docs] Refresh DEX Philosophy (#5933)
* refresh dex philosophy

* version bump

* Apply suggestions from code review

Co-authored-by: Eric Forte <119343520+eric-forte-elastic@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Terrance DeJesus <99630311+terrancedejesus@users.noreply.github.com>

* final updates

---------

Co-authored-by: Eric Forte <119343520+eric-forte-elastic@users.noreply.github.com>
Co-authored-by: Terrance DeJesus <99630311+terrancedejesus@users.noreply.github.com>
2026-04-10 16:40:06 -05:00
Eric Forte 9736407ef3 [FR] [DAC] Initial Yaml Support (#5821)
* Initial Yaml Support
2026-04-10 11:29:15 -04:00
Eric Forte 984be4a1ac [Bug] Small bugfix to address update navigator edge case (#5942)
* [Bug] Small bugfix to address update navigator edge case
2026-04-10 08:53:56 -04:00
Eric Forte 1503976d10 [FR] Load ECS mapping based on supplied stack version (#5925)
* Load ECS mapping based on supplied stack version
2026-04-09 12:40:10 -04:00
github-actions[bot] c601edfbb3 Lock versions for releases: 8.19,9.1,9.2,9.3 (#5930) 2026-04-08 19:44:16 +05:30
github-actions[bot] 88bc42265f Lock versions for releases: 8.19,9.1,9.2,9.3 (#5926) 2026-04-07 17:45:00 +05:30
Jonhnathan c78c6363b0 Remove OSQuery/Investigate Plugin disclaimer enforcement (#5921)
* Remove OSQuery/Investigate Plugin disclaimer enforcement

* Update pyproject.toml
2026-04-06 10:53:00 -03:00
shashank-elastic 199a4d6160 Monthly Manifest and Schema Updation (#5920) 2026-04-06 17:35:33 +05:30
github-actions[bot] d9890db6ff Lock versions for releases: 8.19,9.1,9.2,9.3 (#5888)
* Locked versions for releases: 8.19,9.1,9.2,9.3

* Update pyproject.toml

---------

Co-authored-by: Mikaayenson <Mikaayenson@users.noreply.github.com>
2026-03-26 12:31:50 -05:00
Terrance DeJesus cd19b25485 [New Rule] M365 Azure Monitor Alert Email with Financial or Billing Theme (#5878)
* [New Rule] M365 Azure Monitor Alert Email with Financial or Billing Theme
Fixes #5877

* adding microsoft_exchange_online_message_trace to manifests/schemas; bumping patch

* updated mitre

* Update rules/integrations/microsoft_exchange_online_message_trace/initial_access_azure_monitor_callback_phishing_email.toml

Co-authored-by: Isai <59296946+imays11@users.noreply.github.com>

* bumping patch

---------

Co-authored-by: Isai <59296946+imays11@users.noreply.github.com>
2026-03-26 10:50:15 -05:00
Eric Forte 75ffa5ec4e [FR] [DaC] Add fine-grained bypass env var for ES|QL keep and metadata validation (#5869)
* Add fine grain 'keep' req bypass

* Add metadata bypass
2026-03-24 14:36:45 -04:00
github-actions[bot] b14dec9efa Lock versions for releases: 8.19,9.1,9.2,9.3 (#5875) 2026-03-23 23:45:25 +05:30
Mika Ayenson, PhD ade7de7be4 [New Rules] External Promotion Alert for IBM QRadar (#5843) 2026-03-20 14:42:43 -05:00
Isai 7ae298005d [Bug] KQL Validation Add Wildcard w/ Space token value (#5753)
* [Bug] KQL Validation Add Wildcard w/ Space token value

## Summary
Fixes KQL parser to support wildcard values containing spaces (e.g., `*S3 Browser*`), which work in Kibana but were rejected by our unit tests.

**Issue:** #5750

## Changes

### Grammar (`lib/kql/kql/kql.g`)
- Added `WILDCARD_LITERAL` token with priority 3 to match wildcard patterns containing spaces
- Uses negative lookahead to stop before `or`/`and`/`not` keywords
- Added to `value` rule (not `literal`) so field names remain unaffected

### Parser (`lib/kql/kql/parser.py`)
- Handle new `WILDCARD_LITERAL` token type as wildcards
- Quoted strings (`"*text*"`) now treated as literals, matching Kibana behavior

## Behavior

| Query | Before | After |
|-------|--------|-------|
| `field: *S3 Browser*` |  Parse error |  Wildcard |
| `field: *test*` |  Wildcard |  Wildcard |
| `common.*: value` |  Works |  Works |
| `field: "*text*"` | Wildcard |  Literal (matches Kibana) |

## Test plan
- [x] All 63 existing KQL unit tests pass
- [x] New wildcard-with-spaces patterns parse correctly
- [x] Wildcard field names (`common.*`) still work
- [x] Keywords (`or`, `and`, `not`) correctly recognized as separators
- [x] Tested against rule file from PR #5694

* update pyproject version

* update kibana and kql pyproject.toml versions

update kibana and kql pyproject.toml versions

* update wildcard_literal pattern to account for false matches with leading keywords

Add Negative lookahead at start of Pattern 2 - uses (?!(?:or|and|not)\b) at the start to prevent matching values that begin with keywords like 'not /path*'

* adding NOT keyword token and support for wildcard in the middle of spaced phrase

# KQL Parser Changes - Wildcard Spaces and NOT Prefix Fix

## Overview

This update fixes two issues in the KQL parser:
1. **Wildcard values with spaces** - Values like `*S3 Browser*` now parse correctly
2. **NOT prefix false match** - Values like `not /tmp/go-build*` are no longer incorrectly consumed as a single wildcard literal

## Files Modified

### `lib/kql/kql/kql.g` (Grammar)

**Added `optional_not` rule** to handle `NOT` as an explicit grammar element:
```
?list_of_values: "(" or_list_of_values ")"
| optional_not value
?optional_not: NOT optional_not
|
```

**Expanded `WILDCARD_LITERAL`** with 4 patterns to support all wildcard-with-space cases:

| Pattern | Description | Example |
|---------|-------------|---------|
| 1 | Starts with `*` | `*S3 Browser`, `*S3 Browser*` |
| 2 | Ends with `*` (doesn't start with `*`) | `S3 Browser*` |
| 3a | `*` appears after a space | `S3 B*owser` |
| 3b | `*` appears before a space | `S3* Browser` |

### `lib/kql/kql/parser.py`

Added methods to handle the new grammar rules:
- `list_of_values()` - handles `optional_not value` structure
- `optional_not()` - counts NOT occurrences and wraps values with `NotValue`

### `lib/kql/kql/kql2eql.py`

Added corresponding methods for EQL conversion:
- `list_of_values()` - handles `optional_not value` structure
- `optional_not()` - counts NOT occurrences and wraps with `eql.ast.Not`

## Test Results

All 63 kuery tests pass. Verified wildcard cases:

| Input | Result |
|-------|--------|
| `field: *S3 Browser*` | `field:*S3\ Browser*` |
| `field: S3 Browser*` | `field:S3\ Browser*` |
| `field: *S3 Browser` | `field:*S3\ Browser` |
| `field: S3 B*owser` | `field:S3\ B*owser` |
| `field: S3* Browser` | `field:S3*\ Browser` |
| `field: foo* bar* baz` | `field:foo*\ bar*\ baz` |
| `process.executable: not /tmp/go-build*` | `not process.executable:/tmp/go-build*` |
| `field < value` | `field < value` (range expression, not wildcard) |

## Technical Notes

### Pattern 3a Fix
Pattern 3a requires at least one character AFTER the `*` (uses `[...]+` instead of `[...]*`). This prevents Pattern 2 from incorrectly matching shorter strings like `S3 B*` when the full value is `S3 B*owser`.

### NOT Keyword Handling
The `optional_not` grammar approach explicitly parses `NOT` as a keyword before the value, preventing it from being consumed as part of a wildcard literal. This is safer than regex-only approaches because:
- `NOT` token only matches the exact word "not" (case-insensitive)
- Values like `notafile*` are still parsed as `UNQUOTED_LITERAL`
- Edge case: literal value "not" must be quoted: `field: "not"`

* Changes to Addresses Review Comments

### Changes to Addresses Review Comments @Mikaayenson

1. **Fixed regex patterns to prevent trailing whitespace capture** (`kql.g`)
   - Added `(?=\s|$|[()":{}])` lookahead to all WILDCARD_LITERAL patterns
   - This ensures patterns stop at boundaries without capturing trailing whitespace

2. **Removed `.rstrip()` workaround** (`parser.py`)
   - No longer needed since regex now handles boundaries correctly

3. **Added explicit WILDCARD_LITERAL handling** (`kql2eql.py`)
   - Now checks `token.type == "WILDCARD_LITERAL"` explicitly
   - Mirrors the approach used in `parser.py`

4. **Added unit tests** (`tests/kuery/test_parser.py`)
   - `test_wildcard_with_spaces` - all 4 WILDCARD_LITERAL patterns
   - `test_wildcard_with_spaces_and_keywords` - wildcards with `and`/`or` boundaries
   - `test_not_prefix_with_wildcard` - NOT keyword not consumed as wildcard
   - `test_quoted_wildcard_as_literal` - quoted wildcards are literal strings
   - `test_triple_not_optimization` - `not not not foo` → `not foo`

* changed test directory from tmp

* changed format of new tests

* Update pyproject.toml

Update pyproject.toml

---------

Co-authored-by: Eric Forte <119343520+eric-forte-elastic@users.noreply.github.com>
2026-03-18 17:38:24 -04:00
Davis Plumlee cb5b89f83e [FR] Includes deprecated rule stubs to the package for upstream testing (#5813)
* adds scripting to include deprecated rule stubs in package

* remove deprecated manifest from package

* adds 9.4 gate

* bump version

* fix merge conflict

* test

* revert commit hash

* adds deprecated_reason logic from comment

* fix lint error

* fix lint error

* fix formatting

* test

* revert commit hash

* Update detection_rules/packaging.py

Co-authored-by: Mika Ayenson, PhD <Mikaayenson@users.noreply.github.com>

---------

Co-authored-by: Mika Ayenson, PhD <Mikaayenson@users.noreply.github.com>
2026-03-18 14:34:25 -05:00
Ruben Groenewoud 8b140d5811 [Rule Tuning] Added Traefik Compatibility to Web Server Access Rules (#5837)
* [Rule Tuning] Added Traefik Compatibility to Web Server Access Rules

* ++

* Bump pyproject.toml

* Bump pyproject.toml
2026-03-17 17:28:47 +01:00
Mika Ayenson, PhD 49c9c283e6 [FR] Reset deprecated lock to the latest state during lock (#5827) 2026-03-16 17:04:56 -05:00
Terrance DeJesus d74c83140b [Maintenance] Update .gitignore for AI Artifacts (Skills, MCP, etc.) (#5833)
* Ignore AI Artifacts

* Update .gitignore

---------

Co-authored-by: Mika Ayenson, PhD <Mikaayenson@users.noreply.github.com>
2026-03-13 13:08:19 -04:00
Eric Forte ce3916f99f Bump minor version (#5822) 2026-03-10 13:39:49 -04:00
Eric Forte 57bf1546dd [Bug] [DAC] Add filtering to export-rules-from-repo (#5769)
* Add filtering to export-rules-from-repo
2026-03-10 13:03:52 -04:00
github-actions[bot] 61211a2670 Lock versions for releases: 8.19,9.1,9.2,9.3 (#5820) 2026-03-10 18:49:55 +05:30
github-actions[bot] 87badac5a0 Lock versions for releases: 8.19,9.1,9.2,9.3 (#5818) 2026-03-10 15:33:16 +05:30
Eric Forte 26d37dd62e [Bug] Ignore Other Keep Wildcards (#5792)
* Ignore other Keep Wildcards

* Added a unit test for multiple keeps

* Add keep star unit tests
2026-03-09 19:33:27 -04:00
shashank-elastic e08f234b1c Monthly Manifest and Schema Updation (#5816)
* Monthly Manifest and Schema Updation

* Update Patch Version
2026-03-09 08:15:06 -05:00
Terrance DeJesus 080cd47337 [Bug] test_integration_tag incorrectly flags higher-order rules using .alerts-security.* index (#5783)
Fixes #5782
2026-02-26 11:06:12 -05:00
Terrance DeJesus 201660af36 [Bug] Adding Deprecated Rules to Rules Package Breaks Current Package Build (#5773)
* applying patch fix for historical rules and deprecated JSON object

---------

Co-authored-by: eric-forte-elastic <eric.forte@elastic.co>
2026-02-24 13:54:46 -05:00
github-actions[bot] 92a379e034 Lock versions for releases: 8.19,9.1,9.2,9.3 (#5765) 2026-02-24 18:49:27 +05:30
Eric Forte 5adc118f92 [Bug] ES|QL Validation Add Reverse Lookup Check Against Kibana Value (#5747)
* Add reverse lookup check against Kibana value

---------

Co-authored-by: Mika Ayenson, PhD <Mikaayenson@users.noreply.github.com>
2026-02-20 15:29:51 -05:00
Mika Ayenson, PhD a1c3267529 [FR] Add deprecated file to release for upstream testing (#5749) 2026-02-20 14:16:27 -06:00
Mika Ayenson, PhD 25f3d6a879 [FR] Add copilot instructions to catch the gotchas (#5733)
Co-authored-by: Eric Forte <119343520+eric-forte-elastic@users.noreply.github.com>
Co-authored-by: Isai <59296946+imays11@users.noreply.github.com>
Co-authored-by: Ruben Groenewoud <78494512+Aegrah@users.noreply.github.com>
Co-authored-by: Samirbous <64742097+Samirbous@users.noreply.github.com>
Co-authored-by: Jonhnathan <26856693+w0rk3r@users.noreply.github.com>
2026-02-18 10:37:00 -06:00
Eric Forte f306404fe5 [Bug] CLI adds frequency field to system actions (.cases), causing import failure (#5690)
* No frequency field to cases
2026-02-11 15:18:20 -05:00
Eric Forte f74c04d11a [Bug] ESQL validation keep Clause Reported Missing Metadata Fields (#5717)
* Update Keep Field to Handle Comments

* Update for handling inline comments

Co-authored-by: Mika Ayenson, PhD <Mikaayenson@users.noreply.github.com>

---------

Co-authored-by: Mika Ayenson, PhD <Mikaayenson@users.noreply.github.com>
Co-authored-by: Jonhnathan <26856693+w0rk3r@users.noreply.github.com>
2026-02-11 15:02:23 -05:00
github-actions[bot] df9c27d82e Lock versions for releases: 8.19,9.1,9.2,9.3 (#5708) 2026-02-10 11:14:23 +05:30
shashank-elastic 70d7f2b6b1 Monthly Manifest and Schema Updation (#5697) 2026-02-10 09:17:04 +05:30
Ruben Groenewoud 694376bd7a [Bug] Fix UTF-8 Encoding for Rule File Operations (#5684)
* Updated kubernetes.audit.requestObject.spec.containers.image type of text to Keyword

* [Bug] Fix UTF-8 Encoding for Rule File Operations
2026-02-05 14:21:30 +01:00