Skip to content

Commit f02bde8

Browse files
authored
Merge branch 'main' into SAP-NV
2 parents 01d36bb + 166da45 commit f02bde8

File tree

1,041 files changed

+63149
-19037
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,041 files changed

+63149
-19037
lines changed

.github/CODEOWNERS

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
# detection-rules code owners
2-
# POC: Elastic Security Intelligence and Analytics Team
3-
4-
tests/**/*.py @mikaayenson @eric-forte-elastic @terrancedejesus
5-
detection_rules/ @mikaayenson @eric-forte-elastic @terrancedejesus
6-
tests/ @mikaayenson @eric-forte-elastic @terrancedejesus
7-
lib/ @mikaayenson @eric-forte-elastic @terrancedejesus
8-
hunting/ @mikaayenson @eric-forte-elastic @terrancedejesus
9-
10-
# skip rta-mapping to avoid the spam
11-
detection_rules/etc/packages.yaml @mikaayenson @eric-forte-elastic @terrancedejesus
12-
detection_rules/etc/*.json @mikaayenson @eric-forte-elastic @terrancedejesus
13-
detection_rules/etc/*.json @mikaayenson @eric-forte-elastic @terrancedejesus
14-
detection_rules/etc/*/* @mikaayenson @eric-forte-elastic @terrancedejesus
2+
3+
## POC: Elastic Threat Research & Detection Engineering
4+
5+
tests/**/*.py @mikaayenson @eric-forte-elastic @traut
6+
detection_rules/ @mikaayenson @eric-forte-elastic @traut
7+
tests/ @mikaayenson @eric-forte-elastic @traut
8+
lib/ @mikaayenson @eric-forte-elastic @traut
9+
hunting/**/*.py @mikaayenson @eric-forte-elastic @traut
10+
11+
## skip rta-mapping to avoid the spam
12+
13+
detection_rules/etc/packages.yaml @mikaayenson @eric-forte-elastic @traut
14+
detection_rules/etc/*.json @mikaayenson @eric-forte-elastic @traut
15+
detection_rules/etc/*/* @mikaayenson @eric-forte-elastic @traut
16+
17+
## exclude files from code owners
18+
19+
detection_rules/etc/non-ecs-schema.json

.github/PULL_REQUEST_GUIDELINES/bug_guidelines.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ These guidelines serve as a reminder set of considerations when addressing a bug
1111
### Code Standards and Practices
1212

1313
- [ ] Code follows established design patterns within the repo and avoids duplication.
14-
- [ ] Code changes do not introduce new warnings or errors.
15-
- [ ] Variables and functions are well-named and descriptive.
16-
- [ ] Any unnecessary / commented-out code is removed.
1714
- [ ] Ensure that the code is modular and reusable where applicable.
18-
- [ ] Check for proper exception handling and messaging.
1915

2016
### Testing
2117

@@ -25,11 +21,9 @@ These guidelines serve as a reminder set of considerations when addressing a bug
2521
- [ ] Validate that any rules affected by the bug are correctly updated.
2622
- [ ] Ensure that performance is not negatively impacted by the changes.
2723
- [ ] Verify that any release artifacts are properly generated and tested.
24+
- [ ] Conducted system testing, including fleet, import, and create APIs (e.g., run `make test-cli`, `make test-remote-cli`, `make test-hunting-cli`)
2825

2926
### Additional Checks
3027

31-
- [ ] Ensure that the bug fix does not break existing functionality.
32-
- [ ] Review the bug fix with a peer or team member for additional insights.
3328
- [ ] Verify that the bug fix works across all relevant environments (e.g., different OS versions).
34-
- [ ] Confirm that all dependencies are up-to-date and compatible with the changes.
3529
- [ ] Confirm that the proper version label is applied to the PR `patch`, `minor`, `major`.

.github/PULL_REQUEST_GUIDELINES/enhancement_guidelines.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ These guidelines serve as a reminder set of considerations when addressing addin
1111
### Code Standards and Practices
1212

1313
- [ ] Code follows established design patterns within the repo and avoids duplication.
14-
- [ ] Code changes do not introduce new warnings or errors.
15-
- [ ] Variables and functions are well-named and descriptive.
16-
- [ ] Any unnecessary / commented-out code is removed.
1714
- [ ] Ensure that the code is modular and reusable where applicable.
18-
- [ ] Check for proper exception handling and messaging.
1915

2016
### Testing
2117

