# mubashir251-tech/docker-image-security-lab architecture

> Architecture diagram of the GitHub repository mubashir251-tech/docker-image-security-lab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mubashir251-tech/docker-image-security-lab
- Repository: https://github.com/mubashir251-tech/docker-image-security-lab

## Overview

This repository is a hands-on container image security workflow: images are built or selected, scanned, summarized, and checked against configurable vulnerability thresholds. The README documents both a local multi-scanner path and a GitHub Actions path that uses Trivy and the policy gate. The policy gate source confirms its report parsing, threshold validation, severity counting, and exit-code behavior. Other implementation details and call relationships are based on README descriptions, not inspected source excerpts.

Main entry points: [`.github/workflows/security-scan.yml`](https://github.com/mubashir251-tech/docker-image-security-lab/blob/main/.github/workflows/security-scan.yml) (GitHub Actions), [`reports`](https://github.com/mubashir251-tech/docker-image-security-lab/tree/main/reports) (JSON Reports), [`policy_gate.py`](https://github.com/mubashir251-tech/docker-image-security-lab/blob/main/policy_gate.py) (Policy Gate), [`scan_images.sh`](https://github.com/mubashir251-tech/docker-image-security-lab/blob/main/scan_images.sh) (Scan Automation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scan["Image Scanning"]
  node_dockerfile["Image Build"]
  node_image_list["Image List<br/>[images.txt]"]
  node_scanner_scripts["Scan Automation<br/>[scan_images.sh]"]
  node_trivy["Trivy"]
  node_grype["Grype"]
end

subgraph group_reports["Reporting"]
  node_scan_reports["JSON Reports"]
  node_summary_script["Report Summary"]
  node_summary["Markdown Summary<br/>[summary.md]"]
end

subgraph group_policy["Policy Enforcement"]
  node_policy_config["Policy Thresholds<br/>[policy.yaml]"]
  node_policy_gate["Policy Gate<br/>[policy_gate.py]"]
end

subgraph group_automation["Workflow Automation"]
  node_github_actions["GitHub Actions<br/>[security-scan.yml]"]
  node_ci_result["Workflow Verdict"]
end

node_developer(("Developer"))

node_developer -->|"triggers"| node_github_actions
node_developer -->|"builds image"| node_dockerfile
node_image_list -->|"selects images"| node_scanner_scripts
node_scanner_scripts -->|"scans images"| node_trivy
node_scanner_scripts -->|"scans images"| node_grype
node_trivy -->|"writes JSON"| node_scan_reports
node_grype -->|"writes JSON"| node_scan_reports
node_scan_reports -->|"summarizes findings"| node_summary_script
node_summary_script -->|"writes Markdown"| node_summary
node_scan_reports -->|"reads report"| node_policy_gate
node_policy_config -->|"sets thresholds"| node_policy_gate
node_policy_gate -->|"returns verdict"| node_ci_result
node_github_actions -->|"builds image"| node_dockerfile
node_github_actions -->|"runs scan"| node_trivy
node_github_actions -->|"uploads artifact"| node_scan_reports
node_github_actions -->|"enforces policy"| node_policy_gate

click node_dockerfile "https://github.com/mubashir251-tech/docker-image-security-lab/blob/main/Dockerfile"
click node_image_list "https://github.com/mubashir251-tech/docker-image-security-lab/blob/main/images.txt"
click node_scanner_scripts "https://github.com/mubashir251-tech/docker-image-security-lab/blob/main/scan_images.sh"
click node_scan_reports "https://github.com/mubashir251-tech/docker-image-security-lab/tree/main/reports"
click node_summary_script "https://github.com/mubashir251-tech/docker-image-security-lab/blob/main/summarize_reports.sh"
click node_summary "https://github.com/mubashir251-tech/docker-image-security-lab/blob/main/reports/summary.md"
click node_policy_config "https://github.com/mubashir251-tech/docker-image-security-lab/blob/main/policy.yaml"
click node_policy_gate "https://github.com/mubashir251-tech/docker-image-security-lab/blob/main/policy_gate.py"
click node_github_actions "https://github.com/mubashir251-tech/docker-image-security-lab/blob/main/.github/workflows/security-scan.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dockerfile,node_image_list,node_scanner_scripts,node_trivy,node_grype toneBlue
class node_scan_reports,node_summary_script,node_summary toneAmber
class node_policy_config,node_policy_gate toneMint
class node_github_actions,node_ci_result toneRose
class node_developer toneIndigo
```

## Components

### Image Scanning

- [Image Build](https://github.com/mubashir251-tech/docker-image-security-lab/blob/main/Dockerfile): `Dockerfile`
- [Image List](https://github.com/mubashir251-tech/docker-image-security-lab/blob/main/images.txt): `images.txt`
- [Scan Automation](https://github.com/mubashir251-tech/docker-image-security-lab/blob/main/scan_images.sh): `scan_images.sh`
- **Trivy**
- **Grype**

### Reporting

- [JSON Reports](https://github.com/mubashir251-tech/docker-image-security-lab/tree/main/reports): `reports`
- [Report Summary](https://github.com/mubashir251-tech/docker-image-security-lab/blob/main/summarize_reports.sh): `summarize_reports.sh`
- [Markdown Summary](https://github.com/mubashir251-tech/docker-image-security-lab/blob/main/reports/summary.md): `reports/summary.md`

### Policy Enforcement

- [Policy Thresholds](https://github.com/mubashir251-tech/docker-image-security-lab/blob/main/policy.yaml): `policy.yaml`
- [Policy Gate](https://github.com/mubashir251-tech/docker-image-security-lab/blob/main/policy_gate.py): `policy_gate.py`

### Workflow Automation

- [GitHub Actions](https://github.com/mubashir251-tech/docker-image-security-lab/blob/main/.github/workflows/security-scan.yml): `.github/workflows/security-scan.yml`
- **Workflow Verdict**

### Other components

- **Developer**

## Connections

- Developer → GitHub Actions: triggers (evidence: `README.md`)
- Developer → Image Build: builds image (evidence: `README.md`)
- Image List → Scan Automation: selects images (evidence: `README.md`)
- Scan Automation → Trivy: scans images (evidence: `README.md`)
- Scan Automation → Grype: scans images (evidence: `README.md`)
- Trivy → JSON Reports: writes JSON (evidence: `README.md`)
- Grype → JSON Reports: writes JSON (evidence: `README.md`)
- JSON Reports → Report Summary: summarizes findings (evidence: `README.md`)
- Report Summary → Markdown Summary: writes Markdown (evidence: `README.md`)
- JSON Reports → Policy Gate: reads report (evidence: `README.md`)
- Policy Thresholds → Policy Gate: sets thresholds (evidence: `README.md`)
- Policy Gate → Workflow Verdict: returns verdict (evidence: `README.md`)
- GitHub Actions → Image Build: builds image (evidence: `README.md`)
- GitHub Actions → Trivy: runs scan (evidence: `README.md`)
- GitHub Actions → JSON Reports: uploads artifact (evidence: `README.md`)
- GitHub Actions → Policy Gate: enforces policy (evidence: `README.md`)
