Skip to content

Commit 9f30e62

Browse files
committed
Merge branch 'main' into mathieugonzales_replace_deprecated_pydantic_validators
2 parents 22aa2e4 + 5488ca6 commit 9f30e62

File tree

78 files changed

+2480
-2406
lines changed

Some content is hidden

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

78 files changed

+2480
-2406
lines changed

.github/workflows/test_against_escu.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,11 @@ jobs:
5353
poetry install --no-interaction
5454
5555
56-
- name: Clone the AtomicRedTeam Repo (for extended validation)
56+
- name: Clone the AtomicRedTeam Repo and the Mitre/CTI repos for testing enrichments
5757
run: |
5858
cd security_content
59-
git clone --depth 1 https://github.com/redcanaryco/atomic-red-team
59+
git clone --single-branch https://github.com/redcanaryco/atomic-red-team external_repos/atomic-red-team
60+
git clone --single-branch https://github.com/mitre/cti external_repos/cti
6061
6162
6263
# We do not separately run validate and build

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,20 @@
33
<p align="center">
44
<img src="docs/contentctl_logo_white.png" title="In case you're wondering, it's a capybara" alt="contentctl logo" width="250" height="250"></p>
55

6-
7-
6+
# contentctl Quick Start Guide
7+
If you are already familiar with contentctl, the following common commands may be very useful for basic operations
8+
9+
| Operation | Command |
10+
|-----------|---------|
11+
| Create a repository | `contentctl init` |
12+
| Validate Your Content | `contentctl validate` |
13+
| Validate Your Content, performing MITRE Enrichments | `contentctl validate --enrichments`|
14+
| Build Your App | `contentctl build` |
15+
| Test All the content in your app, pausing so that you can debug a search if it fails | `contentctl test --post-test-behavior pause_on_failure mode:all` |
16+
| Test All the content in your app, pausing after every detection to allow debugging | `contentctl test --post-test-behavior always_pause mode:all` |
17+
| Test 1 or more specified detections. If you are testing more than one detection, the paths are space-separated. You may also use shell-expanded regexes | `contentctl test --post-test-behavior always_pause mode:selected --mode.files detections/endpoint/7zip_commandline_to_smb_share_path.yml detections/cloud/aws_multi_factor_authentication_disabled.yml detections/application/okta*` |
18+
| Diff your current branch with a target_branch and test detections that have been updated. Your current branch **must be DIFFERENT** than the target_branch | `contentctl test --post-test-behavior always_pause mode:changes --mode.target_branch develop` |
19+
| Perform Integration Testing of all content. Note that Enterprise Security MUST be listed as an app in your contentctl.yml folder, otherwise all tests will subsequently fail | `contentctl test --enable-integration-testing --post-test-behavior never_pause mode:all` |
820

921
# Introduction
1022
#### Security Is Hard
@@ -122,7 +134,7 @@ This section is under active development. It will allow you to a [MITRE Map](ht
122134
Choose TYPE {detection, story} to create new content for the Content Pack. The tool will interactively ask a series of questions required for generating a basic piece of content and automatically add it to the Content Pack.
123135

124136
### contentctl inspect
125-
This section is under development. It will enable the user to perform an appinspect of the content pack in preparation for deployment onto a Splunk Instance or via Splunk Cloud.
137+
This section is under development. The inspect action performs a number of post-build validations. Primarily, it will enable the user to perform an appinspect of the content pack in preparation for deployment onto a Splunk Instance or via Splunk Cloud. It also compares detections in the new build against a prior build, confirming that any changed detections have had their versions incremented (this comparison happens at the savedsearch.conf level, which is why it must happen after the build). Please also note that new versions of contentctl may result in the generation of different savedsearches.conf files without any content changes in YML (new keys at the .conf level which will necessitate bumping of the version in the YML file).
126138

127139
### contentctl deploy
128140
The reason to build content is so that it can be deployed to your environment. However, deploying content to multiple servers and different types of infrastructure can be tricky and time-consuming. contentctl makes this easy by supporting a number of different deployment mechanisms. Deployment targets can be defined in [contentctl.yml](/contentctl/templates/contentctl_default.yml).

contentctl/actions/build.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from contentctl.input.director import Director, DirectorOutputDto
99
from contentctl.output.conf_output import ConfOutput
1010
from contentctl.output.conf_writer import ConfWriter
11-
from contentctl.output.ba_yml_output import BAYmlOutput
1211
from contentctl.output.api_json_output import ApiJsonOutput
1312
from contentctl.output.data_source_writer import DataSourceWriter
1413
from contentctl.objects.lookup import Lookup
@@ -51,6 +50,7 @@ def execute(self, input_dto: BuildInputDto) -> DirectorOutputDto:
5150
updated_conf_files.update(conf_output.writeObjects(input_dto.director_output_dto.investigations, SecurityContentType.investigations))
5251
updated_conf_files.update(conf_output.writeObjects(input_dto.director_output_dto.lookups, SecurityContentType.lookups))
5352
updated_conf_files.update(conf_output.writeObjects(input_dto.director_output_dto.macros, SecurityContentType.macros))
53+
updated_conf_files.update(conf_output.writeObjects(input_dto.director_output_dto.dashboards, SecurityContentType.dashboards))
5454
updated_conf_files.update(conf_output.writeAppConf())
5555

5656
#Ensure that the conf file we just generated/update is syntactically valid
@@ -86,17 +86,4 @@ def execute(self, input_dto: BuildInputDto) -> DirectorOutputDto:
8686

8787
print(f"Build of '{input_dto.config.app.title}' API successful to {input_dto.config.getAPIPath()}")
8888

89-
if input_dto.config.build_ssa:
90-
91-
srs_path = input_dto.config.getSSAPath() / 'srs'
92-
complex_path = input_dto.config.getSSAPath() / 'complex'
93-
shutil.rmtree(srs_path, ignore_errors=True)
94-
shutil.rmtree(complex_path, ignore_errors=True)
95-
srs_path.mkdir(parents=True)
96-
complex_path.mkdir(parents=True)
97-
ba_yml_output = BAYmlOutput()
98-
ba_yml_output.writeObjects(input_dto.director_output_dto.ssa_detections, str(input_dto.config.getSSAPath()))
99-
100-
print(f"Build of 'SSA' successful to {input_dto.config.getSSAPath()}")
101-
10289
return input_dto.director_output_dto

contentctl/actions/convert.py

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

0 commit comments

Comments
 (0)