@@ -25,11 +21,9 @@ These guidelines serve as a reminder set of considerations when addressing addin
2521
- [ ] Validate that any rules affected by the enhancement are correctly updated.
2622
- [ ] Ensure that performance is not negatively impacted by the changes.
2723
- [ ] Verify that any release artifacts are properly generated and tested.
24+
- [ ] Conducted system testing, including fleet, import, and create APIs (e.g., run `make test-cli`, `make test-remote-cli`, `make test-hunting-cli`)
2825

2926
### Additional Checks
3027

31-
- [ ] Ensure that the enhancement does not break existing functionality.
32-
- [ ] Review the enhancement with a peer or team member for additional insights.
3328
- [ ] Verify that the enhancement works across all relevant environments (e.g., different OS versions).
34-
- [ ] Confirm that all dependencies are up-to-date and compatible with the changes.
3529
- [ ] Confirm that the proper version label is applied to the PR `patch`, `minor`, `major`.

.github/PULL_REQUEST_GUIDELINES/schema_enhancement_guidelines.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ These guidelines serve as a reminder set of considerations when addressing addin
1111
### Code Standards and Practices
1212

1313
- [ ] Code follows established design patterns within the repo and avoids duplication.
14-
- [ ] Code changes do not introduce new warnings or errors.
15-
- [ ] Variables and functions are well-named and descriptive.
16-
- [ ] Any unnecessary / commented-out code is removed.
1714
- [ ] Ensure that the code is modular and reusable where applicable.
18-
- [ ] Check for proper exception handling and messaging.
1915

2016
### Testing
2117

@@ -25,23 +21,21 @@ These guidelines serve as a reminder set of considerations when addressing addin
2521
- [ ] Validate that any rules affected by the enhancement are correctly updated.
2622
- [ ] Ensure that performance is not negatively impacted by the changes.
2723
- [ ] Verify that any release artifacts are properly generated and tested.
24+
- [ ] Conducted system testing, including fleet, import, and create APIs (e.g., run `make test-cli`, `make test-remote-cli`, `make test-hunting-cli`)
2825

2926
### Additional Schema Related Checks
3027

31-
- [ ] Ensure that the enhancement does not break existing functionality. (e.g., run `make test-cli`)
32-
- [ ] Review the enhancement with a peer or team member for additional insights.
3328
- [ ] Verify that the enhancement works across all relevant environments (e.g., different OS versions).
34-
- [ ] Confirm that all dependencies are up-to-date and compatible with the changes.
3529
- [ ] Link to the relevant Kibana PR or issue provided
36-
- [ ] Exported detection rule(s) from Kibana to showcase the feature(s)
37-
- [ ] Converted the exported ndjson file(s) to toml in the detection-rules repo
38-
- [ ] Re-exported the toml rule(s) to ndjson and re-imported into Kibana
30+
- [ ] Test export/import flow:
31+
- [ ] Exported detection rule(s) from Kibana to showcase the feature(s)
32+
- [ ] Converted the exported ndjson file(s) to toml in the detection-rules repo
33+
- [ ] Re-exported the toml rule(s) to ndjson and re-imported into Kibana
3934
- [ ] Updated necessary unit tests to accommodate the feature
35+
- [ ] Incorporated a comprehensive test rule in unit tests for full schema coverage
4036
- [ ] Applied min_compat restrictions to limit the feature to a specified minimum stack version
4137
- [ ] Executed all unit tests locally with a test toml rule to confirm passing
4238
- [ ] Included Kibana PR implementer as an optional reviewer for insights on the feature
4339
- [ ] Implemented requisite downgrade functionality
4440
- [ ] Cross-referenced the feature with product documentation for consistency
45-
- [ ] Incorporated a comprehensive test rule in unit tests for full schema coverage
46-
- [ ] Conducted system testing, including fleet, import, and create APIs (e.g., run `make test-remote-cli`)
4741
- [ ] Confirm that the proper version label is applied to the PR `patch`, `minor`, `major`.

.github/workflows/add-guidelines.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Check out the repository
12-
uses: actions/checkout@v4
12+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
1313

1414
- name: Set environment variable for early exit control
1515
id: check_label
@@ -47,14 +47,14 @@ jobs:
4747
4848
- name: Fail if no relevant labels are found
4949
if: env.GUIDELINES_FILE == ''
50-
uses: actions/github-script@v7
50+
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
5151
with:
5252
script: |
5353
core.setFailed('No appropriate GitHub label found in the PR. Failing the job.')
5454
5555
- name: Add Guidelines Comment
5656
if: env.CONTINUE_JOB == 'true' && (github.event.action == 'opened' || github.event.action == 'labeled')
57-
uses: mshick/add-pr-comment@v2
57+
uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2
5858
with:
5959
message-path: ${{ env.GUIDELINES_FILE }}
6060
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/attack-coverage-update.yml

