Skip to content

Commit 4493a82

Browse files
authored
Merge pull request #4082 from splunk/escu_6
ESCU 6 YAML Porting and Updates
2 parents 29616ca + e547f65 commit 4493a82

3,606 files changed

Lines changed: 106947 additions & 96943 deletions

File tree

Some content is hidden

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

.github/workflows/appinspect.yml

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,60 @@
1+
# This workflow performs a simple build action.
2+
# It is intentionally separate from the build
3+
# workflow to provide granular feedback and insight
4+
# into when a build passes but an appinspect fails.
15
name: appinspect
6+
27
on:
38
pull_request:
49
types: [opened, reopened, synchronize]
10+
511
jobs:
612
appinspect:
713
runs-on: ubuntu-latest
814
steps:
9-
- name: Check out repository (PR)
10-
if: ${{ github.event_name == 'pull_request' }}
15+
- name: Check out the repository code
1116
uses: actions/checkout@v6
12-
with:
13-
ref: refs/pull/${{ github.event.pull_request.number }}/merge
1417

15-
- uses: actions/setup-python@v6
18+
- name: Set up Python
19+
uses: actions/setup-python@v6
1620
with:
17-
python-version: '3.11'
18-
architecture: 'x64'
21+
python-version: 3.14
22+
architecture: x64
1923

