# khushisharma20101-design/sentinel-waf architecture

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

- Interactive diagram: https://gitdiagram.com/khushisharma20101-design/sentinel-waf
- Repository: https://github.com/khushisharma20101-design/sentinel-waf

## Overview

SentinelWAF is a Flask web-application firewall prototype with two partly distinct inspection paths: the documented request-checker API uses signature matching and invokes feature extraction plus a classifier for obfuscated input; app.py also contains a separate inspection/logging and dashboard API. Users submit payloads through the checker UI and receive a verdict; detected attacks are logged and shown in the dashboard. README-described network controls and log inspection are retained as capabilities, but their implementation details are not established by the sampled source. The graph reflects these evidence limits rather than treating the two inspection paths as one pipeline.

Main entry points: [`src/hybrid_waf/routes/proxy.py`](https://github.com/khushisharma20101-design/sentinel-waf/blob/main/src/hybrid_waf/routes/proxy.py) (Checker API), [`src/hybrid_waf/routes/main.py`](https://github.com/khushisharma20101-design/sentinel-waf/blob/main/src/hybrid_waf/routes/main.py) (Page Routes), [`waf_logs.db`](https://github.com/khushisharma20101-design/sentinel-waf/blob/main/waf_logs.db) (SQLite Threat Log), [`app.py`](https://github.com/khushisharma20101-design/sentinel-waf/blob/main/app.py) (Flask App and WAF)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_request_ui["Request Checker"]
  node_checker_ui["Request Checker UI<br/>[home.js]"]
end

subgraph group_inspection["Inspection Engine"]
  node_proxy_api["Checker API<br/>[proxy.py]"]
  node_signatures["Signature Matcher"]
  node_features["Feature Extraction<br/>[preprocessor.py]"]
  node_classifier["ML Prediction<br/>[ml_checker.py]"]
  node_model["Trained Classifier<br/>[ml_model.pkl]"]
  node_app["Flask App and WAF<br/>[app.py]"]
end

subgraph group_records["Threat Records"]
  node_dashboard_api["Dashboard API<br/>[app.py]"]
  node_database_init["Database Setup<br/>[database.py]"]
  node_store[("SQLite Threat Log<br/>[waf_logs.db]")]
  node_detection_log["Detection Text Log"]
end

subgraph group_web_views["Web Views"]
  node_page_routes["Page Routes<br/>[main.py]"]
  node_landing["Landing Page<br/>[index.html]"]
  node_dashboard_ui["Threat Dashboard<br/>[dashboard.html]"]
  node_frontend_assets["Dashboard Assets<br/>[script.js]"]
end

subgraph group_operations["Security Operations"]
  node_network_controls["Network Matrix"]
  node_log_inspector["Log Inspector"]
end

node_user(("User"))

node_user -->|"submits payload"| node_checker_ui
node_checker_ui -->|"posts request"| node_proxy_api
node_proxy_api -->|"checks signature"| node_signatures
node_proxy_api -->|"extracts features"| node_features
node_proxy_api -->|"requests prediction"| node_classifier
node_classifier -->|"predicts with"| node_model
node_proxy_api -->|"logs detections via"| node_page_routes
node_page_routes -->|"writes blocked events"| node_store
node_app -->|"registers blueprint"| node_page_routes
node_app -->|"registers blueprint"| node_proxy_api
node_app -->|"writes and reads events"| node_store
node_proxy_api -->|"writes detections"| node_detection_log
node_database_init -->|"initializes schema"| node_store
node_page_routes -->|"renders page"| node_landing
node_user -->|"views dashboard"| node_dashboard_ui
node_dashboard_api -->|"serves dashboard"| node_dashboard_ui
node_dashboard_ui -.->|"uses client logic"| node_frontend_assets
node_user -->|"manages IPs and profiles"| node_network_controls
node_user -->|"reviews events"| node_log_inspector
node_dashboard_api -->|"reads threat records"| node_store

click node_checker_ui "https://github.com/khushisharma20101-design/sentinel-waf/blob/main/static/home.js"
click node_proxy_api "https://github.com/khushisharma20101-design/sentinel-waf/blob/main/src/hybrid_waf/routes/proxy.py"
click node_signatures "https://github.com/khushisharma20101-design/sentinel-waf/blob/main/src/hybrid_waf/utils/signature_checker.py"
click node_features "https://github.com/khushisharma20101-design/sentinel-waf/blob/main/src/hybrid_waf/utils/preprocessor.py"
click node_classifier "https://github.com/khushisharma20101-design/sentinel-waf/blob/main/src/hybrid_waf/utils/ml_checker.py"
click node_model "https://github.com/khushisharma20101-design/sentinel-waf/blob/main/src/hybrid_waf/models/ml_model.pkl"
click node_app "https://github.com/khushisharma20101-design/sentinel-waf/blob/main/app.py"
click node_page_routes "https://github.com/khushisharma20101-design/sentinel-waf/blob/main/src/hybrid_waf/routes/main.py"
click node_landing "https://github.com/khushisharma20101-design/sentinel-waf/blob/main/templates/index.html"
click node_dashboard_api "https://github.com/khushisharma20101-design/sentinel-waf/blob/main/app.py"
click node_dashboard_ui "https://github.com/khushisharma20101-design/sentinel-waf/blob/main/templates/dashboard.html"
click node_frontend_assets "https://github.com/khushisharma20101-design/sentinel-waf/blob/main/static/script.js"
click node_database_init "https://github.com/khushisharma20101-design/sentinel-waf/blob/main/database.py"
click node_store "https://github.com/khushisharma20101-design/sentinel-waf/blob/main/waf_logs.db"
click node_detection_log "https://github.com/khushisharma20101-design/sentinel-waf/tree/main/logs"
click node_network_controls "https://github.com/khushisharma20101-design/sentinel-waf/tree/main/templates"
click node_log_inspector "https://github.com/khushisharma20101-design/sentinel-waf/tree/main/templates"

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_checker_ui,node_user toneBlue
class node_proxy_api,node_signatures,node_features,node_classifier,node_model,node_app toneAmber
class node_dashboard_api,node_database_init,node_store,node_detection_log toneMint
class node_page_routes,node_landing,node_dashboard_ui,node_frontend_assets toneRose
class node_network_controls,node_log_inspector toneIndigo
```

## Components

### Request Checker

- [Request Checker UI](https://github.com/khushisharma20101-design/sentinel-waf/blob/main/static/home.js): `static/home.js`

### Inspection Engine

- [Checker API](https://github.com/khushisharma20101-design/sentinel-waf/blob/main/src/hybrid_waf/routes/proxy.py): `src/hybrid_waf/routes/proxy.py`
- [Signature Matcher](https://github.com/khushisharma20101-design/sentinel-waf/blob/main/src/hybrid_waf/utils/signature_checker.py): `src/hybrid_waf/utils/signature_checker.py`
- [Feature Extraction](https://github.com/khushisharma20101-design/sentinel-waf/blob/main/src/hybrid_waf/utils/preprocessor.py): `src/hybrid_waf/utils/preprocessor.py`
- [ML Prediction](https://github.com/khushisharma20101-design/sentinel-waf/blob/main/src/hybrid_waf/utils/ml_checker.py): `src/hybrid_waf/utils/ml_checker.py`
- [Trained Classifier](https://github.com/khushisharma20101-design/sentinel-waf/blob/main/src/hybrid_waf/models/ml_model.pkl): `src/hybrid_waf/models/ml_model.pkl`
- [Flask App and WAF](https://github.com/khushisharma20101-design/sentinel-waf/blob/main/app.py): `app.py`

### Threat Records

- [Dashboard API](https://github.com/khushisharma20101-design/sentinel-waf/blob/main/app.py): `app.py`
- [Database Setup](https://github.com/khushisharma20101-design/sentinel-waf/blob/main/database.py): `database.py`
- [SQLite Threat Log](https://github.com/khushisharma20101-design/sentinel-waf/blob/main/waf_logs.db): `waf_logs.db`
- [Detection Text Log](https://github.com/khushisharma20101-design/sentinel-waf/tree/main/logs): `logs`

### Web Views

- [Page Routes](https://github.com/khushisharma20101-design/sentinel-waf/blob/main/src/hybrid_waf/routes/main.py): `src/hybrid_waf/routes/main.py`
- [Landing Page](https://github.com/khushisharma20101-design/sentinel-waf/blob/main/templates/index.html): `templates/index.html`
- [Threat Dashboard](https://github.com/khushisharma20101-design/sentinel-waf/blob/main/templates/dashboard.html): `templates/dashboard.html`
- [Dashboard Assets](https://github.com/khushisharma20101-design/sentinel-waf/blob/main/static/script.js): `static/script.js`

### Security Operations

- [Network Matrix](https://github.com/khushisharma20101-design/sentinel-waf/tree/main/templates): `templates`
- [Log Inspector](https://github.com/khushisharma20101-design/sentinel-waf/tree/main/templates): `templates`

### Other components

- **User**

## Connections

- User → Request Checker UI: submits payload (evidence: `README.md`)
- Request Checker UI → Checker API: posts request (evidence: `README.md`)
- Checker API → Signature Matcher: checks signature (evidence: `src/hybrid_waf/routes/proxy.py`)
- Checker API → Feature Extraction: extracts features (evidence: `src/hybrid_waf/routes/proxy.py`)
- Checker API → ML Prediction: requests prediction (evidence: `src/hybrid_waf/routes/proxy.py`)
- ML Prediction → Trained Classifier: predicts with (evidence: `src/hybrid_waf/utils/ml_checker.py`)
- Checker API → Page Routes: logs detections via (evidence: `src/hybrid_waf/routes/proxy.py`)
- Page Routes → SQLite Threat Log: writes blocked events (evidence: `src/hybrid_waf/routes/main.py`)
- Flask App and WAF → Page Routes: registers blueprint (evidence: `app.py`)
- Flask App and WAF → Checker API: registers blueprint (evidence: `app.py`)
- Flask App and WAF → SQLite Threat Log: writes and reads events (evidence: `app.py`)
- Checker API → Detection Text Log: writes detections (evidence: `src/hybrid_waf/routes/proxy.py`)
- Database Setup → SQLite Threat Log: initializes schema (evidence: `database.py`)
- Page Routes → Landing Page: renders page (evidence: `src/hybrid_waf/routes/main.py`)
- User → Threat Dashboard: views dashboard (evidence: `README.md`)
- Dashboard API → Threat Dashboard: serves dashboard (evidence: `app.py`)
- Threat Dashboard → Dashboard Assets: uses client logic
- User → Network Matrix: manages IPs and profiles (evidence: `README.md`)
- User → Log Inspector: reviews events (evidence: `README.md`)
- Dashboard API → SQLite Threat Log: reads threat records (evidence: `app.py`)
