Skip to main content

AI-powered code reviewer with OWASP Top 10 checks

Project description

๐Ÿค– ai-reviewer

AI-powered code reviewer with OWASP Top 10 checks. Fast. Local. Configurable.

Python 3.9+ License: MIT

  • โšก Works offline (Fast Mode) or with any AI provider (Cloud Mode)
  • ๐Ÿ”’ OWASP Top 10 security scanning
  • ๐Ÿš€ Parallel processing
  • ๐Ÿ“Š HTML / SARIF / JSON reports
  • ๐ŸŽฏ 8 languages supported

๐Ÿš€ Installation

pip install ai-reviewer-cli

Or from source:

git clone https://github.com/briej/ai-reviewer.git
cd ai-reviewer
pip install -e .

๐Ÿค– AI Mode

Use AI-powered analysis with Ollama or cloud providers:

# Ollama (local, free)
ai-review ./project --mode ai --provider ollama --model llama3.1

# DeepSeek (cloud, 1M free tokens)
ai-review ./project --mode cloud --provider deepseek --api-key sk-xxx

# OpenRouter (Anthropic Claude)
ai-review ./project --mode cloud --provider openrouter --api-key sk-xxx

# Groq (fast inference)
ai-review ./project --mode cloud --provider groq --api-key sk-xxx

Supported AI Providers:

  • Ollama - Local, unlimited, free (install separately)
  • DeepSeek - 1M free tokens/month
  • OpenRouter - Rate limited free tier
  • Groq - Rate limited free tier
  • Kimi - Trial available
  • Qwen - Trial available

๐Ÿณ Docker

Run without installing anything:

# Build image
docker build -t ai-reviewer .

# Run analysis on current directory
docker run -v $(pwd):/code ai-reviewer /code --mode fast

# AI mode with Ollama (requires Ollama running on host)
docker run -v $(pwd):/code --add-host host.docker.internal:host-gateway ai-reviewer /code --mode ai --provider ollama --model llama3.1

# Generate HTML report
docker run -v $(pwd):/code ai-reviewer /code --mode fast --format html --output /code/report.html

# With custom config
docker run -v $(pwd):/code -v $(pwd)/.ai-reviewer.yaml:/app/.ai-reviewer.yaml ai-reviewer /code

๐ŸŽฏ Quick Start

# Fast mode โ€” instant analysis, no AI needed
ai-review ./my-project

# AI mode โ€” Ollama-powered analysis (local)
ai-review ./my-project --mode ai --provider ollama --model llama3.1

# Cloud mode โ€” AI-powered analysis (DeepSeek)
ai-review ./my-project --mode cloud --provider deepseek --api-key sk-xxx

# HTML report
ai-review ./my-project --format html --output report.html

# Parallel processing (8 threads)
ai-review ./my-project --threads 8

๐Ÿ”ฅ Features

Security (OWASP Top 10)

  • SQL Injection detection
  • XSS vulnerability scanning
  • Hardcoded secrets detection
  • Weak cryptography checks
  • CSRF protection validation

AI Providers

Provider Free Tier Setup
Ollama โœ… Unlimited Local install
DeepSeek โœ… 1M tokens API key
OpenRouter โœ… Rate limited API key
Kimi โœ… Trial API key
Qwen โœ… Trial API key
Groq โœ… Rate limited API key

Output Formats

  • CLI โ€” Rich terminal output with tables
  • JSON โ€” Machine-readable
  • HTML โ€” Beautiful web report
  • SARIF โ€” GitHub Code Scanning compatible

Supported Languages

Python, JavaScript, TypeScript, SQL, Go, Java, Rust, C/C++


๐Ÿ“‹ Usage Examples

Basic

ai-review ./project

Cloud with specific model

ai-review ./project \
  --mode cloud \
  --provider openrouter \
  --model qwen/qwen-2.5-coder-32b \
  --api-key sk-xxx

CI/CD Integration

ai-review . --mode fast --format sarif --output report.sarif

Filter severity

ai-review ./project --severity critical

Ignore patterns

ai-review ./project --ignore __pycache__ --ignore .git --ignore node_modules

โš™๏ธ Configuration

Create .ai-reviewer.yaml in your project root:

mode: fast
threads: 4
severity: all

ignore:
  - __pycache__
  - .git
  - node_modules
  - "*.min.js"

cloud:
  provider: deepseek
  model: deepseek-coder
  timeout: 30

rules:
  - id: no-print
    pattern: "print("
    severity: info
    message: "Remove print statements"
    languages: [python]

๐Ÿ”„ GitHub Actions

name: Code Review
on: [push, pull_request]

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'
      - run: pip install ai-reviewer-cli
      - run: ai-review . --mode fast --format sarif --output report.sarif
      - uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: report.sarif

AI-Powered CI/CD:

- run: pip install ai-reviewer-cli
- run: ai-review . --mode ai --provider ollama --model llama3.1 --format sarif --output report.sarif

๐Ÿ›  Pre-commit Hook

# .pre-commit-config.yaml
repos:
  - repo: https://github.com/briej/ai-reviewer
    rev: v1.2
    hooks:
      - id: ai-reviewer

๐Ÿ“Š Example Output

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ๐Ÿค– ai-reviewer โ€” v1.2                            โ”‚
โ”‚ OWASP Top 10 | Multi-Cloud | Parallel | Rich CLI โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โœ“ Files found: 23

โš ๏ธ  CRITICAL (3)
  โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
  hardcoded-secret   config.py:12   Hardcoded secret
  sql-injection      db.py:45       SQL Injection
  code-injection     utils.py:89    eval() is dangerous

๐Ÿ”ถ WARNING (7)
  โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
  weak-crypto        auth.py:34     Weak hash
  xss                frontend.js:67 innerHTML vulnerable

๐Ÿ’ก INFO (12)
  โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
  debug              main.py:23     console.log

โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Files analyzed โ”‚ 23/23 โ”‚
โ”‚ Time           โ”‚ 0.45s โ”‚
โ”‚ Critical       โ”‚ 3     โ”‚
โ”‚ Warning        โ”‚ 7     โ”‚
โ”‚ Info           โ”‚ 12    โ”‚
โ”‚ Score          โ”‚ 4.2/10โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿค Contributing

See CONTRIBUTING.md


๐Ÿ“œ License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_reviewer_cli-1.3.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_reviewer_cli-1.3.0-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file ai_reviewer_cli-1.3.0.tar.gz.

File metadata

  • Download URL: ai_reviewer_cli-1.3.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ai_reviewer_cli-1.3.0.tar.gz
Algorithm Hash digest
SHA256 56b096382ed16cebf68ba323a99e2321d5e4739ba7952bf44fdc46823ed41be0
MD5 3ea7ef1f2e0426326346f7feb9d59ed3
BLAKE2b-256 6a8c3cf501a719c26506b659007c2ca81fe5b587ed46cf8732db1d955304f0ce

See more details on using hashes here.

File details

Details for the file ai_reviewer_cli-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ai_reviewer_cli-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3b2f5d178dd0c5545c113c9cf5d9810e65eb05c02f99ca924821aec95d8cabc
MD5 93afb29b92b97698f4d9c58883bcda5c
BLAKE2b-256 dcedd333713122a3b254655048e168cbeb6d4212599e4006a734d97e4af3630d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page