# vishnu17306/semantic-code-vuln-spotting architecture

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

- Interactive diagram: https://gitdiagram.com/vishnu17306/semantic-code-vuln-spotting
- Repository: https://github.com/vishnu17306/semantic-code-vuln-spotting

## Overview

The product is a Python codebase triage CLI. Its main workflow extracts inline comments and Git commit messages, classifies those notes, scans Python files for vulnerabilities, links nearby comment and scanner findings, then filters and sorts a text or JSON report. The scanner supports SQL injection, command injection, hardcoded-secret, and path-traversal checks, plus SARIF output when used independently. The graph follows the documented and excerpted runtime calls; detector implementations share scanner.py. Other listed files mainly support evaluation or labeling rather than the runtime product.

Main entry points: [`scanner.py`](https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/scanner.py) (Vulnerability scanner), [`triage.py`](https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/triage.py) (Triage CLI), [`commit_extractor.py`](https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/commit_extractor.py) (Commit extraction), [`comment_extractor.py`](https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/comment_extractor.py) (Comment extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Evidence collection"]
  node_filewalk["Python file walk<br/>[triage.py]"]
  node_comments["Comment extraction"]
  node_commits["Commit extraction"]
end

subgraph group_analysis["Analysis"]
  node_classifier["Severity classifier"]
  node_scanner["Vulnerability scanner<br/>[scanner.py]"]
  node_sqli["SQL injection check<br/>[scanner.py]"]
  node_cmdi["Command injection check<br/>[scanner.py]"]
  node_secrets["Secret check<br/>[scanner.py]"]
  node_traversal["Path traversal check<br/>[scanner.py]"]
end

subgraph group_results["Triage output"]
  node_triage["Triage CLI<br/>[triage.py]"]
  node_linksort["Link and sort<br/>[triage.py]"]
  node_report["Text or JSON report<br/>[triage.py]"]
end

node_user(("Developer"))
node_git["Git history"]

node_user -->|"runs"| node_triage
node_triage -->|"scans files"| node_filewalk
node_filewalk -->|"extracts comments"| node_comments
node_filewalk -->|"scans files"| node_scanner
node_triage -->|"reads history"| node_commits
node_commits -->|"runs git log"| node_git
node_triage -->|"classifies records"| node_classifier
node_scanner -->|"dispatches checks"| node_sqli
node_scanner -->|"dispatches checks"| node_cmdi
node_scanner -->|"dispatches checks"| node_secrets
node_scanner -->|"dispatches checks"| node_traversal
node_triage -->|"links and sorts"| node_linksort
node_linksort -->|"formats output"| node_report

click node_triage "https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/triage.py"
click node_filewalk "https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/triage.py"
click node_comments "https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/comment_extractor.py"
click node_commits "https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/commit_extractor.py"
click node_classifier "https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/severity_classifier.py"
click node_scanner "https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/scanner.py"
click node_sqli "https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/scanner.py"
click node_cmdi "https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/scanner.py"
click node_secrets "https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/scanner.py"
click node_traversal "https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/scanner.py"
click node_linksort "https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/triage.py"
click node_report "https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/triage.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_filewalk,node_comments,node_commits toneBlue
class node_classifier,node_scanner,node_sqli,node_cmdi,node_secrets,node_traversal toneAmber
class node_triage,node_linksort,node_report toneMint
class node_user,node_git toneIndigo
```

## Components

### Evidence collection

- [Python file walk](https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/triage.py): `triage.py`
- [Comment extraction](https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/comment_extractor.py): `comment_extractor.py`
- [Commit extraction](https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/commit_extractor.py): `commit_extractor.py`

### Analysis

- [Severity classifier](https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/severity_classifier.py): `severity_classifier.py`
- [Vulnerability scanner](https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/scanner.py): `scanner.py`
- [SQL injection check](https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/scanner.py): `scanner.py`
- [Command injection check](https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/scanner.py): `scanner.py`
- [Secret check](https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/scanner.py): `scanner.py`
- [Path traversal check](https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/scanner.py): `scanner.py`

### Triage output

- [Triage CLI](https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/triage.py): `triage.py`
- [Link and sort](https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/triage.py): `triage.py`
- [Text or JSON report](https://github.com/vishnu17306/semantic-code-vuln-spotting/blob/main/triage.py): `triage.py`

### Other components

- **Developer**
- **Git history**

## Connections

- Developer → Triage CLI: runs (evidence: `README.md`)
- Triage CLI → Python file walk: scans files (evidence: `triage.py`)
- Python file walk → Comment extraction: extracts comments (evidence: `triage.py`)
- Python file walk → Vulnerability scanner: scans files (evidence: `triage.py`)
- Triage CLI → Commit extraction: reads history (evidence: `triage.py`)
- Commit extraction → Git history: runs git log (evidence: `commit_extractor.py`)
- Triage CLI → Severity classifier: classifies records (evidence: `triage.py`)
- Vulnerability scanner → SQL injection check: dispatches checks (evidence: `scanner.py`)
- Vulnerability scanner → Command injection check: dispatches checks (evidence: `scanner.py`)
- Vulnerability scanner → Secret check: dispatches checks (evidence: `scanner.py`)
- Vulnerability scanner → Path traversal check: dispatches checks (evidence: `scanner.py`)
- Triage CLI → Link and sort: links and sorts (evidence: `triage.py`)
- Link and sort → Text or JSON report: formats output (evidence: `triage.py`)
