In the era of AI-assisted coding, developers face two major challenges:
- Identifying vulnerabilities in code is time-consuming and complex.
- Developers often struggle to find correct and secure fixes.
- Source code may contain sensitive data such as API keys, passwords, and personal information.
- Sending raw code to AI services can increase the risk of data leakage.
- Uses industry-standard tools such as Semgrep to detect common vulnerabilities.
- Automatically scans for sensitive data before code leaves the local environment or server.
- Applies data redaction by replacing sensitive values with placeholders.
- Sends sanitized code context (after redaction) to OpenAI for analysis.
- AI provides:
- Root cause explanation
- Recommended fix
- Secure code snippet
- VS Code:
- Real-time vulnerability alerts
- One-click "Fix with AI" directly in the editor
- Python 3.11+
- Node.js 20+
- Ollama running locally with qwen2.5-coder:7b model (or other model)
- VS Code 1.95+
- Open terminal in apps/backend
- Create virtual environment: python -m venv ../../.venv
- Activate virtual environment (PowerShell): ../../.venv/Scripts/Activate.ps1
- Install packages: python -m pip install -r requirements.txt
- Run server: python -m uvicorn app.main:app --port 8000
- Verify health endpoint: GET http://127.0.0.1:8000/v1/health
PowerShell quick script:
Set-Location apps/backend
python -m venv ../../.venv
../../.venv/Scripts/Activate.ps1
python -m pip install -r requirements.txt
python -m uvicorn app.main:app --port 8000- Open the repository root folder SentinelAI in VS Code
- Install dependencies in apps/extension: npm install
- Build extension: npm run build
- Open Run and Debug and select Run SentinelAI Extension
- Press F5 to launch Extension Development Host
PowerShell quick script:
# Build webview UI first
Set-Location apps/webview-ui
npm install
npm run build
# Then build extension
Set-Location ../extension
npm install
npm run buildIf F5 opens a JSON debug prompt, use the root workspace debug profile at .vscode/launch.json and choose Run SentinelAI Extension instead of running the open file.
- Open a source file in the Extension Development Host
- Select code snippet (or leave empty selection to scan full file)
- Run command: SentinelAI: Scan and Suggest Fix
- Review diagnostics in editor (warning/error highlights)
- Open quick fix (lightbulb) and click SentinelAI: Apply Fix
- Use sample vulnerable code in qa/testcases/owasp-top10
- Confirm findings are detected at correct lines
- Confirm fixed code removes vulnerability without breaking behavior
Run this after backend is up (in another terminal):
cd apps/backend
python test_api.pyExpected output:
- Health check test
- Empty code validation test
- Unsupported language error test
- Code size limit test
- Secure code scan (no vulnerabilities)
- Valid Python scan (SQL injection + hardcoded credentials)
- JavaScript code scan (XSS vulnerabilities)
- Test summary with [PASS]/[FAIL] status
# Install Ollama from https://ollama.ai
# Then start Ollama service
ollama serve
# In another terminal, pull the default model
ollama pull qwen2.5-coder:7b
# Or use other models
ollama pull llama3.1
ollama pull mistral
ollama pull neural-chatcurl http://localhost:8000/v1/healthcurl -X POST http://localhost:8000/v1/scan-fix \
-H "Content-Type: application/json" \
-d '{
"request_id": "test-1",
"language": "python",
"file_path": "test.py",
"code_snippet": "x = input()\nquery = f\"SELECT * FROM users WHERE id={x}\""
}'Default uses ollama/qwen2.5-coder:7b. To use a different model:
# Set the Ollama model
export LLM_MODEL=ollama/llama3.1
# or
export LLM_MODEL=ollama/mistral
# or
export LLM_MODEL=ollama/neural-chat
# Ollama URL (default: http://localhost:11434)
export OLLAMA_URL=http://localhost:11434- If SentinelAI: Scan and Suggest Fix does not appear, make sure the Extension Development Host was launched from the root workspace and the SentinelAI extension is built in apps/extension.
- If F5 opens JSON debugging instead of the extension, close that prompt and use the Run SentinelAI Extension profile from the root .vscode/launch.json.
- If test_api.py fails with connection error, verify backend is running on http://localhost:8000
- If /scan-fix returns 500 with Ollama connection error, verify Ollama is running:
ollama serve - For semgrep errors, ensure semgrep is installed:
pip install semgrep - To check available Ollama models:
ollama list
- apps/backend: FastAPI gateway, sanitization, Semgrep, AI orchestration
- apps/extension: VS Code extension core, diagnostics, code actions
- apps/webview-ui: React UI for chat and diff-style result panel
- qa: security test cases and validation plan
- contracts: API schema between extension and backend
- docs: architecture and roadmap