contentctl 4.2.5__tar.gz → 4.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {contentctl-4.2.5 → contentctl-4.3.1}/PKG-INFO +16 -6
- {contentctl-4.2.5 → contentctl-4.3.1}/README.md +14 -2
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/build.py +0 -14
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/detection_testing/infrastructures/DetectionTestingInfrastructure.py +60 -24
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/validate.py +0 -1
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/input/director.py +9 -44
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/abstract_security_content_objects/detection_abstract.py +61 -74
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/config.py +0 -2
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/constants.py +5 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/observable.py +5 -3
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/detections/endpoint/anomalous_usage_of_7zip.yml +2 -2
- {contentctl-4.2.5 → contentctl-4.3.1}/pyproject.toml +2 -5
- contentctl-4.2.5/contentctl/actions/convert.py +0 -25
- contentctl-4.2.5/contentctl/input/backend_splunk_ba.py +0 -144
- contentctl-4.2.5/contentctl/input/sigma_converter.py +0 -436
- contentctl-4.2.5/contentctl/input/ssa_detection_builder.py +0 -169
- contentctl-4.2.5/contentctl/output/ba_yml_output.py +0 -153
- contentctl-4.2.5/contentctl/output/finding_report_writer.py +0 -91
- {contentctl-4.2.5 → contentctl-4.3.1}/LICENSE.md +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/__init__.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/deploy_acs.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/detection_testing/DetectionTestingManager.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/detection_testing/GitService.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/detection_testing/generate_detection_coverage_badge.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/detection_testing/infrastructures/DetectionTestingInfrastructureContainer.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/detection_testing/infrastructures/DetectionTestingInfrastructureServer.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/detection_testing/progress_bar.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/detection_testing/views/DetectionTestingView.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/detection_testing/views/DetectionTestingViewCLI.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/detection_testing/views/DetectionTestingViewFile.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/detection_testing/views/DetectionTestingViewWeb.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/doc_gen.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/initialize.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/initialize_old.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/inspect.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/new_content.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/release_notes.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/reporting.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/actions/test.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/api.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/contentctl.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/enrichments/attack_enrichment.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/enrichments/cve_enrichment.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/enrichments/splunk_app_enrichment.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/helper/link_validator.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/helper/logger.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/helper/splunk_app.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/helper/utils.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/input/new_content_questions.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/input/yml_reader.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/abstract_security_content_objects/security_content_object_abstract.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/alert_action.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/atomic.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/base_test.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/base_test_result.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/baseline.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/baseline_tags.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/correlation_search.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/data_source.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/deployment.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/deployment_email.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/deployment_notable.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/deployment_phantom.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/deployment_rba.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/deployment_scheduling.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/deployment_slack.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/detection.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/detection_tags.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/enums.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/errors.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/event_source.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/integration_test.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/integration_test_result.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/investigation.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/investigation_tags.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/lookup.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/macro.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/mitre_attack_enrichment.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/notable_action.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/notable_event.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/playbook.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/playbook_tags.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/risk_analysis_action.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/risk_event.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/risk_object.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/security_content_object.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/ssa_detection.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/ssa_detection_tags.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/story.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/story_tags.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/test_group.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/threat_object.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/unit_test.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/unit_test_attack_data.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/unit_test_baseline.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/unit_test_old.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/unit_test_result.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/objects/unit_test_ssa.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/api_json_output.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/attack_nav_output.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/attack_nav_writer.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/conf_output.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/conf_writer.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/data_source_writer.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/detection_writer.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/doc_md_output.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/jinja_writer.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/json_writer.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/new_content_yml_output.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/svg_output.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/analyticstories_detections.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/analyticstories_investigations.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/analyticstories_stories.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/app.conf.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/app.manifest.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/collections.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/content-version.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/detection_count.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/detection_coverage.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/doc_detection_page.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/doc_detections.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/doc_navigation.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/doc_navigation_pages.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/doc_playbooks.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/doc_playbooks_page.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/doc_stories.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/doc_story_page.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/es_investigations_investigations.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/es_investigations_stories.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/finding_report.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/header.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/macros.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/panel.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/savedsearches_baselines.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/savedsearches_detections.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/savedsearches_investigations.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/transforms.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/templates/workflow_actions.j2 +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/yml_output.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/output/yml_writer.py +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/README.md +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/app_default.yml +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/app_template/README/essoc_story_detail.txt +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/app_template/README/essoc_summary.txt +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/app_template/README/essoc_usage_dashboard.txt +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/app_template/README.md +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/app_template/default/analytic_stories.conf +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/app_template/default/app.conf +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/app_template/default/commands.conf +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/app_template/default/content-version.conf +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/app_template/default/data/ui/nav/default.xml +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/app_template/default/data/ui/views/escu_summary.xml +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/app_template/default/data/ui/views/feedback.xml +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/app_template/default/use_case_library.conf +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/app_template/lookups/mitre_enrichment.csv +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/app_template/metadata/default.meta +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/app_template/static/appIcon.png +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/app_template/static/appIconAlt.png +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/app_template/static/appIconAlt_2x.png +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/app_template/static/appIcon_2x.png +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/data_sources/sysmon_eventid_1.yml +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/datamodels_cim.conf +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/datamodels_custom.conf +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/deployments/escu_default_configuration_anomaly.yml +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/deployments/escu_default_configuration_baseline.yml +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/deployments/escu_default_configuration_correlation.yml +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/deployments/escu_default_configuration_hunting.yml +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/deployments/escu_default_configuration_ttp.yml +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/detections/application/.gitkeep +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/detections/cloud/.gitkeep +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/detections/network/.gitkeep +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/detections/web/.gitkeep +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/macros/security_content_ctime.yml +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/macros/security_content_summariesonly.yml +0 -0
- {contentctl-4.2.5 → contentctl-4.3.1}/contentctl/templates/stories/cobalt_strike.yml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: contentctl
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.3.1
|
|
4
4
|
Summary: Splunk Content Control Tool
|
|
5
5
|
License: Apache 2.0
|
|
6
6
|
Author: STRT
|
|
@@ -19,12 +19,10 @@ Requires-Dist: gitpython (>=3.1.43,<4.0.0)
|
|
|
19
19
|
Requires-Dist: pycvesearch (>=1.2,<2.0)
|
|
20
20
|
Requires-Dist: pydantic (>=2.7.1,<3.0.0)
|
|
21
21
|
Requires-Dist: pygit2 (>=1.14.1,<2.0.0)
|
|
22
|
-
Requires-Dist: pysigma (>=0.11.5,<0.12.0)
|
|
23
|
-
Requires-Dist: pysigma-backend-splunk (>=1.1.0,<2.0.0)
|
|
24
22
|
Requires-Dist: questionary (>=2.0.1,<3.0.0)
|
|
25
23
|
Requires-Dist: requests (>=2.32.2,<2.33.0)
|
|
26
24
|
Requires-Dist: semantic-version (>=2.10.0,<3.0.0)
|
|
27
|
-
Requires-Dist: setuptools (>=69.5.1,<
|
|
25
|
+
Requires-Dist: setuptools (>=69.5.1,<74.0.0)
|
|
28
26
|
Requires-Dist: splunk-sdk (>=2.0.1,<3.0.0)
|
|
29
27
|
Requires-Dist: tqdm (>=4.66.4,<5.0.0)
|
|
30
28
|
Requires-Dist: tyro (>=0.8.3,<0.9.0)
|
|
@@ -36,8 +34,20 @@ Description-Content-Type: text/markdown
|
|
|
36
34
|
<p align="center">
|
|
37
35
|
<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>
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
# contentctl Quick Start Guide
|
|
38
|
+
If you are already familiar with contentctl, the following common commands may be very useful for basic operations
|
|
39
|
+
|
|
40
|
+
| Operation | Command |
|
|
41
|
+
|-----------|---------|
|
|
42
|
+
| Create a repository | `contentctl init` |
|
|
43
|
+
| Validate Your Content | `contentctl validate` |
|
|
44
|
+
| Validate Your Content, performing MITRE Enrichments | `contentctl validate –-enrichments`|
|
|
45
|
+
| Build Your App | `contentctl build` |
|
|
46
|
+
| 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` |
|
|
47
|
+
| Test All the content in your app, pausing after every detection to allow debugging | `contentctl test –-post-test-behavior always_pause mode:all` |
|
|
48
|
+
| 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*` |
|
|
49
|
+
| 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` |
|
|
50
|
+
| 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` |
|
|
41
51
|
|
|
42
52
|
# Introduction
|
|
43
53
|
#### Security Is Hard
|
|
@@ -3,8 +3,20 @@
|
|
|
3
3
|
<p align="center">
|
|
4
4
|
<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>
|
|
5
5
|
|
|
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` |
|
|
8
20
|
|
|
9
21
|
# Introduction
|
|
10
22
|
#### Security Is Hard
|
|
@@ -8,7 +8,6 @@ from contentctl.objects.enums import SecurityContentProduct, SecurityContentType
|
|
|
8
8
|
from contentctl.input.director import Director, DirectorOutputDto
|
|
9
9
|
from contentctl.output.conf_output import ConfOutput
|
|
10
10
|
from contentctl.output.conf_writer import ConfWriter
|
|
11
|
-
from contentctl.output.ba_yml_output import BAYmlOutput
|
|
12
11
|
from contentctl.output.api_json_output import ApiJsonOutput
|
|
13
12
|
from contentctl.output.data_source_writer import DataSourceWriter
|
|
14
13
|
from contentctl.objects.lookup import Lookup
|
|
@@ -86,17 +85,4 @@ class Build:
|
|
|
86
85
|
|
|
87
86
|
print(f"Build of '{input_dto.config.app.title}' API successful to {input_dto.config.getAPIPath()}")
|
|
88
87
|
|
|
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
|
-
|
|
102
88
|
return input_dto.director_output_dto
|
|
@@ -1060,7 +1060,9 @@ class DetectionTestingInfrastructure(BaseModel, abc.ABC):
|
|
|
1060
1060
|
results = JSONResultsReader(job.results(output_mode="json"))
|
|
1061
1061
|
|
|
1062
1062
|
# Consolidate a set of the distinct observable field names
|
|
1063
|
-
observable_fields_set = set([o.name for o in detection.tags.observable])
|
|
1063
|
+
observable_fields_set = set([o.name for o in detection.tags.observable]) # keeping this around for later
|
|
1064
|
+
risk_object_fields_set = set([o.name for o in detection.tags.observable if "Victim" in o.role ]) # just the "Risk Objects"
|
|
1065
|
+
threat_object_fields_set = set([o.name for o in detection.tags.observable if "Attacker" in o.role]) # just the "threat objects"
|
|
1064
1066
|
|
|
1065
1067
|
# Ensure the search had at least one result
|
|
1066
1068
|
if int(job.content.get("resultCount", "0")) > 0:
|
|
@@ -1068,7 +1070,10 @@ class DetectionTestingInfrastructure(BaseModel, abc.ABC):
|
|
|
1068
1070
|
test.result = UnitTestResult()
|
|
1069
1071
|
|
|
1070
1072
|
# Initialize the collection of fields that are empty that shouldn't be
|
|
1073
|
+
present_threat_objects: set[str] = set()
|
|
1071
1074
|
empty_fields: set[str] = set()
|
|
1075
|
+
|
|
1076
|
+
|
|
1072
1077
|
|
|
1073
1078
|
# Filter out any messages in the results
|
|
1074
1079
|
for result in results:
|
|
@@ -1077,30 +1082,50 @@ class DetectionTestingInfrastructure(BaseModel, abc.ABC):
|
|
|
1077
1082
|
|
|
1078
1083
|
# If not a message, it is a dict and we will process it
|
|
1079
1084
|
results_fields_set = set(result.keys())
|
|
1085
|
+
# Guard against first events (relevant later)
|
|
1080
1086
|
|
|
1081
|
-
# Identify any
|
|
1082
|
-
|
|
1083
|
-
if len(
|
|
1087
|
+
# Identify any risk object fields that are not available in the results
|
|
1088
|
+
missing_risk_objects = risk_object_fields_set - results_fields_set
|
|
1089
|
+
if len(missing_risk_objects) > 0:
|
|
1084
1090
|
# Report a failure in such cases
|
|
1085
|
-
e = Exception(f"The observable field(s) {
|
|
1091
|
+
e = Exception(f"The observable field(s) {missing_risk_objects} are missing in the detection results")
|
|
1086
1092
|
test.result.set_job_content(
|
|
1087
1093
|
job.content,
|
|
1088
1094
|
self.infrastructure,
|
|
1089
|
-
TestResultStatus.
|
|
1095
|
+
TestResultStatus.FAIL,
|
|
1090
1096
|
exception=e,
|
|
1091
1097
|
duration=time.time() - search_start_time,
|
|
1092
1098
|
)
|
|
1093
1099
|
|
|
1094
|
-
return
|
|
1100
|
+
return
|
|
1095
1101
|
|
|
1096
|
-
# If we find one or more fields that contain the string "null" then they were
|
|
1102
|
+
# If we find one or more risk object fields that contain the string "null" then they were
|
|
1097
1103
|
# not populated and we should throw an error. This can happen if there is a typo
|
|
1098
1104
|
# on a field. In this case, the field will appear but will not contain any values
|
|
1099
|
-
current_empty_fields = set()
|
|
1105
|
+
current_empty_fields: set[str] = set()
|
|
1106
|
+
|
|
1100
1107
|
for field in observable_fields_set:
|
|
1101
1108
|
if result.get(field, 'null') == 'null':
|
|
1102
|
-
|
|
1103
|
-
|
|
1109
|
+
if field in risk_object_fields_set:
|
|
1110
|
+
e = Exception(f"The risk object field {field} is missing in at least one result.")
|
|
1111
|
+
test.result.set_job_content(
|
|
1112
|
+
job.content,
|
|
1113
|
+
self.infrastructure,
|
|
1114
|
+
TestResultStatus.FAIL,
|
|
1115
|
+
exception=e,
|
|
1116
|
+
duration=time.time() - search_start_time,
|
|
1117
|
+
)
|
|
1118
|
+
return
|
|
1119
|
+
else:
|
|
1120
|
+
if field in threat_object_fields_set:
|
|
1121
|
+
current_empty_fields.add(field)
|
|
1122
|
+
else:
|
|
1123
|
+
if field in threat_object_fields_set:
|
|
1124
|
+
present_threat_objects.add(field)
|
|
1125
|
+
continue
|
|
1126
|
+
|
|
1127
|
+
|
|
1128
|
+
|
|
1104
1129
|
# If everything succeeded up until now, and no empty fields are found in the
|
|
1105
1130
|
# current result, then the search was a success
|
|
1106
1131
|
if len(current_empty_fields) == 0:
|
|
@@ -1114,21 +1139,32 @@ class DetectionTestingInfrastructure(BaseModel, abc.ABC):
|
|
|
1114
1139
|
|
|
1115
1140
|
else:
|
|
1116
1141
|
empty_fields = empty_fields.union(current_empty_fields)
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
missing_threat_objects = threat_object_fields_set - present_threat_objects
|
|
1145
|
+
# Report a failure if there were empty fields in a threat object in all results
|
|
1146
|
+
if len(missing_threat_objects) > 0:
|
|
1147
|
+
e = Exception(
|
|
1148
|
+
f"One or more required threat object fields {missing_threat_objects} contained 'null' values in all events. "
|
|
1149
|
+
"Is the data being parsed correctly or is there an error in the naming of a field?"
|
|
1122
1150
|
)
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1151
|
+
test.result.set_job_content(
|
|
1152
|
+
job.content,
|
|
1153
|
+
self.infrastructure,
|
|
1154
|
+
TestResultStatus.FAIL,
|
|
1155
|
+
exception=e,
|
|
1156
|
+
duration=time.time() - search_start_time,
|
|
1157
|
+
)
|
|
1158
|
+
return
|
|
1159
|
+
|
|
1130
1160
|
|
|
1131
|
-
|
|
1161
|
+
test.result.set_job_content(
|
|
1162
|
+
job.content,
|
|
1163
|
+
self.infrastructure,
|
|
1164
|
+
TestResultStatus.PASS,
|
|
1165
|
+
duration=time.time() - search_start_time,
|
|
1166
|
+
)
|
|
1167
|
+
return
|
|
1132
1168
|
|
|
1133
1169
|
else:
|
|
1134
1170
|
# Report a failure if there were no results at all
|
|
@@ -28,13 +28,11 @@ from contentctl.enrichments.attack_enrichment import AttackEnrichment
|
|
|
28
28
|
from contentctl.enrichments.cve_enrichment import CveEnrichment
|
|
29
29
|
|
|
30
30
|
from contentctl.objects.config import validate
|
|
31
|
-
from contentctl.input.ssa_detection_builder import SSADetectionBuilder
|
|
32
31
|
from contentctl.objects.enums import SecurityContentType
|
|
33
32
|
|
|
34
33
|
from contentctl.objects.enums import DetectionStatus
|
|
35
34
|
from contentctl.helper.utils import Utils
|
|
36
35
|
|
|
37
|
-
from contentctl.input.ssa_detection_builder import SSADetectionBuilder
|
|
38
36
|
from contentctl.objects.enums import SecurityContentType
|
|
39
37
|
|
|
40
38
|
from contentctl.objects.enums import DetectionStatus
|
|
@@ -56,7 +54,6 @@ class DirectorOutputDto:
|
|
|
56
54
|
macros: list[Macro]
|
|
57
55
|
lookups: list[Lookup]
|
|
58
56
|
deployments: list[Deployment]
|
|
59
|
-
ssa_detections: list[SSADetection]
|
|
60
57
|
data_sources: list[DataSource]
|
|
61
58
|
name_to_content_map: dict[str, SecurityContentObject] = field(default_factory=dict)
|
|
62
59
|
uuid_to_content_map: dict[UUID, SecurityContentObject] = field(default_factory=dict)
|
|
@@ -98,8 +95,6 @@ class DirectorOutputDto:
|
|
|
98
95
|
self.stories.append(content)
|
|
99
96
|
elif isinstance(content, Detection):
|
|
100
97
|
self.detections.append(content)
|
|
101
|
-
elif isinstance(content, SSADetection):
|
|
102
|
-
self.ssa_detections.append(content)
|
|
103
98
|
elif isinstance(content, DataSource):
|
|
104
99
|
self.data_sources.append(content)
|
|
105
100
|
else:
|
|
@@ -112,11 +107,9 @@ class DirectorOutputDto:
|
|
|
112
107
|
class Director():
|
|
113
108
|
input_dto: validate
|
|
114
109
|
output_dto: DirectorOutputDto
|
|
115
|
-
ssa_detection_builder: SSADetectionBuilder
|
|
116
110
|
|
|
117
111
|
def __init__(self, output_dto: DirectorOutputDto) -> None:
|
|
118
112
|
self.output_dto = output_dto
|
|
119
|
-
self.ssa_detection_builder = SSADetectionBuilder()
|
|
120
113
|
|
|
121
114
|
def execute(self, input_dto: validate) -> None:
|
|
122
115
|
self.input_dto = input_dto
|
|
@@ -129,7 +122,6 @@ class Director():
|
|
|
129
122
|
self.createSecurityContent(SecurityContentType.data_sources)
|
|
130
123
|
self.createSecurityContent(SecurityContentType.playbooks)
|
|
131
124
|
self.createSecurityContent(SecurityContentType.detections)
|
|
132
|
-
self.createSecurityContent(SecurityContentType.ssa_detections)
|
|
133
125
|
|
|
134
126
|
|
|
135
127
|
from contentctl.objects.abstract_security_content_objects.detection_abstract import MISSING_SOURCES
|
|
@@ -142,12 +134,7 @@ class Director():
|
|
|
142
134
|
print("No missing data_sources!")
|
|
143
135
|
|
|
144
136
|
def createSecurityContent(self, contentType: SecurityContentType) -> None:
|
|
145
|
-
if contentType
|
|
146
|
-
files = Utils.get_all_yml_files_from_directory(
|
|
147
|
-
os.path.join(self.input_dto.path, "ssa_detections")
|
|
148
|
-
)
|
|
149
|
-
security_content_files = [f for f in files if f.name.startswith("ssa___")]
|
|
150
|
-
elif contentType in [
|
|
137
|
+
if contentType in [
|
|
151
138
|
SecurityContentType.deployments,
|
|
152
139
|
SecurityContentType.lookups,
|
|
153
140
|
SecurityContentType.macros,
|
|
@@ -179,43 +166,37 @@ class Director():
|
|
|
179
166
|
modelDict = YmlReader.load_file(file)
|
|
180
167
|
|
|
181
168
|
if contentType == SecurityContentType.lookups:
|
|
182
|
-
lookup = Lookup.model_validate(modelDict,context={"output_dto":self.output_dto, "config":self.input_dto})
|
|
169
|
+
lookup = Lookup.model_validate(modelDict, context={"output_dto":self.output_dto, "config":self.input_dto})
|
|
183
170
|
self.output_dto.addContentToDictMappings(lookup)
|
|
184
171
|
|
|
185
172
|
elif contentType == SecurityContentType.macros:
|
|
186
|
-
macro = Macro.model_validate(modelDict,context={"output_dto":self.output_dto})
|
|
173
|
+
macro = Macro.model_validate(modelDict, context={"output_dto":self.output_dto})
|
|
187
174
|
self.output_dto.addContentToDictMappings(macro)
|
|
188
175
|
|
|
189
176
|
elif contentType == SecurityContentType.deployments:
|
|
190
|
-
deployment = Deployment.model_validate(modelDict,context={"output_dto":self.output_dto})
|
|
177
|
+
deployment = Deployment.model_validate(modelDict, context={"output_dto":self.output_dto})
|
|
191
178
|
self.output_dto.addContentToDictMappings(deployment)
|
|
192
179
|
|
|
193
180
|
elif contentType == SecurityContentType.playbooks:
|
|
194
|
-
playbook = Playbook.model_validate(modelDict,context={"output_dto":self.output_dto})
|
|
181
|
+
playbook = Playbook.model_validate(modelDict, context={"output_dto":self.output_dto})
|
|
195
182
|
self.output_dto.addContentToDictMappings(playbook)
|
|
196
183
|
|
|
197
184
|
elif contentType == SecurityContentType.baselines:
|
|
198
|
-
baseline = Baseline.model_validate(modelDict,context={"output_dto":self.output_dto})
|
|
185
|
+
baseline = Baseline.model_validate(modelDict, context={"output_dto":self.output_dto})
|
|
199
186
|
self.output_dto.addContentToDictMappings(baseline)
|
|
200
187
|
|
|
201
188
|
elif contentType == SecurityContentType.investigations:
|
|
202
|
-
investigation = Investigation.model_validate(modelDict,context={"output_dto":self.output_dto})
|
|
189
|
+
investigation = Investigation.model_validate(modelDict, context={"output_dto":self.output_dto})
|
|
203
190
|
self.output_dto.addContentToDictMappings(investigation)
|
|
204
191
|
|
|
205
192
|
elif contentType == SecurityContentType.stories:
|
|
206
|
-
story = Story.model_validate(modelDict,context={"output_dto":self.output_dto})
|
|
193
|
+
story = Story.model_validate(modelDict, context={"output_dto":self.output_dto})
|
|
207
194
|
self.output_dto.addContentToDictMappings(story)
|
|
208
195
|
|
|
209
196
|
elif contentType == SecurityContentType.detections:
|
|
210
|
-
detection = Detection.model_validate(modelDict,context={"output_dto":self.output_dto, "app":self.input_dto.app})
|
|
197
|
+
detection = Detection.model_validate(modelDict, context={"output_dto":self.output_dto, "app":self.input_dto.app})
|
|
211
198
|
self.output_dto.addContentToDictMappings(detection)
|
|
212
199
|
|
|
213
|
-
elif contentType == SecurityContentType.ssa_detections:
|
|
214
|
-
self.constructSSADetection(self.ssa_detection_builder, self.output_dto,str(file))
|
|
215
|
-
ssa_detection = self.ssa_detection_builder.getObject()
|
|
216
|
-
if ssa_detection.status in [DetectionStatus.production.value, DetectionStatus.validation.value]:
|
|
217
|
-
self.output_dto.addContentToDictMappings(ssa_detection)
|
|
218
|
-
|
|
219
200
|
elif contentType == SecurityContentType.data_sources:
|
|
220
201
|
data_source = DataSource.model_validate(
|
|
221
202
|
modelDict, context={"output_dto": self.output_dto}
|
|
@@ -262,19 +243,3 @@ class Director():
|
|
|
262
243
|
f"The following {len(validation_errors)} error(s) were found during validation:\n\n{errors_string}\n\nVALIDATION FAILED"
|
|
263
244
|
)
|
|
264
245
|
|
|
265
|
-
def constructSSADetection(
|
|
266
|
-
self,
|
|
267
|
-
builder: SSADetectionBuilder,
|
|
268
|
-
directorOutput: DirectorOutputDto,
|
|
269
|
-
file_path: str,
|
|
270
|
-
) -> None:
|
|
271
|
-
builder.reset()
|
|
272
|
-
builder.setObject(file_path)
|
|
273
|
-
builder.addMitreAttackEnrichmentNew(directorOutput.attack_enrichment)
|
|
274
|
-
builder.addKillChainPhase()
|
|
275
|
-
builder.addCIS()
|
|
276
|
-
builder.addNist()
|
|
277
|
-
builder.addAnnotations()
|
|
278
|
-
builder.addMappings()
|
|
279
|
-
builder.addUnitTest()
|
|
280
|
-
builder.addRBA()
|
|
@@ -46,7 +46,7 @@ class Detection_Abstract(SecurityContentObject):
|
|
|
46
46
|
status: DetectionStatus = Field(...)
|
|
47
47
|
data_source: list[str] = []
|
|
48
48
|
tags: DetectionTags = Field(...)
|
|
49
|
-
search:
|
|
49
|
+
search: str = Field(...)
|
|
50
50
|
how_to_implement: str = Field(..., min_length=4)
|
|
51
51
|
known_false_positives: str = Field(..., min_length=4)
|
|
52
52
|
|
|
@@ -65,11 +65,7 @@ class Detection_Abstract(SecurityContentObject):
|
|
|
65
65
|
|
|
66
66
|
@field_validator("search", mode="before")
|
|
67
67
|
@classmethod
|
|
68
|
-
def validate_presence_of_filter_macro(
|
|
69
|
-
cls,
|
|
70
|
-
value: Union[str, dict[str, Any]],
|
|
71
|
-
info: ValidationInfo
|
|
72
|
-
) -> Union[str, dict[str, Any]]:
|
|
68
|
+
def validate_presence_of_filter_macro(cls, value:str, info:ValidationInfo)->str:
|
|
73
69
|
"""
|
|
74
70
|
Validates that, if required to be present, the filter macro is present with the proper name.
|
|
75
71
|
The filter macro MUST be derived from the name of the detection
|
|
@@ -83,12 +79,9 @@ class Detection_Abstract(SecurityContentObject):
|
|
|
83
79
|
|
|
84
80
|
Returns:
|
|
85
81
|
Union[str, dict[str,Any]]: The search, either in sigma or SPL format.
|
|
86
|
-
"""
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
# If the search is a dict, then it is in Sigma format so return it
|
|
90
|
-
return value
|
|
91
|
-
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
|
|
92
85
|
# Otherwise, the search is SPL.
|
|
93
86
|
|
|
94
87
|
# In the future, we will may add support that makes the inclusion of the
|
|
@@ -155,15 +148,16 @@ class Detection_Abstract(SecurityContentObject):
|
|
|
155
148
|
@computed_field
|
|
156
149
|
@property
|
|
157
150
|
def datamodel(self) -> List[DataModel]:
|
|
158
|
-
if
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
151
|
+
return [dm for dm in DataModel if dm.value in self.search]
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
162
155
|
|
|
163
156
|
@computed_field
|
|
164
157
|
@property
|
|
165
158
|
def source(self) -> str:
|
|
166
159
|
return self.file_path.absolute().parent.name
|
|
160
|
+
|
|
167
161
|
|
|
168
162
|
deployment: Deployment = Field({})
|
|
169
163
|
|
|
@@ -249,12 +243,9 @@ class Detection_Abstract(SecurityContentObject):
|
|
|
249
243
|
@computed_field
|
|
250
244
|
@property
|
|
251
245
|
def providing_technologies(self) -> List[ProvidingTechnology]:
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
# Dict-formatted searches (sigma) will not have providing technologies
|
|
256
|
-
return []
|
|
257
|
-
|
|
246
|
+
return ProvidingTechnology.getProvidingTechFromSearch(self.search)
|
|
247
|
+
|
|
248
|
+
|
|
258
249
|
@computed_field
|
|
259
250
|
@property
|
|
260
251
|
def risk(self) -> list[dict[str, Any]]:
|
|
@@ -299,6 +290,11 @@ class Detection_Abstract(SecurityContentObject):
|
|
|
299
290
|
risk_object['threat_object_field'] = entity.name
|
|
300
291
|
risk_object['threat_object_type'] = "url"
|
|
301
292
|
risk_objects.append(risk_object)
|
|
293
|
+
|
|
294
|
+
elif 'Attacker' in entity.role:
|
|
295
|
+
risk_object['threat_object_field'] = entity.name
|
|
296
|
+
risk_object['threat_object_type'] = entity.type.lower()
|
|
297
|
+
risk_objects.append(risk_object)
|
|
302
298
|
|
|
303
299
|
else:
|
|
304
300
|
risk_object['risk_object_type'] = 'other'
|
|
@@ -445,18 +441,13 @@ class Detection_Abstract(SecurityContentObject):
|
|
|
445
441
|
|
|
446
442
|
@field_validator('lookups', mode="before")
|
|
447
443
|
@classmethod
|
|
448
|
-
def getDetectionLookups(cls, v:
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
if not isinstance(search, str):
|
|
456
|
-
# The search was sigma formatted (or failed other validation and was None), so we will
|
|
457
|
-
# not validate macros in it
|
|
458
|
-
return []
|
|
459
|
-
|
|
444
|
+
def getDetectionLookups(cls, v:list[str], info:ValidationInfo) -> list[Lookup]:
|
|
445
|
+
director:DirectorOutputDto = info.context.get("output_dto",None)
|
|
446
|
+
|
|
447
|
+
search:Union[str,None] = info.data.get("search",None)
|
|
448
|
+
if search is None:
|
|
449
|
+
raise ValueError("Search was None - is this file missing the search field?")
|
|
450
|
+
|
|
460
451
|
lookups = Lookup.get_lookups(search, director)
|
|
461
452
|
return lookups
|
|
462
453
|
|
|
@@ -496,11 +487,9 @@ class Detection_Abstract(SecurityContentObject):
|
|
|
496
487
|
|
|
497
488
|
director: DirectorOutputDto = info.context.get("output_dto", None)
|
|
498
489
|
|
|
499
|
-
search: str |
|
|
500
|
-
if
|
|
501
|
-
|
|
502
|
-
# not validate macros in it
|
|
503
|
-
return []
|
|
490
|
+
search: str | None = info.data.get("search", None)
|
|
491
|
+
if search is None:
|
|
492
|
+
raise ValueError("Search was None - is this file missing the search field?")
|
|
504
493
|
|
|
505
494
|
search_name: Union[str, Any] = info.data.get("name", None)
|
|
506
495
|
message = f"Expected 'search_name' to be a string, instead it was [{type(search_name)}]"
|
|
@@ -614,45 +603,43 @@ class Detection_Abstract(SecurityContentObject):
|
|
|
614
603
|
|
|
615
604
|
@model_validator(mode="after")
|
|
616
605
|
def search_observables_exist_validate(self):
|
|
617
|
-
|
|
606
|
+
observable_fields = [ob.name.lower() for ob in self.tags.observable]
|
|
618
607
|
|
|
619
|
-
|
|
608
|
+
# All $field$ fields from the message must appear in the search
|
|
609
|
+
field_match_regex = r"\$([^\s.]*)\$"
|
|
620
610
|
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
if self.
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
"The following fields are declared as observables, but do not exist in the "
|
|
637
|
-
f"search: {missing_fields}"
|
|
638
|
-
)
|
|
611
|
+
missing_fields: set[str]
|
|
612
|
+
if self.tags.message:
|
|
613
|
+
matches = re.findall(field_match_regex, self.tags.message.lower())
|
|
614
|
+
message_fields = [match.replace("$", "").lower() for match in matches]
|
|
615
|
+
missing_fields = set([field for field in observable_fields if field not in self.search.lower()])
|
|
616
|
+
else:
|
|
617
|
+
message_fields = []
|
|
618
|
+
missing_fields = set()
|
|
619
|
+
|
|
620
|
+
error_messages: list[str] = []
|
|
621
|
+
if len(missing_fields) > 0:
|
|
622
|
+
error_messages.append(
|
|
623
|
+
"The following fields are declared as observables, but do not exist in the "
|
|
624
|
+
f"search: {missing_fields}"
|
|
625
|
+
)
|
|
639
626
|
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
627
|
+
missing_fields = set([field for field in message_fields if field not in self.search.lower()])
|
|
628
|
+
if len(missing_fields) > 0:
|
|
629
|
+
error_messages.append(
|
|
630
|
+
"The following fields are used as fields in the message, but do not exist in "
|
|
631
|
+
f"the search: {missing_fields}"
|
|
632
|
+
)
|
|
646
633
|
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
634
|
+
# NOTE: we ignore the type error around self.status because we are using Pydantic's
|
|
635
|
+
# use_enum_values configuration
|
|
636
|
+
# https://docs.pydantic.dev/latest/api/config/#pydantic.config.ConfigDict.populate_by_name
|
|
637
|
+
if len(error_messages) > 0 and self.status == DetectionStatus.production.value: # type: ignore
|
|
638
|
+
msg = (
|
|
639
|
+
"Use of fields in observables/messages that do not appear in search:\n\t- "
|
|
640
|
+
"\n\t- ".join(error_messages)
|
|
641
|
+
)
|
|
642
|
+
raise ValueError(msg)
|
|
656
643
|
|
|
657
644
|
# Found everything
|
|
658
645
|
return self
|
|
@@ -175,7 +175,6 @@ class validate(Config_Base):
|
|
|
175
175
|
"be avoided for performance reasons.")
|
|
176
176
|
build_app: bool = Field(default=True, description="Should an app be built and output in the build_path?")
|
|
177
177
|
build_api: bool = Field(default=False, description="Should api objects be built and output in the build_path?")
|
|
178
|
-
build_ssa: bool = Field(default=False, description="Should ssa objects be built and output in the build_path?")
|
|
179
178
|
data_source_TA_validation: bool = Field(default=False, description="Validate latest TA information from Splunkbase")
|
|
180
179
|
|
|
181
180
|
def getAtomicRedTeamRepoPath(self, atomic_red_team_repo_name:str = "atomic-red-team"):
|
|
@@ -577,7 +576,6 @@ class test_common(build):
|
|
|
577
576
|
# output to dist. We have already built it!
|
|
578
577
|
self.build_app = False
|
|
579
578
|
self.build_api = False
|
|
580
|
-
self.build_ssa = False
|
|
581
579
|
self.enrichments = False
|
|
582
580
|
|
|
583
581
|
self.enable_integration_testing = True
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from pydantic import BaseModel, field_validator
|
|
2
|
-
from contentctl.objects.constants import SES_OBSERVABLE_TYPE_MAPPING,
|
|
2
|
+
from contentctl.objects.constants import SES_OBSERVABLE_TYPE_MAPPING, RBA_OBSERVABLE_ROLE_MAPPING
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class Observable(BaseModel):
|
|
@@ -26,10 +26,12 @@ class Observable(BaseModel):
|
|
|
26
26
|
def check_roles(cls, v: list[str]):
|
|
27
27
|
if len(v) == 0:
|
|
28
28
|
raise ValueError("Error, at least 1 role must be listed for Observable.")
|
|
29
|
+
if len(v) > 1:
|
|
30
|
+
raise ValueError("Error, each Observable can only have one role.")
|
|
29
31
|
for role in v:
|
|
30
|
-
if role not in
|
|
32
|
+
if role not in RBA_OBSERVABLE_ROLE_MAPPING.keys():
|
|
31
33
|
raise ValueError(
|
|
32
34
|
f"Invalid role '{role}' provided for observable. Valid observable types are "
|
|
33
|
-
f"{
|
|
35
|
+
f"{RBA_OBSERVABLE_ROLE_MAPPING.keys()}"
|
|
34
36
|
)
|
|
35
37
|
return v
|
|
@@ -53,11 +53,11 @@ tags:
|
|
|
53
53
|
- name: parent_process_name
|
|
54
54
|
type: Process
|
|
55
55
|
role:
|
|
56
|
-
-
|
|
56
|
+
- Attacker
|
|
57
57
|
- name: process_name
|
|
58
58
|
type: Process
|
|
59
59
|
role:
|
|
60
|
-
-
|
|
60
|
+
- Attacker
|
|
61
61
|
product:
|
|
62
62
|
- Splunk Enterprise
|
|
63
63
|
- Splunk Enterprise Security
|