Spaces:
Running
Running
| ## π‘οΈ CodeSentry Frontend β AI Security Copilot | |
| > AMD Developer Hackathon 2026 β Track 1: AI Agents & Agentic Workflows | |
| **CodeSentry** is an enterprise-grade AI security intelligence platform. Built for the modern agentic workflow, it orchestrates multiple specialized AI agents to scan, analyze, and remediate security threats in real-time. | |
| --- | |
| ## β‘ Why CodeSentry? | |
| In an era of AI-generated code, vulnerabilities move faster than human reviewers. CodeSentry provides: | |
| - **Agentic Intelligence**: Not just a static scanner. Three specialized agents (Security, Performance, Fix) reason over your code like a senior security team. | |
| - **Cinematic Experience**: A futuristic SOC-style dashboard designed for high-stakes security monitoring. | |
| - **AMD MI300X Live Metrics**: Real-time hardware telemetry (GPU Util, VRAM, Temp, Power, Bandwidth) streamed directly to the dashboard. | |
| - **CUDA β ROCm Migration Advisor**: Scans code for CUDA-specific patterns and provides actionable ROCm migration guidance with an AMD Compatibility Score. | |
| - **Privacy-First**: Optimized for the AMD ecosystem, ensuring high-performance local inference. Your proprietary code never leaves your network. | |
| - **Instant Remediation**: Don't just find bugsβfix them. Get PR-ready patches in seconds. | |
| --- | |
| ## β¨ Demo Flow | |
| 1. **Clone** this repo | |
| 2. **Run** `npm install && npm run dev` | |
| 3. **Open** `http://localhost:5173` | |
| 4. **Click** "Launch Security Scan" β demo runs in mock mode with no backend needed. You will see simulated AMD metrics and migration findings! | |
| --- | |
| ## ποΈ Architecture | |
| ``` | |
| Frontend (Vite + React) Backend (FastAPI + Python) | |
| ββββββββββββββββββββββ ββββββββββββββββββββββββββββ | |
| β Landing Page β β POST /api/scan β | |
| β Analysis View ββββΌβSSEβββ GET /api/scan/stream β | |
| β Report Page β β β | |
| ββββββββββββββββββββββ β Security Agent β | |
| β Performance Agent β | |
| β AMD Migration Advisor β | |
| β Fix Agent β | |
| β AMD Metrics Collector β | |
| ββββββββββββββββββββββββββββ | |
| ``` | |
| ## π€ AI Agents & Tools | |
| | Component | Responsibilities | Output | | |
| |-----------|-----------------|--------| | |
| | **Security Agent** | SQL injection, hardcoded secrets, unsafe eval, pickle deserialization, weak hashing | CWE-mapped findings with severity | | |
| | **Performance Agent** | N+1 queries, memory leaks, GPU inefficiencies, FP32 waste | Optimization suggestions | | |
| | **Fix Agent** | Generates before/after patches for all fixable findings | Downloadable diffs | | |
| | **AMD Migration Advisor** | Detects CUDA APIs (nvidia-smi, cudnn, etc) | Compatibility score + ROCm fixes | | |
| | **AMD Metrics Collector**| Polls `rocm-smi` every 2s for hardware stats | Real-time GPU telemetry | | |
| --- | |
| ## π Quick Start | |
| ### Frontend Only (Mock Mode β demo-safe) | |
| ```bash | |
| npm install | |
| npm run dev | |
| # Open http://localhost:5173 | |
| # VITE_MOCK_MODE=true by default | |
| ``` | |
| ### Full Stack (Frontend + Backend) | |
| ```bash | |
| # Terminal 1 β Frontend | |
| npm install && npm run dev | |
| # Terminal 2 β Backend | |
| cd backend | |
| pip install -r requirements.txt | |
| uvicorn main:app --reload --port 8000 | |
| # Then set in .env: | |
| # VITE_MOCK_MODE=false | |
| ``` | |
| --- | |
| ## π§ Environment Variables | |
| | Variable | Default | Description | | |
| |----------|---------|-------------| | |
| | `VITE_MOCK_MODE` | `true` | Use mock data (no backend needed) | | |
| | `VITE_API_URL` | `http://localhost:8000` | Backend API URL | | |
| --- | |
| ## π Privacy-First Design | |
| - **Zero data retention** β no code stored after session | |
| - **Local inference** β all analysis on-device via vLLM | |
| - **No external API calls** β code never leaves your machine | |
| - **Session data wiped** on completion | |
| - **Cryptographic Audit** β signed ZDR certificates generated | |
| --- | |
| ## π¨ Tech Stack | |
| | Layer | Technology | | |
| |-------|-----------| | |
| | Frontend | Vite + React 18 | | |
| | Styling | Vanilla CSS with custom design system (`index.css`) | | |
| | Charts | Chart.js + react-chartjs-2 | | |
| | Fonts | Syne (headings) + JetBrains Mono (code) | | |
| | Streaming | Server-Sent Events (SSE) | | |
| --- | |
| ## π Project Structure | |
| ``` | |
| codesentry-frontend/ | |
| βββ src/ | |
| β βββ components/ | |
| β β βββ LandingPage.jsx # Hero + inputs | |
| β β βββ AnalysisView.jsx # Live analysis split-panel | |
| β β βββ ReportView.jsx # Full report + exports | |
| β β βββ AgentCard.jsx # Agent status card | |
| β β βββ FindingCard.jsx # Expandable finding | |
| β β βββ SeverityBadge.jsx # Severity indicator | |
| β β βββ SeverityChart.jsx # Donut chart | |
| β β βββ PrivacyCertificate.jsx | |
| β β βββ AMDMetricsCard.jsx # Live GPU telemetry card | |
| β β βββ AMDMigrationPanel.jsx # ROCm compatibility report | |
| β β βββ ParticleBackground.jsx | |
| β βββ context/ | |
| β β βββ ScanContext.jsx # Global state + SSE reducers | |
| β βββ services/ | |
| β β βββ scanService.js # SSE client | |
| β β βββ mockService.js # Mock replay engine (simulates AMD data) | |
| β βββ index.css # Cyberpunk design system | |
| βββ public/ | |
| β βββ mock_analysis.json # Demo data payload | |
| β βββ background.png # Cyberpunk UI background | |
| βββ .env # Environment config | |
| ``` | |