# vinayediga/k8_security_analyzer_private architecture

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

- Interactive diagram: https://gitdiagram.com/vinayediga/k8_security_analyzer_private
- Repository: https://github.com/vinayediga/k8_security_analyzer_private

## Overview

This is a Kubernetes attack-path visualizer and analyzer. Its main workflow is to extract Kubernetes resources and risky relationships into a graph, expose graph snapshots and analyses through an authenticated backend, then let users explore findings, paths, risk, mitigations, and clusters in the frontend. The graph engine also supports a CLI. Some backend and extractor internals are unsampled, so their finer-grained control flow is not shown; optional or undocumented connections are omitted.

Main entry points: [`frontend/src/App.jsx`](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/App.jsx) (Application Shell), [`backend/api.py`](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/backend/api.py) (HTTP API), [`frontend/src/context/GraphContext.jsx`](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/context/GraphContext.jsx) (Graph State), [`frontend/src/components/PathsPane.jsx`](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/components/PathsPane.jsx) (Attack Paths)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Cluster Collection"]
  node_extractor["Graph Extractor<br/>[extract_graph.py]"]
  node_agent["Cluster Agent<br/>[agent.py]"]
end

subgraph group_service["Backend Services"]
  node_backend["HTTP API<br/>[api.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_repositories["Data Repositories<br/>[repositories.py]"]
  node_database["Database Connection<br/>[database.py]"]
end

subgraph group_analysis["Graph Analysis"]
  node_engine["Graph Engine<br/>[graph_engine.py]"]
  node_cli["Analysis CLI<br/>[main.py]"]
  node_report["Analysis Reports<br/>[report.py]"]
end

subgraph group_frontend["Web Application"]
  node_app["Application Shell<br/>[App.jsx]"]
  node_graphstate["Graph State<br/>[GraphContext.jsx]"]
  node_apiclient["API Client<br/>[api.js]"]
  node_graphutils["Graph Normalization<br/>[graph.js]"]
  node_overview["Overview<br/>[OverviewPane.jsx]"]
  node_graphview["Graph Explorer<br/>[GraphPane.jsx]"]
  node_findings["Findings<br/>[FindingsPane.jsx]"]
  node_paths["Attack Paths<br/>[PathsPane.jsx]"]
  node_risk["Risk Analysis<br/>[RiskPane.jsx]"]
  node_mitigation["Mitigations<br/>[MitigationPane.jsx]"]
  node_clusters["Cluster Management<br/>[ClustersPane.jsx]"]
  node_localanalysis["Browser Analysis<br/>[analysis.js]"]
end

node_operator(("Cluster Operator"))
node_kubernetes["Kubernetes Cluster"]
node_webuser(("Web User"))
node_mongo[("MongoDB")]

node_operator -.->|"runs scan"| node_extractor
node_extractor -->|"reads resources"| node_kubernetes
node_agent -->|"uses extractor"| node_extractor
node_webuser -.->|"uses"| node_app
node_app -->|"provides state"| node_graphstate
node_app -->|"renders"| node_overview
node_app -->|"renders"| node_graphview
node_app -->|"renders"| node_findings
node_app -->|"renders"| node_paths
node_app -->|"renders"| node_risk
node_app -->|"renders"| node_mitigation
node_app -->|"renders"| node_clusters
node_graphstate -->|"normalizes graph"| node_graphutils
node_graphstate -->|"loads snapshots"| node_apiclient
node_paths -->|"requests analyses"| node_apiclient
node_paths -->|"runs local analysis"| node_localanalysis
node_apiclient -->|"sends requests"| node_backend
node_backend -->|"authenticates users"| node_auth
node_backend -->|"uses repositories"| node_repositories
node_backend -->|"accesses database"| node_database
node_database -->|"connects"| node_mongo
node_repositories -->|"gets database"| node_database
node_backend -->|"analyzes snapshots"| node_engine
node_cli -->|"runs analyses"| node_engine
node_report -->|"uses graph engine"| node_engine

click node_extractor "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/worker/extract_graph.py"
click node_agent "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/worker/agent.py"
click node_app "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/App.jsx"
click node_graphstate "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/context/GraphContext.jsx"
click node_apiclient "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/lib/api.js"
click node_graphutils "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/lib/graph.js"
click node_overview "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/components/OverviewPane.jsx"
click node_graphview "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/components/GraphPane.jsx"
click node_findings "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/components/FindingsPane.jsx"
click node_paths "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/components/PathsPane.jsx"
click node_risk "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/components/RiskPane.jsx"
click node_mitigation "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/components/MitigationPane.jsx"
click node_clusters "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/components/ClustersPane.jsx"
click node_backend "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/backend/api.py"
click node_auth "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/backend/auth.py"
click node_repositories "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/backend/repositories.py"
click node_database "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/backend/database.py"
click node_engine "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/analysis/graph_engine.py"
click node_cli "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/analysis/main.py"
click node_report "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/analysis/report.py"
click node_localanalysis "https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/lib/analysis.js"

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_extractor,node_agent,node_webuser toneBlue
class node_backend,node_auth,node_repositories,node_database,node_mongo toneAmber
class node_engine,node_cli,node_report toneMint
class node_app,node_graphstate,node_apiclient,node_graphutils,node_overview,node_graphview,node_findings,node_paths,node_risk,node_mitigation,node_clusters,node_localanalysis toneRose
class node_operator,node_kubernetes toneIndigo
```

## Components

### Cluster Collection

- [Graph Extractor](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/worker/extract_graph.py): `worker/extract_graph.py`
- [Cluster Agent](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/worker/agent.py): `worker/agent.py`

### Backend Services

- [HTTP API](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/backend/api.py): `backend/api.py`
- [Authentication](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/backend/auth.py): `backend/auth.py`
- [Data Repositories](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/backend/repositories.py): `backend/repositories.py`
- [Database Connection](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/backend/database.py): `backend/database.py`

### Graph Analysis

- [Graph Engine](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/analysis/graph_engine.py): `analysis/graph_engine.py`
- [Analysis CLI](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/analysis/main.py): `analysis/main.py`
- [Analysis Reports](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/analysis/report.py): `analysis/report.py`

### Web Application

- [Application Shell](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Graph State](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/context/GraphContext.jsx): `frontend/src/context/GraphContext.jsx`
- [API Client](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/lib/api.js): `frontend/src/lib/api.js`
- [Graph Normalization](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/lib/graph.js): `frontend/src/lib/graph.js`
- [Overview](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/components/OverviewPane.jsx): `frontend/src/components/OverviewPane.jsx`
- [Graph Explorer](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/components/GraphPane.jsx): `frontend/src/components/GraphPane.jsx`
- [Findings](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/components/FindingsPane.jsx): `frontend/src/components/FindingsPane.jsx`
- [Attack Paths](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/components/PathsPane.jsx): `frontend/src/components/PathsPane.jsx`
- [Risk Analysis](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/components/RiskPane.jsx): `frontend/src/components/RiskPane.jsx`
- [Mitigations](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/components/MitigationPane.jsx): `frontend/src/components/MitigationPane.jsx`
- [Cluster Management](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/components/ClustersPane.jsx): `frontend/src/components/ClustersPane.jsx`
- [Browser Analysis](https://github.com/vinayediga/k8_security_analyzer_private/blob/main/frontend/src/lib/analysis.js): `frontend/src/lib/analysis.js`

### Other components

- **Cluster Operator**
- **Kubernetes Cluster**
- **Web User**
- **MongoDB**

## Connections

- Cluster Operator → Graph Extractor: runs scan
- Graph Extractor → Kubernetes Cluster: reads resources (evidence: `worker/extract_graph.py`)
- Cluster Agent → Graph Extractor: uses extractor (evidence: `worker/agent.py`)
- Web User → Application Shell: uses
- Application Shell → Graph State: provides state (evidence: `frontend/src/App.jsx`)
- Application Shell → Overview: renders (evidence: `frontend/src/App.jsx`)
- Application Shell → Graph Explorer: renders (evidence: `frontend/src/App.jsx`)
- Application Shell → Findings: renders (evidence: `frontend/src/App.jsx`)
- Application Shell → Attack Paths: renders (evidence: `frontend/src/App.jsx`)
- Application Shell → Risk Analysis: renders (evidence: `frontend/src/App.jsx`)
- Application Shell → Mitigations: renders (evidence: `frontend/src/App.jsx`)
- Application Shell → Cluster Management: renders (evidence: `frontend/src/App.jsx`)
- Graph State → Graph Normalization: normalizes graph (evidence: `frontend/src/context/GraphContext.jsx`)
- Graph State → API Client: loads snapshots (evidence: `frontend/src/context/GraphContext.jsx`)
- Attack Paths → API Client: requests analyses (evidence: `frontend/src/components/PathsPane.jsx`)
- Attack Paths → Browser Analysis: runs local analysis (evidence: `frontend/src/components/PathsPane.jsx`)
- API Client → HTTP API: sends requests (evidence: `frontend/src/lib/api.js`)
- HTTP API → Authentication: authenticates users (evidence: `backend/api.py`)
- HTTP API → Data Repositories: uses repositories (evidence: `backend/api.py`)
- HTTP API → Database Connection: accesses database (evidence: `backend/api.py`)
- Database Connection → MongoDB: connects (evidence: `backend/database.py`)
- Data Repositories → Database Connection: gets database (evidence: `backend/repositories.py`)
- HTTP API → Graph Engine: analyzes snapshots (evidence: `backend/api.py`)
- Analysis CLI → Graph Engine: runs analyses (evidence: `analysis/main.py`)
- Analysis Reports → Graph Engine: uses graph engine (evidence: `analysis/report.py`)