Lines changed: 0 additions & 68 deletions
This file was deleted.

.github/workflows/backport.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
github.event.pull_request.state == 'open' && !github.event.pull_request.draft
2222
steps:
2323
- name: 'Apply default "backport: auto" label'
24-
uses: actions/github-script@v4
24+
uses: actions/github-script@10b53a9ec6c222bb4ce97aa6bd2b5f739696b536 # v4
2525
if: |
2626
!contains(github.event.pull_request.labels.*.name, 'backport: auto') &&
2727
!contains(github.event.pull_request.labels.*.name, 'backport: skip')
@@ -34,7 +34,7 @@ jobs:
3434
labels: ['backport: auto']
3535
})
3636
- name: 'Remove "backport: auto" if "backport: skip" is set'
37-
uses: actions/github-script@v4
37+
uses: actions/github-script@10b53a9ec6c222bb4ce97aa6bd2b5f739696b536 # v4
3838
if: |
3939
contains(github.event.pull_request.labels.*.name, 'backport: auto') &&
4040
contains(github.event.pull_request.labels.*.name, 'backport: skip')
@@ -65,7 +65,7 @@ jobs:
6565

6666
steps:
6767
- name: Checkout repo
68-
uses: actions/checkout@v4
68+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
6969
with:
7070
token: ${{ secrets.WRITE_TRADEBOT_DETECTION_RULES_TOKEN }}
7171
ref: main
@@ -91,7 +91,7 @@ jobs:
9191
git reset --soft HEAD^
9292
9393
- name: Setup Python 3.12
94-
uses: actions/setup-python@v5
94+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
9595
with:
9696
python-version: '3.12'
9797

@@ -159,7 +159,7 @@ jobs:
159159
git push
160160
161161
- name: "Notify slack on failure"
162-
uses: craftech-io/slack-action@v1
162+
uses: craftech-io/slack-action@fb1d4e50375d7758efb90fa0564734bae931f84f # v1
163163
with:
164164
slack_webhook_url: ${{ secrets.EXTERNAL_SLACK_DETECTION_RULES_URL }}
165165
status: failure

.github/workflows/branch-status-checks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ jobs:
1818
steps:
1919
- name: Get Backport Status
2020
id: get_backport_status
21-
uses: fjogeleit/http-request-action@v1
21+
uses: fjogeleit/http-request-action@bf78da14118941f7e940279dd58f67e863cbeff6 # v1
2222
with:
2323
url: "https://api.github.com/repos/elastic/detection-rules/actions/workflows/pythonpackage.yml/runs?per_page=1&branch=${{matrix.target_branch}}"
2424
method: 'GET'
2525
bearerToken: ${{ secrets.READ_ELASTIC_DETECTION_RULES_ORG_TOKEN }}
2626

2727
- name: Check Backport Status
28-
uses: actions/github-script@v6
28+
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
2929
with:
3030
script: |
3131
const workflow_status = ${{ toJSON(fromJSON(steps.get_backport_status.outputs.response).workflow_runs[0].status) }}

.github/workflows/code-checks.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Code checks
2+
3+
on:
4+
push:
5+
branches: [ "main", "7.*", "8.*", "9.*" ]
6+
pull_request:
7+
branches: [ "*" ]
8+
paths:
9+
- 'detection_rules/**/*.py'
10+
- 'hunting/**/*.py'
11+
- 'tests/**/*.py'
12+
- 'lib/**/*.py'
13+
14+
jobs:
15+
code-checks:
16+
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
21+
with:
22+
fetch-depth: 1
23+
24+
- name: Set up Python 3.13
25+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
26+
with:
27+
python-version: '3.13'
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip cache purge
33+
pip install .[dev]
34+
35+
- name: Linting check
36+
run: |
37+
ruff check --exit-non-zero-on-fix
38+
39+
- name: Formatting check
40+
run: |
41+
ruff format --check
42+
43+
- name: Pyright check
44+
run: |
45+
pyright
46+
47+
- name: Python License Check
48+
run: |
49+
python -m detection_rules dev license-check

.github/workflows/community.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Check if member of elastic org
15-
uses: actions/github-script@v6
15+
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
1616
id: membership
1717
with:
1818
github-token: ${{ secrets.READ_ELASTIC_DETECTION_RULES_ORG_TOKEN }}
@@ -40,7 +40,7 @@ jobs:
4040
4141
4242
- name: Add label for community members
43-
uses: actions/github-script@v6
43+
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
4444
if: ${{ steps.membership.outputs.result == 'notMember' }}
4545
with:
4646
script: |

0 commit comments

Comments
 (0)