# devops-accelerators/devsecops-template architecture

> Architecture diagram of the GitHub repository devops-accelerators/devsecops-template, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/devops-accelerators/devsecops-template
- Repository: https://github.com/devops-accelerators/devsecops-template

## Overview

##### Main Components
- Jenkins Pipeline Controller – At the center is the parameterized Jenkinsfile which orchestrates the different stages:
- Stage 1: Checkout of source code.
- Stage 2: Pre-build setup (spinning up security tools via containers).
- Stage 3: Check-secrets (e.g., using Trufflehog).
- Stage 4: Source Composition Analysis (using tools like Snyk).
- Stage 5: SAST (analysis from Sonarqube/Sonarqube’s configurations).
- Stage 6: Container Image Scan (using Anchore-Engine configured with docker-compose).
- Stage 7: DAST (possibly using Archerysec-ZeD with automated scan scripts like zapscan.sh).
- Stage 8: Inspec (using the hardening-test profile to evaluate infrastructure security).

- Security Tools Containers – Each folder in the file tree corresponds to a tool:
- Anchore-Engine: Contains configuration and a docker-compose.yaml to run vulnerability scans on container images.
- Archerysec-ZeD: Provides scripts (archery_script.py and zapscan.sh) and docker-compose.yml to perform dynamic testing.
- Inspec: Contains a complete inspection and hardening test profile, indicating infrastructure compliance tests.
- Snyk, Sonarqube, and Trufflehog: Each has its README and configuration, representing additional scanning functionalities.

- Source Code Repository and External Artifacts:
- The project accepts parameters such as application repository URL, docker image name/tag, and server URL. This emphasizes the integration with external code repositories and running environments.

##### Out Relationships and Data Flow
- “Pre-build Setup” as the step where Jenkins uses Docker Compose to spin up the tool containers (Anchore, Archerysec, etc.).
- Each security stage should be depicted as its own sub-component or container:
- Check-Secrets stage (e.g., Trufflehog) inspects the repository.
- SCA stage (Snyk) analyzes third-party dependencies.
- SAST stage (Sonarqube) performs static code analysis.
- Container Image Scan stage (Anchore-Engine) inspects container images.
- DAST stage (Archerysec-ZeD) tests the running application.
- Inspec stage tests infrastructure hardening.

##### Architectural Patterns and Technologies
- Microservice-like Containerization: Each security tool runs in its own container, orchestrated using Docker Compose.
- Pipeline as Code: The parameterized Jenkinsfile defines stages that are modular and independently invoked.
- Integration Points: Highlight how each tool plugs into the overall pipeline.
- Technologies Involved: Docker, Jenkins, and possibly language-specific tools for Java/Node depending on the application under test.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "External Inputs"
        SRC("Source Code Repository"):::external
        PARAM("Deployment Parameters"):::external
    end
    
    subgraph "CI/CD Orchestration"
        JENKINS("Jenkins Pipeline Controller"):::jenkins
        ST1("Stage: Checkout Code"):::stage
        ST2("Stage: Pre-build Setup"):::stage
    end
    
    subgraph "Security Scanning Stages"
        TFG("Trufflehog Secret Checker"):::tool
        SNYK("Snyk Analyzer (SCA)"):::tool
        SONAR("Sonarqube (SAST)"):::tool
    end

    subgraph "Containerized Scanning"
        subgraph "Anchore-Engine"
            ANCHOR1["Container (docker-compose)"]:::tool
            ANCHOR2["Configuration (config folder)"]:::tool
        end
        subgraph "Archerysec-ZeD"
            ARCH1["Container (docker-compose)"]:::tool
            ARCH2["DAST Script (archery_script.py)"]:::tool
            ARCH3["Scan Script (zapscan.sh)"]:::tool
        end
        INSPEC("Inspec Hardening-Test"):::tool
    end

    SRC --> JENKINS
    PARAM --> JENKINS
    JENKINS --> ST1
    ST1 --> ST2
    ST2 --> TFG
    ST2 --> SNYK
    ST2 --> SONAR
    ST2 --> ANCHOR1
    ST2 --> ARCH1
    ST2 --> INSPEC

    ANCHOR1 --> ANCHOR2
    ARCH1 --> ARCH2
    ARCH2 --> ARCH3

    click JENKINS "https://github.com/devops-accelerators/devsecops-template/tree/master/Jenkinsfile"
    click ANCHOR1 "https://github.com/devops-accelerators/devsecops-template/blob/master/Anchore-Engine/docker-compose.yaml"
    click ANCHOR2 "https://github.com/devops-accelerators/devsecops-template/tree/master/Anchore-Engine/config/"
    click ARCH1 "https://github.com/devops-accelerators/devsecops-template/blob/master/Archerysec-ZeD/docker-compose.yml"
    click ARCH2 "https://github.com/devops-accelerators/devsecops-template/blob/master/Archerysec-ZeD/archery_script.py"
    click ARCH3 "https://github.com/devops-accelerators/devsecops-template/blob/master/Archerysec-ZeD/zapscan.sh"
    click INSPEC "https://github.com/devops-accelerators/devsecops-template/tree/master/Inspec/hardening-test/"
    click SNYK "https://github.com/devops-accelerators/devsecops-template/blob/master/Snyk/README.md"
    click SONAR "https://github.com/devops-accelerators/devsecops-template/blob/master/Sonarqube/sonar.yml"
    click TFG "https://github.com/devops-accelerators/devsecops-template/blob/master/Trufflehog/README.md"

    classDef external fill:#FCE94F,stroke:#333,stroke-width:2px;
    classDef jenkins fill:#729FCF,stroke:#333,stroke-width:2px;
    classDef stage fill:#AD7FA8,stroke:#333,stroke-width:2px;
    classDef tool fill:#8AE234,stroke:#333,stroke-width:2px;
```
