Skip to main content

llm-security-reviewer

AI-powered security code reviewer using a fine-tuned Qwen2.5-Coder-7B LLM. Scans code for vulnerabilities, reports CWE identifiers, and integrates directly with GitHub Pull Requests.

Python PyPI License


Requirements

  • Python 3.10+
  • NVIDIA GPU with CUDA (required — the model runs in 4-bit quantization)
  • 8GB+ VRAM recommended

Installation

pip install llm-security-reviewer

Setup

Download the fine-tuned adapter weights and place them in a folder called adapters/:

your-project/
└── adapters/
    ├── adapter_config.json
    └── adapter_model.safetensors

For GitHub PR reviews, set your token as an environment variable:

# Windows
set GITHUB_TOKEN=your_token_here

# Linux / macOS
export GITHUB_TOKEN=your_token_here

Usage

Review a local file:

llm-reviewer --file path/to/main.c --adapters path/to/adapters

Review a code snippet directly:

llm-reviewer --code "void login() { gets(password); }" --adapters path/to/adapters

Review a GitHub Pull Request:

llm-reviewer --pr 42 --repo owner/repo --adapters path/to/adapters

Supported file types: .c, .cpp, .h, .py, .js, .ts, .java, .go, .php, .rb, .rs, .cs


Example Output

============================================================
  SECURITY REVIEW REPORT
============================================================
  Files/Functions reviewed : 4
  Vulnerabilities found    : 2
  Status: REVIEW NEEDED
============================================================

[1] main.c — function 1
    Verdict : VULNERABLE
    CWE     : CWE-120
    Review  :
      Buffer overflow via gets(). No bounds checking on input.
      Attacker can overwrite stack memory.

[2] main.c — function 2
    Verdict : SAFE
    CWE     : N/A
    Review  :
      Uses fgets() with explicit buffer size. No issues found.

RECOMMENDATION: Do not merge. Address the vulnerabilities above before merging.

Running Tests

pip install llm-security-reviewer[dev]
pytest tests/ -v

Troubleshooting

If the program only uses your CPU, make sure you have the right version of torch installed. Uninstall current version. Run nvidia-smi and check your CUDA version in the top right corner (CUDA Version: XX.X) Install torch for the right cuda version by replacing cuXXX with your CUDA version (exception: for CUDA 13.1+ you have to use 130)

pip uninstall torch torchvision torchaudio
nvidia-smi
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cuXXX

Metadata

Release files for llm-security-reviewer 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for llm-security-reviewer 0.1.4
File Interpreter ABI Platform
llm_security_reviewer-0.1.4-py3-none-any.whl Python 3 none any Details

Release files / llm_security_reviewer-0.1.4-py3-none-any.whl

Download URL llm_security_reviewer-0.1.4-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c4c25a0f6102ff54180e7c271b1bd50e19635002e3f8dac7a62d079a63a336b9
BLAKE2b-256 checksum
How to use checksums
cd2c2312a512ed31deffcfd206634e7b723a7b2265eb450febcd828ab5640ea3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Security for llm-security-reviewer 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page