Research Prototype

LLM-Assisted Vulnerability Detection & Automated Remediation in CI/CD Pipelines

An autonomous agent that scans pushed code for vulnerabilities inside an isolated sandbox, generates a fix through a cost-tiered LLM cascade, validates it against the project's own tests, and opens a pull request — no human in the loop.

Pipeline

  1. Push event
    webhook listener
  2. Clone
    host-side, read-only checkout
  3. Sandbox scan
    Docker, network-isolated
  4. Findings
    Bandit · Semgrep · Gitleaks · Trivy
  5. LLM cascade
    fix generation + confidence scoring
  6. Validate
    project's own test suite
  7. Open PR
    GitHub API

Model escalation cascade

1. DeepSeek Coder free, local via Ollama — always tried first
2. Claude Haiku classification, confidence scoring, PR body text
3. Claude Sonnet escalated fix when confidence is low
4. Claude Opus absolute last resort, third attempt only

What it does

Isolated scanning

Every push is scanned inside an ephemeral, network-disabled Docker container — the target repo is never trusted with network access.

Cost-aware fixes

Escalates to a paid model only when a cheaper one reports low confidence, never the other way around.

Test-gated PRs

A generated fix is re-run against the project's existing test suite before any branch is pushed — a failing suite blocks the PR.

Four scanners, one report

Bandit, Semgrep, Gitleaks, and Trivy findings are normalized and deduplicated into a single JSON envelope.

Quickstart

git clone https://github.com/ArdenDiago/llm-assisted-vulnerability-detection-and-automated-remediation-in-cicd-pipelines.git
cd llm-assisted-vulnerability-detection-and-automated-remediation-in-cicd-pipelines
pip install -r requirements.txt
ollama pull deepseek-coder:6.7b
docker build -t llm-cicd-agent:latest .
pytest tests/