# melmorabity/trivy-plugin-epss architecture

> Architecture diagram of the GitHub repository melmorabity/trivy-plugin-epss, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/melmorabity/trivy-plugin-epss
- Repository: https://github.com/melmorabity/trivy-plugin-epss

## Overview

This small Python Trivy plugin accepts scan JSON on stdin, refreshes a local EPSS cache when missing or older than 24 hours, parses the EPSS CSV, adds matching scores and metadata to vulnerabilities, and emits JSON to stdout or a file. The README documents Trivy plugin invocation, configurable data URL and cache directory, and JSON-only input. The graph reflects the sampled epss.py behavior and README; internal details outside the excerpts are not inferred.

Main entry points: [`epss.py`](https://github.com/melmorabity/trivy-plugin-epss/blob/main/epss.py) (CLI entry point)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Plugin runtime"]
  node_cli["CLI entry point<br/>[epss.py]"]
  node_scan_input["Scan JSON input<br/>[epss.py]"]
  node_enrichment["Vulnerability enrichment<br/>[epss.py]"]
  node_scan_output["Updated JSON output<br/>[epss.py]"]
end

subgraph group_epss_data["EPSS data"]
  node_cache_refresh["Cache refresh<br/>[epss.py]"]
  node_csv_parse["EPSS CSV parser<br/>[epss.py]"]
  node_local_cache[("EPSS CSV cache")]
end

node_trivy(("Trivy / caller"))
node_download["EPSS dataset service"]

node_trivy -->|"invokes plugin"| node_cli
node_cli -->|"reads stdin"| node_scan_input
node_cli -->|"refreshes cache"| node_cache_refresh
node_cache_refresh -->|"downloads gzip"| node_download
node_cache_refresh -->|"writes CSV"| node_local_cache
node_cli -->|"loads cache"| node_csv_parse
node_local_cache -->|"reads CSV"| node_csv_parse
node_cli -->|"passes EPSS data"| node_enrichment
node_scan_input -->|"provides scan JSON"| node_enrichment
node_enrichment -->|"writes enriched JSON"| node_scan_output
node_cli -->|"selects output"| node_scan_output

click node_cli "https://github.com/melmorabity/trivy-plugin-epss/blob/main/epss.py"
click node_scan_input "https://github.com/melmorabity/trivy-plugin-epss/blob/main/epss.py"
click node_enrichment "https://github.com/melmorabity/trivy-plugin-epss/blob/main/epss.py"
click node_scan_output "https://github.com/melmorabity/trivy-plugin-epss/blob/main/epss.py"
click node_cache_refresh "https://github.com/melmorabity/trivy-plugin-epss/blob/main/epss.py"
click node_csv_parse "https://github.com/melmorabity/trivy-plugin-epss/blob/main/epss.py"

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_cli,node_scan_input,node_enrichment,node_scan_output toneBlue
class node_cache_refresh,node_csv_parse,node_local_cache toneAmber
class node_trivy,node_download toneIndigo
```

## Components

### Plugin runtime

- [CLI entry point](https://github.com/melmorabity/trivy-plugin-epss/blob/main/epss.py): `epss.py`
- [Scan JSON input](https://github.com/melmorabity/trivy-plugin-epss/blob/main/epss.py): `epss.py`
- [Vulnerability enrichment](https://github.com/melmorabity/trivy-plugin-epss/blob/main/epss.py): `epss.py`
- [Updated JSON output](https://github.com/melmorabity/trivy-plugin-epss/blob/main/epss.py): `epss.py`

### EPSS data

- [Cache refresh](https://github.com/melmorabity/trivy-plugin-epss/blob/main/epss.py): `epss.py`
- [EPSS CSV parser](https://github.com/melmorabity/trivy-plugin-epss/blob/main/epss.py): `epss.py`
- **EPSS CSV cache**

### Other components

- **Trivy / caller**
- **EPSS dataset service**

## Connections

- Trivy / caller → CLI entry point: invokes plugin (evidence: `README.md`)
- CLI entry point → Scan JSON input: reads stdin (evidence: `epss.py`)
- CLI entry point → Cache refresh: refreshes cache (evidence: `epss.py`)
- Cache refresh → EPSS dataset service: downloads gzip (evidence: `epss.py`)
- Cache refresh → EPSS CSV cache: writes CSV (evidence: `epss.py`)
- CLI entry point → EPSS CSV parser: loads cache (evidence: `tests.py`)
- EPSS CSV cache → EPSS CSV parser: reads CSV (evidence: `epss.py`)
- CLI entry point → Vulnerability enrichment: passes EPSS data (evidence: `tests.py`)
- Scan JSON input → Vulnerability enrichment: provides scan JSON (evidence: `epss.py`)
- Vulnerability enrichment → Updated JSON output: writes enriched JSON (evidence: `epss.py`)
- CLI entry point → Updated JSON output: selects output (evidence: `tests.py`)
