Trinetra
Upload a C/C++ codebase and get back the vulnerable files, their CWE types, severity, and AI-suggested fixes — powered by two fine-tuned CodeBERT models.
- Highlight
- ~98% precision on the Juliet C/C++ test suite
- Role
- Senior Analyst
- Status
- Prototype
- Year
- 2026
- Built with
- Ajay Shankar Singh, Madhav Khanal
- Stack
- PythonPyTorchTransformersFastAPISQLAlchemyReactTypeScriptDocker
The problem
Manual security review of C and C++ code is slow, and the languages make memory-safety bugs easy to write. Trinetra screens every source file automatically, labels likely weakness types, and suggests fixes, so reviewers can spend their time on the files that matter.
How it works
- A user uploads a ZIP of their source code through the React app.
- The FastAPI backend checks their plan's daily scan limit and forwards the files to a separate AI service.
- The AI service runs every
.c,.cpp, and.hfile through VulnDetect, a fine-tuned CodeBERT model that answers one question: vulnerable or safe? - Only flagged files go to VulnLabel, a second model that classifies the weakness into one of 392 CWE types, which then maps to a severity.
- Results are saved, shown as a tree of affected files, and exported as a PDF report.
- When a user asks for a fix, an LLM generates one — and it's saved, so it's only ever generated once.
Key decisions
Two models instead of one. A cheap vulnerable-or-safe check runs on every file; the more expensive CWE classifier runs only on the files that fail it.
Inference lives in its own service. The models run in a separate FastAPI service, so admins can upload and load new model versions without touching the main backend.
Fixes on demand. Generating remediations only when someone asks — and caching the result — avoids paying for LLM calls on findings nobody reads.
Guarded inputs. Uploads are limited to ZIP files under 10 MB, model uploads are checked for path traversal, and scans are rate-limited by plan.
Results
On the test split of the Juliet C/C++ test suite, the detection model reached about 98% precision and recall. Juliet is a synthetic benchmark, so real-world code will be harder — that number says the approach works, not that it's production-ready.
My role
Trinetra was a team project. Madhav Khanal trained and evaluated the models, and Ajay Shankar Singh worked on the app. My part was the backend and its integration with the AI service, security hardening across the codebase, and the CI pipeline: linting, integration tests, a bundle-size budget, and backend tests on every push.