# mathivadhanis505/cve_test architecture

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

- Interactive diagram: https://gitdiagram.com/mathivadhanis505/cve_test
- Repository: https://github.com/mathivadhanis505/cve_test

## Overview

CVE-Patcher automates dependency vulnerability remediation: a scan records findings, the patcher selects unpatched findings, updates dependencies on dedicated branches, and opens pull requests for maintainer review. PostgreSQL stores scan and patch history; Slack provides a separate digest capability. The README documents scheduled/manual Actions and repository selection, but the supplied excerpts do not show the workflow wiring or the Lambda handler’s behavior, so those connections are documented rather than inferred from source.

Main entry points: [`db/crud.py`](https://github.com/mathivadhanis505/cve_test/blob/main/db/crud.py) (Database operations), [`scanner/trivy_runner.py`](https://github.com/mathivadhanis505/cve_test/blob/main/scanner/trivy_runner.py) (Trivy scanner), [`patcher/main.py`](https://github.com/mathivadhanis505/cve_test/blob/main/patcher/main.py) (Patch orchestrator), [`patcher/branch_creator.py`](https://github.com/mathivadhanis505/cve_test/blob/main/patcher/branch_creator.py) (Branch creator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scan["Vulnerability scanning"]
  node_repo_config["Repository configuration<br/>[repos.yml]"]
  node_scanner["Trivy scanner<br/>[trivy_runner.py]"]
  node_classifier["CVE classifier<br/>[cve_classifier.py]"]
  node_thresholds["Severity thresholds<br/>[thresholds.yml]"]
  node_ecosystem["Manifest parsers<br/>[ecosystem.py]"]
end

subgraph group_remediation["Patch remediation"]
  node_patcher["Patch orchestrator<br/>[main.py]"]
  node_bumper["Version bumper<br/>[version_bumper.py]"]
  node_branch["Branch creator<br/>[branch_creator.py]"]
  node_pr_manager["Pull request manager<br/>[pr_manager.py]"]
end

subgraph group_records["Scan and patch records"]
  node_crud["Database operations<br/>[crud.py]"]
  node_models["Run and patch models<br/>[models.py]"]
  node_session["Database sessions<br/>[session.py]"]
  node_postgres[("PostgreSQL")]
end

subgraph group_notifications["Notifications"]
  node_slack_digest["Slack digest<br/>[slack_digest.py]"]
end

node_actions(("GitHub Actions"))
node_target_repo["Target repository"]
node_github["GitHub"]
node_slack["Slack webhook"]
node_maintainer(("Maintainer"))

node_actions -.->|"selects repositories"| node_repo_config
node_actions -.->|"starts scans"| node_scanner
node_repo_config -.->|"configures targets"| node_scanner
node_scanner -->|"scans filesystem"| node_target_repo
node_scanner -->|"records findings"| node_crud
node_scanner -.->|"classifies findings"| node_classifier
node_classifier -->|"loads rules"| node_thresholds
node_patcher -->|"loads findings"| node_crud
node_patcher -->|"creates patch branch"| node_branch
node_branch -->|"updates dependency"| node_bumper
node_branch -->|"clones and pushes"| node_target_repo
node_branch -->|"checks branch"| node_github
node_patcher -->|"opens pull request"| node_pr_manager
node_pr_manager -->|"creates pull request"| node_github
node_patcher -->|"stores patch history"| node_crud
node_crud -->|"queries records"| node_models
node_crud -->|"uses sessions"| node_session
node_session -->|"connects"| node_postgres
node_slack_digest -->|"reads run statistics"| node_crud
node_slack_digest -->|"reads latest run"| node_models
node_slack_digest -->|"posts digest"| node_slack
node_github -.->|"presents pull request"| node_maintainer

click node_repo_config "https://github.com/mathivadhanis505/cve_test/blob/main/config/repos.yml"
click node_scanner "https://github.com/mathivadhanis505/cve_test/blob/main/scanner/trivy_runner.py"
click node_classifier "https://github.com/mathivadhanis505/cve_test/blob/main/scanner/cve_classifier.py"
click node_thresholds "https://github.com/mathivadhanis505/cve_test/blob/main/config/thresholds.yml"
click node_ecosystem "https://github.com/mathivadhanis505/cve_test/blob/main/scanner/ecosystem.py"
click node_patcher "https://github.com/mathivadhanis505/cve_test/blob/main/patcher/main.py"
click node_bumper "https://github.com/mathivadhanis505/cve_test/blob/main/patcher/version_bumper.py"
click node_branch "https://github.com/mathivadhanis505/cve_test/blob/main/patcher/branch_creator.py"
click node_pr_manager "https://github.com/mathivadhanis505/cve_test/blob/main/patcher/pr_manager.py"
click node_crud "https://github.com/mathivadhanis505/cve_test/blob/main/db/crud.py"
click node_models "https://github.com/mathivadhanis505/cve_test/blob/main/db/models.py"
click node_session "https://github.com/mathivadhanis505/cve_test/blob/main/db/session.py"
click node_slack_digest "https://github.com/mathivadhanis505/cve_test/blob/main/notify/slack_digest.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_repo_config,node_scanner,node_classifier,node_thresholds,node_ecosystem toneBlue
class node_patcher,node_bumper,node_branch,node_pr_manager toneAmber
class node_crud,node_models,node_session,node_postgres,node_slack toneMint
class node_slack_digest toneRose
class node_actions,node_target_repo,node_github,node_maintainer toneIndigo
```

## Components

### Vulnerability scanning

- [Repository configuration](https://github.com/mathivadhanis505/cve_test/blob/main/config/repos.yml): `config/repos.yml`
- [Trivy scanner](https://github.com/mathivadhanis505/cve_test/blob/main/scanner/trivy_runner.py): `scanner/trivy_runner.py`
- [CVE classifier](https://github.com/mathivadhanis505/cve_test/blob/main/scanner/cve_classifier.py): `scanner/cve_classifier.py`
- [Severity thresholds](https://github.com/mathivadhanis505/cve_test/blob/main/config/thresholds.yml): `config/thresholds.yml`
- [Manifest parsers](https://github.com/mathivadhanis505/cve_test/blob/main/scanner/ecosystem.py): `scanner/ecosystem.py`

### Patch remediation

- [Patch orchestrator](https://github.com/mathivadhanis505/cve_test/blob/main/patcher/main.py): `patcher/main.py`
- [Version bumper](https://github.com/mathivadhanis505/cve_test/blob/main/patcher/version_bumper.py): `patcher/version_bumper.py`
- [Branch creator](https://github.com/mathivadhanis505/cve_test/blob/main/patcher/branch_creator.py): `patcher/branch_creator.py`
- [Pull request manager](https://github.com/mathivadhanis505/cve_test/blob/main/patcher/pr_manager.py): `patcher/pr_manager.py`

### Scan and patch records

- [Database operations](https://github.com/mathivadhanis505/cve_test/blob/main/db/crud.py): `db/crud.py`
- [Run and patch models](https://github.com/mathivadhanis505/cve_test/blob/main/db/models.py): `db/models.py`
- [Database sessions](https://github.com/mathivadhanis505/cve_test/blob/main/db/session.py): `db/session.py`
- **PostgreSQL**

### Notifications

- [Slack digest](https://github.com/mathivadhanis505/cve_test/blob/main/notify/slack_digest.py): `notify/slack_digest.py`

### Other components

- **GitHub Actions**
- **Target repository**
- **GitHub**
- **Slack webhook**
- **Maintainer**

## Connections

- GitHub Actions → Repository configuration: selects repositories (evidence: `README.md`)
- GitHub Actions → Trivy scanner: starts scans (evidence: `README.md`)
- Repository configuration → Trivy scanner: configures targets (evidence: `README.md`)
- Trivy scanner → Target repository: scans filesystem (evidence: `scanner/trivy_runner.py`)
- Trivy scanner → Database operations: records findings (evidence: `scanner/trivy_runner.py`)
- Trivy scanner → CVE classifier: classifies findings (evidence: `scanner/cve_classifier.py`)
- CVE classifier → Severity thresholds: loads rules (evidence: `scanner/cve_classifier.py`)
- Patch orchestrator → Database operations: loads findings (evidence: `patcher/main.py`)
- Patch orchestrator → Branch creator: creates patch branch (evidence: `patcher/main.py`)
- Branch creator → Version bumper: updates dependency (evidence: `patcher/branch_creator.py`)
- Branch creator → Target repository: clones and pushes (evidence: `patcher/branch_creator.py`)
- Branch creator → GitHub: checks branch (evidence: `patcher/branch_creator.py`)
- Patch orchestrator → Pull request manager: opens pull request (evidence: `patcher/main.py`)
- Pull request manager → GitHub: creates pull request (evidence: `patcher/pr_manager.py`)
- Patch orchestrator → Database operations: stores patch history (evidence: `patcher/main.py`)
- Database operations → Run and patch models: queries records (evidence: `db/crud.py`)
- Database operations → Database sessions: uses sessions (evidence: `db/crud.py`)
- Database sessions → PostgreSQL: connects (evidence: `db/session.py`)
- Slack digest → Database operations: reads run statistics (evidence: `notify/slack_digest.py`)
- Slack digest → Run and patch models: reads latest run (evidence: `notify/slack_digest.py`)
- Slack digest → Slack webhook: posts digest (evidence: `notify/slack_digest.py`)
- GitHub → Maintainer: presents pull request (evidence: `README.md`)
