# itsbk13/cybershield_ext architecture

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

- Interactive diagram: https://gitdiagram.com/itsbk13/cybershield_ext
- Repository: https://github.com/itsbk13/cybershield_ext

## Overview

CyberShield v2.0 is a browser-extension threat checker. The main flow is user input in the popup, backend analysis and ML classification, optional CVE/KEV enrichment for detected threats, and a returned assessment rendered in the popup; the README also documents conversational Gemini responses and translation. The backend records scans and provides a Gemini-key endpoint. CVE lookup includes direct exploit mappings or NVD search, followed by CISA KEV cross-reference and caching. Relationships for the enrichment engine are supported by the sampled utils excerpt; extension, translation, and Gemini behavior is documented in the README, not verified from popup.js excerpts.

Main entry points: [`v2.0_ext/backend/cb/views.py`](https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/backend/cb/views.py) (Analysis endpoints), [`v2.0_ext/backend/cb/utils.py`](https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/backend/cb/utils.py) (CVE/KEV enrichment), [`v2.0_ext/extension/popup.js`](https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/extension/popup.js) (Popup chat UI), [`v2.0_ext/backend/cb/urls.py`](https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/backend/cb/urls.py) (API routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_extension["Browser extension"]
  node_popup["Popup chat UI<br/>[popup.js]"]
  node_translation["Language translation<br/>[popup.js]"]
  node_gemini["Gemini chat<br/>[popup.js]"]
end

subgraph group_api["Backend API"]
  node_api_routes["API routes<br/>[urls.py]"]
  node_api_views["Analysis endpoints<br/>[views.py]"]
end

subgraph group_analysis["Threat analysis"]
  node_classifier["ML classification<br/>[utils.py]"]
  node_models[("Scanned messages<br/>[models.py]")]
  node_serializers["Scan serializer<br/>[serializers.py]"]
end

subgraph group_intelligence["Vulnerability intelligence"]
  node_enrichment["CVE/KEV enrichment<br/>[utils.py]"]
  node_vendor_map["Vendor and exploit map<br/>[utils.py]"]
  node_cache[("24-hour CVE cache<br/>[utils.py]")]
  node_nvd["NVD API"]
  node_cisa["CISA KEV feed"]
end

node_user(("User"))

node_user -->|"submits input"| node_popup
node_popup -->|"translates input"| node_translation
node_translation -->|"POSTs analysis"| node_api_routes
node_api_routes -->|"routes request"| node_api_views
node_api_views -->|"classifies text"| node_classifier
node_api_views -->|"records scan"| node_models
node_api_views -->|"instantiates serializer"| node_serializers
node_api_views -->|"enriches threats"| node_enrichment
node_enrichment -->|"matches keywords"| node_vendor_map
node_enrichment -->|"checks cache"| node_cache
node_enrichment -->|"searches CVEs"| node_nvd
node_enrichment -->|"cross-checks CVEs"| node_cisa
node_api_views -.->|"serves Gemini key"| node_api_routes
node_api_routes -->|"returns assessment"| node_popup
node_popup -->|"requests chat response"| node_gemini
node_gemini -->|"translates response"| node_translation
node_popup -->|"renders results"| node_user

click node_popup "https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/extension/popup.js"
click node_translation "https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/extension/popup.js"
click node_api_routes "https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/backend/cb/urls.py"
click node_api_views "https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/backend/cb/views.py"
click node_gemini "https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/extension/popup.js"
click node_classifier "https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/backend/cb/utils.py"
click node_models "https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/backend/cb/models.py"
click node_serializers "https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/backend/cb/serializers.py"
click node_enrichment "https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/backend/cb/utils.py"
click node_vendor_map "https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/backend/cb/utils.py"
click node_cache "https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/backend/cb/utils.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_popup,node_translation,node_gemini,node_user toneBlue
class node_api_routes,node_api_views toneAmber
class node_classifier,node_models,node_serializers toneMint
class node_enrichment,node_vendor_map,node_cache,node_nvd,node_cisa toneRose
```

## Components

### Browser extension

- [Popup chat UI](https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/extension/popup.js): `v2.0_ext/extension/popup.js`
- [Language translation](https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/extension/popup.js): `v2.0_ext/extension/popup.js`
- [Gemini chat](https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/extension/popup.js): `v2.0_ext/extension/popup.js`

### Backend API

- [API routes](https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/backend/cb/urls.py): `v2.0_ext/backend/cb/urls.py`
- [Analysis endpoints](https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/backend/cb/views.py): `v2.0_ext/backend/cb/views.py`

### Threat analysis

- [ML classification](https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/backend/cb/utils.py): `v2.0_ext/backend/cb/utils.py`
- [Scanned messages](https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/backend/cb/models.py): `v2.0_ext/backend/cb/models.py`
- [Scan serializer](https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/backend/cb/serializers.py): `v2.0_ext/backend/cb/serializers.py`

### Vulnerability intelligence

- [CVE/KEV enrichment](https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/backend/cb/utils.py): `v2.0_ext/backend/cb/utils.py`
- [Vendor and exploit map](https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/backend/cb/utils.py): `v2.0_ext/backend/cb/utils.py`
- [24-hour CVE cache](https://github.com/itsbk13/cybershield_ext/blob/main/v2.0_ext/backend/cb/utils.py): `v2.0_ext/backend/cb/utils.py`
- **NVD API**
- **CISA KEV feed**

### Other components

- **User**

## Connections

- User → Popup chat UI: submits input (evidence: `README.md`)
- Popup chat UI → Language translation: translates input (evidence: `README.md`)
- Language translation → API routes: POSTs analysis (evidence: `README.md`)
- API routes → Analysis endpoints: routes request (evidence: `v2.0_ext/backend/cb/urls.py`)
- Analysis endpoints → ML classification: classifies text (evidence: `v2.0_ext/backend/cb/views.py`)
- Analysis endpoints → Scanned messages: records scan (evidence: `v2.0_ext/backend/cb/views.py`)
- Analysis endpoints → Scan serializer: instantiates serializer (evidence: `v2.0_ext/backend/cb/views.py`)
- Analysis endpoints → CVE/KEV enrichment: enriches threats (evidence: `v2.0_ext/backend/cb/views.py`)
- CVE/KEV enrichment → Vendor and exploit map: matches keywords (evidence: `v2.0_ext/backend/cb/utils.py`)
- CVE/KEV enrichment → 24-hour CVE cache: checks cache (evidence: `v2.0_ext/backend/cb/utils.py`)
- CVE/KEV enrichment → NVD API: searches CVEs (evidence: `v2.0_ext/backend/cb/utils.py`)
- CVE/KEV enrichment → CISA KEV feed: cross-checks CVEs (evidence: `v2.0_ext/backend/cb/utils.py`)
- Analysis endpoints → API routes: serves Gemini key (evidence: `README.md`)
- API routes → Popup chat UI: returns assessment (evidence: `README.md`)
- Popup chat UI → Gemini chat: requests chat response (evidence: `README.md`)
- Gemini chat → Language translation: translates response (evidence: `README.md`)
- Popup chat UI → User: renders results (evidence: `README.md`)
