You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Project: The Sentinel — Network Intrusion Detection System (NIDS)
Document: NIDS_Design.md
Status: ✅ Complete — Colab Edition (2026-08-28). The React dashboard is 🟠 LOCAL-ONLY (removed); notebook 04 ships a Gradio command center that preserves the same design language and data. The original React component specs (§4) are kept as the design contract; the Gradio mapping is in §3.1b.
Legend: ✅ IMPLEMENTED · 🟡 PARTIAL · 🔵 NOTEBOOK-ONLY (Colab) · 🟠 LOCAL-ONLY (removed) · 🔴 NOT IMPLEMENTED · ⚪ FUTURE
1. Design Principles
Dark-first command center — deep navy surface (#0a0e19) with neon accent triad (cyan/blue/purple) + red alarms.
Real-time storytelling — WebSocket push keeps all threat widgets live; no refresh required.
Explainable security — every alert links to its SHAP top-5 explanation.
KPI strip — markdown table (kpi_markdown): flows / attacks / benign / uptime, refreshed with every poll.
📊 Dashboard — attack-type pie (attack_pie_fig), severity bars (severity_bar_fig), live alert feed dataframe (feed_dataframe, 3 s poll — the WebSocket-equivalent).
Network Activity: real src→dst flow aggregation (counts, relative volume bars, attack types, max severity) from latest 500 alerts
/explain
Alert picker → SHAPExplainer (max-w-4xl); deep-link support (/explain?src=&t=); fallback "Waiting for live alerts to provide AI explanation…"
/settings
Real system status from GET /api/system: backend health, deployed model manifest, sniffer counters (incl. retries/dropped), security flags; refresh button
NavLink highlight: cyan text + 3 px left border on rgba(161,250,255,0.08) background
Export Alerts CSV
Real export: latest 500 attack alerts (exclude_benign), CSV-escaped values, nids_alerts_<ISO-timestamp>.csv, "Exporting…" busy state
Meta
version v1.0.0; "API Docs" link → http://localhost:8000/docs
Responsive
desktop hidden lg:flex fixed w-64; mobile top bar (lg:hidden) with hamburger → slide-in drawer (aria-label="Navigation menu")
Theme
no theme toggle anymore — .light-mode CSS rules remain but are not wired to any control
4.2 StatusBar
Left: page title (desktop) / brand "The Sentinel" (mobile).
Health chips (poll /health every 10 s): System Active/Offline (backend reachability, blinking dot), Model OK, DB OK, Sniffer <state>, WS indicator Live or amber "WebSocket reconnecting…".
Right: Local Time clock (updates every 1 s, toLocaleTimeString) + Up Xh Ym uptime from /health.uptime_seconds.
Fetches GET /api/alerts every 30 s; builds 12 hourly buckets from REAL alert counts (bucketByHour, exported pure helper — unit-tested).
Bar color = max severity present in the bucket via SEVERITY_RANK (CRITICAL 4 … LOW 1) + severity palette; empty buckets render faint cyan.
Honest empty & error states ("No attack activity in the last 12 hours"); Y axis integer-only.
No synthetic rows — timeline shows only real traffic.
4.8 IPLeaderboard
Aspect
Spec
Data
GET /api/ip-leaderboard (poll 30 s)
List
rank, IP, count, last seen (relative time via relativeTime)
Accent
real top_attack_type badge per source; row links to /network for the src→dst flow breakdown
4.9 SHAPExplainer
Props: alert (with shap_top5); bars per feature with signed values.
Position: modal/panel; on Dashboard it renders inline for selected alert; in AI Explainability tab featured for latest alert.
Color by sevColor(alert.severity).
4.10 Chatbot
Aspect
Spec
Launcher
circular FAB (56/60 px), brand gradient, pulsing ring animation; turns red when open
Window
400 px (desktop) / full-width sheet on mobile (useIsMobile 768 px); 560 px tall; slide-up animation; gradient header with shield icon
Branding
"Sentinel AI — Network Security Assistant"
Messages
user bubbles right (blue→purple gradient); assistant left (translucent, mono code spans); typing dots indicator
Markdown-lite
renderMarkdown (exported): all HTML escaped first, then **bold**, `code` (.chat-inline-code), bullets, \n → <br/> — no raw HTML from the LLM reaches the DOM
Suggestions
4 chips: top attacker IPs · critical alerts summary · explain port scanning · severity levels meaning
Input
Enter to send; maxLength={2000}; disabled while loading; error text rendered as plain bubble (no emoji prefix)
History
full conversation array sent as history[] in every POST /api/chat
WS lifecycle: first connect fetches last-50 history; subsequent pushes append; isConnected drives StatusBar; auto-reconnect (≈3 s delay) after drops; when VITE_NIDS_API_KEY is configured the hook appends ?token= and stops reconnecting on a 4401 auth rejection.
Offline resilience: axios interceptor logs [API] Backend offline when no response; widgets keep last data; chat shows error bubble.
Empty states: Explainability / AlertFeed / AttackTimeline / Network Activity show explicit waiting or empty copy — designed, not broken.
Responsive: dashboard grids collapse from 12-col → stacked below lg; sidebar becomes overlay-hidden under lg.
7. Known Design Caveats
✅ Colab edition: the React app (§3.1, §4) is 🟠 LOCAL-ONLY (removed with nids-frontend/); notebook 04's Gradio app (§3.1b) delivers the same views over the same API with 3 s polling in place of WebSocket push.
⚠️ Gradio figures are generated on the fly with matplotlib — no per-class AUC/ROC panels in the dashboard itself (those live in notebook 02); the Explain tab reuses the same SHAP top-5 payload the API returns.
⚠️.light-mode CSS rules (original React) are obsolete with the removed frontend.
✅ Resolved this pass: AttackTimeline synthetic noise (ISSUE-04), placeholder CSV export (ISSUE-03), chat XSS surface (all HTML escaped before markdown rendering).