An AI-powered security vulnerability scanner for Python codebases that combines industry-standard security tools with intelligent remediation guidance.
- Multi-Tool Security Scanning - Combines Bandit, Safety, and Semgrep for comprehensive analysis
- Risk Score Calculation - Visual risk assessment (0-100) with severity breakdown
- Scan History - Track and review past scans with local SQLite storage
- Modern UI - Dark/light theme with real-time progress indicators
- ZIP File Upload - Easy project submission via drag-and-drop upload
- AI Remediation - Groq API integration for intelligent fix suggestions with vulnerable vs fixed code comparison
| Technology | Version | Purpose |
|---|---|---|
| Next.js | 16.1.6 | React framework with App Router |
| React | 19.2.3 | UI library |
| Tailwind CSS | v4 | Utility-first CSS framework |
| Framer Motion | 12.36.0 | Smooth animations |
| Recharts | 3.8.0 | Data visualization |
| Lucide React | 0.577.0 | Icon library |
| Technology | Version | Purpose |
|---|---|---|
| FastAPI | 0.109.0 | Modern Python web framework |
| SQLAlchemy | 2.0.25 | ORM and database toolkit |
| Bandit | 1.7.8 | Python SAST security linter |
| Safety | 3.2.0 | Python dependency security checker |
| Semgrep | 1.77.0 | Community Edition static analysis |
| Groq SDK | 1.2.0 | LLM integration (optional) |
The fastest way to run CodeSentinel — no manual dependency installation required.
- Docker Engine (version 24+)
- Docker Compose (usually included with Docker Desktop)
# 1. Clone the repository
git clone https://github.com/your-username/CodeSentinel.git
cd CodeSentinel
# 2. Copy the environment template and add your Groq API key
cp .env.example .env
# Edit .env: set GROQ_API_KEY (get a free key at https://console.groq.com/keys)
# Optionally change GROQ_MODEL to a different available model
# 3. Build and start the containers
docker-compose up --buildOnce running, access:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
To change your API key or Groq model:
- Edit the
.envfile:GROQ_API_KEY=new_key_here GROQ_MODEL=llama-3.3-70b-versatile
- Restart the backend container:
No rebuild needed — environment variables are read at runtime.
docker-compose restart backend
# Stop containers (keeps data)
docker-compose stop
# Stop and remove containers
docker-compose downEdit the port mappings in docker-compose.yml:
ports:
- "8080:8000" # Backend on host port 8080
- "3001:3000" # Frontend on host port 3001To update to the latest version:
# 1. Pull the latest code from GitHub
git pull origin master
# 2. Check if Dockerfiles changed
git diff --name-only HEAD@{1} HEAD -- backend/Dockerfile frontend/Dockerfile docker-compose.yml
# 3. If Dockerfiles changed, rebuild and restart:
docker-compose up --build --detach
# If only application code changed (no Dockerfile edits):
docker-compose up --detachYour .env file (API key, model) is preserved across updates — no reconfiguration needed.
# All services
docker-compose logs -f
# Only backend
docker-compose logs -f backend
# Only frontend
docker-compose logs -f frontend# Restart a single service
docker-compose restart backend
# Check running containers
docker-compose ps
# Stop all containers
docker-compose stop
# Stop and remove containers and networks
docker-compose down
# Remove everything (containers, images, volumes)
docker-compose down --rmi all -v| Variable | Required | Description |
|---|---|---|
GROQ_API_KEY |
No | Free API key from console.groq.com — enables AI-powered remediation with old/new code comparison |
GROQ_MODEL |
No | LLM model name (default: llama-3.3-70b-versatile) |
- Prepare a
.zipfile containing your Python project - Drag and drop the zip file onto the upload area
- Wait for the scan to complete
- Review vulnerabilities grouped by severity
- View AI-powered remediation advice (if
GROQ_API_KEYis configured) - Use scan history to track improvements over time
codesentinel/
├── backend/
│ ├── app/
│ │ ├── api/routes.py # API endpoints
│ │ ├── core/config.py # Configuration settings
│ │ ├── database.py # Database connection
│ │ ├── main.py # FastAPI application entry
│ │ ├── models/scan.py # SQLAlchemy models
│ │ └── services/
│ │ ├── file_handler.py # ZIP upload handling
│ │ ├── llm.py # Groq LLM integration
│ │ └── scanner.py # Security scanning logic
│ ├── .env.example
│ ├── codesentinel.db # SQLite database
│ └── requirements.txt
├── frontend/
│ ├── src/
│ │ ├── app/
│ │ │ ├── page.jsx # Main application page
│ │ │ ├── layout.jsx # Root layout
│ │ │ └── globals.css # Global styles
│ │ └── lib/api.js # API client
│ ├── package.json
│ └── ...
├── .gitignore
├── LICENSE
└── README.md
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/scan |
Upload a .zip file and start a security scan |
GET |
/api/scans |
List all scans with summary information |
GET |
/api/scan/{scan_id} |
Get detailed scan results including all vulnerabilities |
DELETE |
/api/scan/{scan_id} |
Delete a scan and its associated files |
GET |
/health |
Health check endpoint |
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"project_name": "my-project.zip",
"status": "completed",
"risk_score": 72,
"vulnerability_count": 8,
"vulnerabilities_by_severity": {
"HIGH": 3,
"MEDIUM": 4,
"LOW": 1
},
"vulnerabilities": [
{
"tool": "bandit",
"severity": "HIGH",
"title": "Possible SQL Injection",
"file_path": "app/db.py",
"line_number": 42,
"code_snippet": "cursor.execute('SELECT * FROM users WHERE id = ' + user_id)",
"remediation": "This is an SQL injection vulnerability caused by string concatenation in the query. An attacker can inject malicious SQL through the user_id parameter. Use parameterized queries with placeholders to safely separate code from data.",
"explanation": "Parameterized queries prevent injection by treating user input as data, not executable SQL code.",
"old_code": "cursor.execute('SELECT * FROM users WHERE id = ' + user_id)",
"new_code": "cursor.execute('SELECT * FROM users WHERE id = ?', (user_id,))"
}
]
}Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the GNU Affero General Public License v3.0.