Skip to content

Commit 904ed46

Browse files
authored
Merge pull request #172 from splunk/release_v4.1.0
Release v4.1.0
2 parents d94aa7b + 4d2f4fd commit 904ed46

File tree

21 files changed

+511
-471
lines changed

21 files changed

+511
-471
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# The default branch of security_content should always be correct.
2+
# As such, we should use it in our test workflow, here, to ensure
3+
# that contentctl is also correct and does not throw unexpected errors.
4+
5+
# We should remember that if contentctl introduces NEW validations that have
6+
# note yet been fixed in security_content, we may see this workflow fail.
7+
name: test_against_escu
8+
on:
9+
push:
10+
pull_request:
11+
types: [opened, reopened]
12+
schedule:
13+
- cron: "44 4 * * *"
14+
15+
jobs:
16+
smoketest_escu:
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
python_version: ["3.11", "3.12"]
21+
operating_system: ["ubuntu-20.04", "ubuntu-22.04", "macos-latest", "macos-14"]
22+
#operating_system: ["ubuntu-20.04", "ubuntu-22.04", "macos-latest"]
23+
24+
25+
runs-on: ${{ matrix.operating_system }}
26+
steps:
27+
# Checkout the current branch of contentctl repo
28+
- name: Checkout repo
29+
uses: actions/checkout@v4
30+
31+
# Checkout the develop (default) branch of security_content
32+
- name: Checkout repo
33+
uses: actions/checkout@v4
34+
with:
35+
path: security_content
36+
repository: splunk/security_content
37+
38+
#Install the given version of Python we will test against
39+
- name: Install Required Python Version
40+
uses: actions/setup-python@v5
41+
with:
42+
python-version: ${{ matrix.python_version }}
43+
architecture: "x64"
44+
45+
- name: Install Poetry
46+
run:
47+
python -m pip install poetry
48+
49+
- name: Install contentctl and activate the shell
50+
run: |
51+
poetry install --no-interaction
52+
53+
54+
- name: Clone the AtomicRedTeam Repo (for extended validation)
55+
run: |
56+
cd security_content
57+
git clone --depth 1 https://github.com/redcanaryco/atomic-red-team
58+
59+
60+
# We do not separately run validate and build
61+
# since a build ALSO performs a validate
62+
- name: Run contentctl build
63+
run: |
64+
cd security_content
65+
poetry run contentctl build --enrichments
66+
67+
# Do not run a test - it will take far too long!
68+
# Do not upload any artifacts
69+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ apps*
1010
test_results*
1111
attack_data*
1212
security_content/
13+
contentctl.yml
1314

1415
# Byte-compiled / optimized / DLL files
1516
__pycache__/

contentctl/actions/apav_deploy.py

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

contentctl/actions/api_deploy.py

Lines changed: 0 additions & 151 deletions
This file was deleted.
File renamed without changes.

contentctl/actions/inspect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def inspectAppAPI(self, config: inspect)->str:
6161
if not package_path.is_file():
6262
raise Exception(f"Cannot run Appinspect API on App '{config.app.title}' - "
6363
f"no package exists as expected path '{package_path}'.\nAre you "
64-
"trying to 'contentctl acs_deploy' the package BEFORE running 'contentctl build'?")
64+
"trying to 'contentctl deploy_acs' the package BEFORE running 'contentctl build'?")
6565

6666
files = {
6767
"app_package": open(package_path,"rb"),

contentctl/actions/new_content.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ def buildDetection(self)->dict[str,Any]:
2525
answers['date'] = datetime.today().strftime('%Y-%m-%d')
2626
answers['author'] = answers['detection_author']
2727
del answers['detection_author']
28-
answers['data_source'] = answers['data_source']
28+
answers['data_sources'] = answers['data_source']
29+
del answers['data_source']
2930
answers['type'] = answers['detection_type']
3031
del answers['detection_type']
3132
answers['status'] = "production" #start everything as production since that's what we INTEND the content to become
@@ -49,6 +50,7 @@ def buildDetection(self)->dict[str,Any]:
4950
answers['tags']['required_fields'] = ['UPDATE']
5051
answers['tags']['risk_score'] = 'UPDATE (impact * confidence)/100'
5152
answers['tags']['security_domain'] = answers['security_domain']
53+
del answers["security_domain"]
5254
answers['tags']['cve'] = ['UPDATE WITH CVE(S) IF APPLICABLE']
5355

5456
#generate the tests section
@@ -64,6 +66,7 @@ def buildDetection(self)->dict[str,Any]:
6466
]
6567
}
6668
]
69+
del answers["mitre_attack_ids"]
6770
return answers
6871

6972
def buildStory(self)->dict[str,Any]:
@@ -111,12 +114,12 @@ def writeObjectNewContent(self, object: dict, subdirectory_name: str, type: NewC
111114
#make sure the output folder exists for this detection
112115
output_folder.mkdir(exist_ok=True)
113116

114-
YmlWriter.writeYmlFile(file_path, object)
117+
YmlWriter.writeDetection(file_path, object)
115118
print("Successfully created detection " + file_path)
116119

117120
elif type == NewContentType.story:
118121
file_path = os.path.join(self.output_path, 'stories', self.convertNameToFileName(object['name'], object['tags']['product']))
119-
YmlWriter.writeYmlFile(file_path, object)
122+
YmlWriter.writeStory(file_path, object)
120123
print("Successfully created story " + file_path)
121124

122125
else:

contentctl/actions/validate.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def execute(self, input_dto: validate) -> DirectorOutputDto:
2323
director_output_dto = DirectorOutputDto(AtomicTest.getAtomicTestsFromArtRepo(repo_path=input_dto.getAtomicRedTeamRepoPath(),
2424
enabled=input_dto.enrichments),
2525
AttackEnrichment.getAttackEnrichment(input_dto),
26+
CveEnrichment.getCveEnrichment(input_dto),
2627
[],[],[],[],[],[],[],[],[])
2728

2829

0 commit comments

Comments
 (0)