20-
- name: Install Python Dependencies and ContentCTL and Atomic Red Team
24+
- name: Install contentctl-ng
25+
shell: bash
2126
run: |
22-
echo "- Contentctl version - $(cat requirements.txt)"
27+
echo "- Build Tool Version - $(cat requirements.txt)"
2328
pip install -r requirements.txt
24-
git clone --depth=1 --single-branch --branch=master https://github.com/redcanaryco/atomic-red-team.git external_repos/atomic-red-team
25-
git clone --depth=1 --single-branch --branch="master" https://github.com/mitre-attack/attack-stix-data external_repos/cti
29+
30+
- name: Run a contentctl-ng build
31+
run: |
32+
contentctl-ng build
2633
27-
- name: Running appinspect with enrichments
34+
- name: Run appinspect with enrichments
2835
env:
2936
APPINSPECTUSERNAME: "${{ secrets.APPINSPECTUSERNAME }}"
3037
APPINSPECTPASSWORD: "${{ secrets.APPINSPECTPASSWORD }}"
3138
run: |
32-
echo $APPINSPECTUSERNAME
33-
contentctl inspect --splunk-api-username "$APPINSPECTUSERNAME" --splunk-api-password "$APPINSPECTPASSWORD" --enrichments --enable-metadata-validation --suppress-missing-content-exceptions --enforce-deprecation-mapping-requirement
34-
echo "done appinspect"
39+
# Download the most recent Release in order to enforce metadata validation
40+
# --location flag required to follow redirects from the "latest" URL
41+
curl --location -o DA-ESS-ContentUpdate-latest.tar.gz https://github.com/splunk/security_content/releases/latest/download/DA-ESS-ContentUpdate-latest.tar.gz
42+
43+
# Inspect, using the release we downloaded above
44+
# Also, we intentionally ignore missing content exceptions - private content is
45+
# not expected to be present when running this check in GitHub
46+
contentctl-ng inspect --splunkbase-username "$APPINSPECTUSERNAME" --splunkbase-password "$APPINSPECTPASSWORD" --old-app-path DA-ESS-ContentUpdate-latest.tar.gz --ignore-missing-content-exceptions
3547
mkdir -p artifacts/app_inspect_report
3648
cp -r dist/*.html artifacts/app_inspect_report
3749
cp -r dist/*.tar.gz artifacts/
3850
51+
# Store inspect artifacts
3952
- name: store_artifacts
53+
if: always()
4054
uses: actions/upload-artifact@v7
4155
with:
42-
name: content-latest
56+
name: appinspect_results
4357
path: |
44-
artifacts/DA-ESS-ContentUpdate-latest.tar.gz
45-
artifacts/app_inspect_report
58+
dist/*.html
59+
dist/*.tar.gz
60+

.github/workflows/build.yml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,46 @@
1+
# This workflow performs a simple build action.
2+
# It is intentionally separate from the appinspect
3+
# workflow to provide granular feedback and insight
4+
# into when a build passes but an appinspect fails.
15
name: build
6+
27
on:
38
pull_request:
49
types: [opened, reopened, synchronize]
510
push:
611
branches:
712
- develop
13+
14+
815
jobs:
916
build:
1017
runs-on: ubuntu-latest
1118
steps:
1219
- name: Check out the repository code
1320
uses: actions/checkout@v6
1421

15-
- uses: actions/setup-python@v6
22+
- name: Set up Python
23+
uses: actions/setup-python@v6
1624
with:
17-
python-version: '3.11'
18-
architecture: 'x64'
25+
python-version: 3.14
26+
architecture: x64
1927

20-
- name: Install Python Dependencies and ContentCTL and Atomic Red Team
28+
- name: Install contentctl-ng
29+
shell: bash
2130
run: |
22-
echo "- Contentctl version - $(cat requirements.txt)"
31+
echo "- Build Tool Version - $(cat requirements.txt)"
2332
pip install -r requirements.txt
24-
git clone --depth=1 --single-branch --branch=master https://github.com/redcanaryco/atomic-red-team.git external_repos/atomic-red-team
25-
git clone --depth=1 --single-branch --branch="master" https://github.com/mitre-attack/attack-stix-data external_repos/cti
2633
27-
- name: Running build with enrichments
28-
run: |
29-
contentctl build --enrichments --enforce_deprecation_mapping_requirement
30-
mkdir artifacts
31-
mv dist/DA-ESS-ContentUpdate-latest.tar.gz artifacts/
3234
35+
- name: Run a contentctl-ng build
36+
run: |
37+
contentctl-ng build
38+
39+
# Store build artifact
3340
- name: store_artifacts
41+
if: always()
3442
uses: actions/upload-artifact@v7
3543
with:
3644
name: content-latest
3745
path: |
38-
artifacts/DA-ESS-ContentUpdate-latest.tar.gz
39-
dist/api
46+
dist/*.tar.gz

.github/workflows/unit-testing.yml

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
types: [opened, reopened, synchronize]
55
jobs:
66
unit-testing:
7-
runs-on: ubuntu-latest
7+
runs-on: large-ubuntu-22.04-32core
88
if: "!contains(github.ref, 'refs/tags/')" #don't run on tags - future steps won't run either since they depend on this job
99
steps:
1010
#For fork PRs, always check out security_content and the PR target in security content!
@@ -13,25 +13,32 @@ jobs:
1313
with:
1414
repository: 'splunk/security_content' #this should be the TARGET repo of the PR. we hardcode it for now
1515
ref: ${{ github.base_ref }}
16-
17-
18-
- uses: actions/setup-python@v6
16+
17+
- name: Print out information abour PR target
18+
run: |
19+
echo "The PR target branch is: ${{ github.base_ref }}"
20+
echo "The PR head branch is: ${{ github.head_ref }}"
21+
echo "My current branch is"
22+
git branch --show-current
23+
git rev-parse HEAD
24+
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v6
1928
with:
20-
python-version: '3.11' #Available versions here - https://github.com/actions/python-versions/releases easy to change/make a matrix/use pypy
21-
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
29+
python-version: 3.14
30+
architecture: x64
2231

23-
- name: Install Python Dependencies and ContentCTL
32+
- name: Install contentctl-ng
33+
shell: bash
2434
run: |
25-
python -m pip install --upgrade pip
26-
echo "- Contentctl version - $(cat requirements.txt)"
35+
echo "- Build Tool Version - $(cat requirements.txt)"
2736
pip install -r requirements.txt
28-
29-
30-
# Running contentctl test with a few arguments, before running the command make sure you checkout into the current branch of the pull request. This step only performs unit testing on all the changes against the target-branch. In most cases this target branch will be develop
31-
# Make sure we check out the PR, even if it actually lives in a fork
37+
38+
# Check out the PR, even if it lives in a fork.
3239
# Instructions for pulling a PR were taken from:
3340
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally
34-
- name: Run ContentCTL test for changes against target branch
41+
- name: Checkout the PR branch and the target to calculate changed files for testing
3542
run: |
3643
3744
echo "Current Branch (Head Ref): ${{ github.head_ref }}"
@@ -41,7 +48,27 @@ jobs:
4148
git fetch origin pull/${{ github.event.pull_request.number }}/head:new_branch_for_testing
4249
#We must specifically get the PR's target branch from security_content, not the one that resides in the fork PR's forked repo
4350
git switch new_branch_for_testing
44-
contentctl test --verbose --disable-tqdm --no-enable-integration-testing --container-settings.num-containers 1 --post-test-behavior never_pause mode:changes --mode.target-branch ${{ github.base_ref }}
51+
52+
- name: Run a contentctl-ng build command to create a package that will be tested.
53+
run: |
54+
contentctl-ng build
55+
56+
- name: Start the test environment
57+
run: |
58+
docker run -d --platform linux/amd64 -p 8088:8088 -p 8089:8089 -p 8000:8000 -e 'SPLUNK_START_ARGS=--accept-license' -e 'SPLUNK_GENERAL_TERMS=--accept-sgt-current-at-splunk-com' -e 'SPLUNK_PASSWORD=Chang3d!' --name splunk splunk/splunk:latest
59+
# Wait some time for this environment to be ready
60+
sleep 180
61+
62+
- name: Run a contentctl-ng install to configure the testing environment
63+
env:
64+
APPINSPECTUSERNAME: "${{ secrets.APPINSPECTUSERNAME }}"
65+
APPINSPECTPASSWORD: "${{ secrets.APPINSPECTPASSWORD }}"
66+
run : |
67+
contentctl-ng install --splunkbase-username "$APPINSPECTUSERNAME" --splunkbase-password "$APPINSPECTPASSWORD"
68+
69+
- name: Test content which has changed between this branch and the target branch
70+
run: |
71+
contentctl-ng test --verbose --post-test-behavior NEVER_PAUSE --mode CHANGED --git-ref ${{ github.base_ref }}
4572
echo "contentctl test - COMPLETED"
4673
4774
# Store test_results/summary.yml and dist/DA-ESS-ContentUpdate-latest.tar.gz to job artifact-test_summary_results.zip
@@ -52,7 +79,7 @@ jobs:
5279
name: test_summary_results
5380
path: |
5481
test_results/summary.yml
55-
dist/DA-ESS-ContentUpdate-latest.tar.gz
82+
dist/*.tar.gz
5683
5784
# Print entire result summary so that the users can view it in the Github Actions logs
5885
- name: Print entire test_results/summary.yml

.vscode/extensions.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"redhat.vscode-yaml"
4+
]
5+
}
6+

.vscode/settings.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,18 @@
66
"python.testing.pytestEnabled": true,
77
"python.terminal.activateEnvironment": true,
88
"python.envFile": "${workspaceFolder}/.env",
9-
"python.testing.cwd": "${workspaceFolder}"
9+
"python.testing.cwd": "${workspaceFolder}",
10+
"yaml.schemas": {
11+
"./schemas/RemovedContent.schema.json": "removed/*/*.yml",
12+
"./schemas/Baseline.schema.json": ["baselines/*.yml", "!removed/baselines/*.yml"],
13+
"./schemas/CSVLookup.schema.json": "lookups/csv/*.yml",
14+
"./schemas/Dashboard.schema.json": "dashboards/*.yml",
15+
"./schemas/DataSource.schema.json": "data_sources/*.yml",
16+
"./schemas/EventBasedDetection.schema.json": ["detections/**/*.yml", "!removed/detections/*.yml"],
17+
"./schemas/KVStoreLookup.schema.json": "lookups/kvstore/*.yml",
18+
"./schemas/FilebackedMacro.schema.json": "macros/*.yml",
19+
"./schemas/FilebackedSchedule.schema.json": "schedules/*.yml",
20+
"./schemas/Playbook.schema.json": "playbooks/*.yml",
21+
"./schemas/Story.schema.json": ["stories/*.yml", "!removed/stories/*.yml"]
22+
}
1023
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<nav search_view="search" color="#65A637">
2-
<view name="escu_summary" default="true"/>
3-
<view name="feedback"/>
2+
<view name="landing" default="true"/>
3+
<view name="onboarding"/>
44
<view name="search"/>
55
<collection label="Dashboards">
66
<view source="unclassified" match="__"/>
77
</collection>
88
<a href="https://help.splunk.com/en/splunk-enterprise-security-8/security-content-update">Docs</a>
9+
<a href="/app/SplunkEnterpriseSecuritySuite/ess_use_case_library">Explore in ES</a>
910
</nav>

0 commit comments

Comments
 (0)