How splunk/security_content works
Project Type and Purpose
• This is an open-source, content-as-code repository for Splunk Security Content—analytic stories, detections, macros, lookups, playbooks, baselines, and investigations—designed to be packaged and deployed into Splunk Enterprise Security (ES) as an ESCU app.
• Key indicators: directories like detections/, stories/, macros/, lookups/, playbooks/, baselines/, deployments/, data_sources/, plus contentctl in README for validate/build/test and GitHub/GitLab workflows for CI/CD.
High-Level File Structure Analysis
• Top-level folders group logical Splunk app modules:
• detections/: individual search rules (YAML)
• stories/: grouped use cases/analytic stories
• macros/, lookups/: Splunk search macros and static lookup tables
• playbooks/: Phantom (SOAR) workflows (JSON/YAML/Python)
• baselines/, investigations/: pre-queries and timeline investigations
• data_sources/: metadata about required data inputs
• docs/, notebooks/: specification docs and Jupyter notebooks for ML enrichment
• Configuration/build files: .github/workflows/*, contentctl usage, contentctl.yml, contentctl validate/build/test commands.
Main Components
a. Developer Environment
• Local machine or Gitpod
• Python 3.11 venv running contentctl CLI
• Git operations (clone, new, validate, build, test)
b. Source Code Repository & CI/CD
• GitHub (and GitLab mirror) repo hosting content
• GitHub Actions (build.yml, unit-testing.yml) & GitLab CI
• contentctl invoked in CI to validate and build ESCU .spl package
c. Package & Release
• Build artifacts: ESCU Splunk app package (.spl)
• GitHub Releases & Splunkbase distribution
d. Testing Environments
• Splunk Attack Range / Attack Data / Atomic Red Team feeding simulated logs
• contentctl test framework executing detection tests
e. Splunk Enterprise Security (ES) Instance
• Indexers ingest logs from Data Sources (AWS CloudTrail, Sysmon, Network, etc.)
• Search Head with ESCU app installed
• Splunk ES uses content modules: macros, lookups, detections, stories
• Phantom Engine (SOAR) triggers playbooks on notable events
f. External Services & Integrations
• AWS S3 (reporting badges, images)
• MITRE ATT&CK mapping service (mitremap.splunkresearch.com)
Relationships & Data Flows
1. Developer → GitHub: push changes
2. GitHub Actions → contentctl validate/build/test → produce .spl package
3. CI → GitHub Releases/Splunkbase
4. Splunk Attack Range / Atomic Red Team → simulated log/events → Splunk Indexers
5. Splunk ES Search Head with ESCU app → runs searches (detections, baselines) against indexed data
6. Alerts → trigger Splunk Phantom playbooks (playbooks/*) for automated response
7. Stories module aggregates detection outputs → Security Posture dashboards
Architectural Patterns & Design Principles
• Mono-repo with logical content modules—modularity for maintainability.
• “Content as code” pattern: YAML definitions validated & tested via CI/CD.
• CI/CD pipeline ensures spec compliance (yaml-spec), build reproducibility (contentctl), and quality (unit tests, integration tests).
• Extensibility points: macros/ and lookups/ directories—users can override or augment.
• Data pipeline: content driven by data_sources/ definitions—clear contract with required TA/apps.
Essential Elements to Capture
• Separation between Developer/CI pipeline and Splunk runtime.
• Grouping of content modules inside the packaged Splunk app.
• Data ingestion and detection execution flow.
• Automation loop: detection → notable → playbook.
• External testing and enrichment sources.