Skip to main content

🕸️snitch-stitch

A security auditor CLI for Git repositories. Scans both backend source code and running frontend UIs to find real security vulnerabilities, scores them by severity, and lets you accept or reject LLM-generated code fixes.


PyPI version Python 3.8+ License: MIT

Installation

pip install snitch-stitch

Or install from source:

git clone https://github.com/snitch-stitch/snitch-stitch.git
cd snitch-stitch
pip install -e .

Requirements

snitch-stitch uses litellm to support multiple LLM providers. Set the API key for whichever provider you want to use:

Environment Variables

Variable Required for Description
OPENAI_API_KEY OpenAI models (default) e.g. gpt-4o, gpt-4-turbo
ANTHROPIC_API_KEY Anthropic models e.g. claude-sonnet-4-5-20250929
GEMINI_API_KEY Google models e.g. gemini/gemini-1.5-pro
RTRVR_API_KEY No Used for frontend browser scanning via rtrvr.ai
# OpenAI (default)
export OPENAI_API_KEY="sk-..."

# Or Anthropic
export ANTHROPIC_API_KEY="sk-ant-..."

# Or Google
export GEMINI_API_KEY="..."

# Optional: frontend scanning
export RTRVR_API_KEY="..."

Usage

snitch-stitch <repo-path> [options]

Arguments

  • <repo-path> - Path to the local repository directory to scan (required)

Options

Flag Description Default
--model MODEL LLM model to use via litellm (see examples below) gpt-4o
--frontend-url URL URL of a running frontend (e.g., http://localhost:3000). Enables frontend scanning. None
--fix-all Skip the selection prompt and attempt to fix everything False
--dry-run Show diffs but never write anything to disk False
--verbose Print debug info (raw API responses, parsed JSON) False

Model Examples

# OpenAI (default)
snitch-stitch ./my-project --model gpt-4o
snitch-stitch ./my-project --model gpt-4-turbo

# Anthropic
snitch-stitch ./my-project --model claude-sonnet-4-5-20250929

# Google Gemini
snitch-stitch ./my-project --model gemini/gemini-1.5-pro

# Azure OpenAI
snitch-stitch ./my-project --model azure/my-deployment-name

Any model supported by litellm can be used.

Examples

Scan a repository for backend vulnerabilities:

snitch-stitch ./my-project

Scan both backend and frontend:

snitch-stitch ./my-project --frontend-url http://localhost:3000

Preview fixes without applying them:

snitch-stitch ./my-project --dry-run

Automatically fix all vulnerabilities:

snitch-stitch ./my-project --fix-all

How It Works

snitch-stitch runs through 5 stages:

Stage 1: Ingest

Converts the repository into a text format suitable for LLM analysis using gitingest.

Stage 2: Backend Scan

Sends the code to the configured LLM with a security analysis prompt. Identifies vulnerabilities like:

  • SQL injection
  • Command injection
  • Path traversal
  • Hardcoded secrets
  • Missing authentication
  • Insecure deserialization
  • XSS vulnerabilities

Stage 3: Frontend Scan (Optional)

If --frontend-url is provided and RTRVR_API_KEY is set, uses rtrvr.ai to control a real browser and probe the running application for:

  • XSS (Cross-Site Scripting)
  • Authentication bypass
  • IDOR (Insecure Direct Object Reference)
  • Missing input validation
  • Admin panel access

Stage 4: Rank

Scores each vulnerability (0-10) based on:

  • Exposure: Public-facing (5) vs local-only (1)
  • Exploitability: Easy (3) / Moderate (2) / Hard (1)
  • Impact: Critical (4) / High (3) / Medium (2) / Low (1)

Severity labels: Critical (9-10), High (7-8), Medium (4-6), Low (1-3)

Stage 5: Fix

For each selected vulnerability:

  1. Generates a minimal code fix using the configured LLM
  2. Shows a colored diff (red for removals, green for additions)
  3. Prompts you to accept or reject
  4. Writes accepted fixes to disk

Example Output

$ snitch-stitch ./my-project --frontend-url http://localhost:3000

[1/5] Ingesting repository...
      ✓ Ingested 47 files (82 KB)

[2/5] Scanning backend code (model: gpt-4o)...
      Analyzing code... done.
      ✓ Found 4 backend vulnerabilities

[3/5] Scanning frontend...
      ✓ Found 2 frontend vulnerabilities

[4/5] Ranking findings...
      ✓ Ranked 6 findings

[5/5] Review and fix

╔════╦══════════╦══════════════════════════════════════════════╦═══════╗
║  # ║ Severity ║ Title                                        ║ Score ║
╠════╬══════════╬══════════════════════════════════════════════╬═══════╣
║  1 ║ Critical ║ SQL injection in /api/login                  ║  10   ║
║  2 ║ Critical ║ Hardcoded AWS key in settings.py             ║   9   ║
║  3 ║ High     ║ Command injection in file converter          ║   8   ║
║  4 ║ High     ║ Missing auth on /api/admin/users             ║   7   ║
║  5 ║ Medium   ║ XSS in search input                          ║   5   ║
║  6 ║ Low      ║ No input validation on age field             ║   3   ║
╚════╩══════════╩══════════════════════════════════════════════╩═══════╝

Select vulnerabilities to fix (comma-separated numbers, or 'all'):
> 1, 2

--- Generating fix for: SQL injection in /api/login ---
      Generating fix... done.

 app/auth.py
──────────────────────────────────────────────────
  def login(username, password):
-     query = f"SELECT * FROM users WHERE username = '{username}'"
-     cursor.execute(query)
+     query = "SELECT * FROM users WHERE username = %s"
+     cursor.execute(query, (username,))
      user = cursor.fetchone()
──────────────────────────────────────────────────
Apply this fix? [y/n/a=accept all]: y
✓ Fixed: app/auth.py

Vulnerability Classes Detected

Class Description
sqli SQL injection via string concatenation
command_injection Shell command injection via os.system, subprocess
path_traversal Directory traversal allowing file access
ssrf Server-side request forgery
deserialization Insecure deserialization (pickle, yaml)
xss Cross-site scripting
secrets_exposure Hardcoded API keys, passwords, tokens
authz Missing or broken authorization
idor Insecure direct object references
input_validation Missing input validation

License

MIT

Metadata

Release files for snitch-stitch 0.2.0

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

Source distribution (sdist)

Source distribution for snitch-stitch 0.2.0
File Size Uploaded Provenance
snitch_stitch-0.2.0.tar.gz 30.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for snitch-stitch 0.2.0
File Interpreter ABI Platform
snitch_stitch-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 61.8 kB

Release files / snitch_stitch-0.2.0.tar.gz

Download URL snitch_stitch-0.2.0.tar.gz
Size 30.5 kB
Tags Source
SHA-256 checksum
How to use checksums
11df825fe3fc06566b44b0bfde6825b4314e9e69e5c704459d3dfbbcb521c512
BLAKE2b-256 checksum
How to use checksums
171bf5e006735c537638baa6067e4e6e57950a02e39025dcb8227773e2964b8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release files / snitch_stitch-0.2.0-py3-none-any.whl

Download URL snitch_stitch-0.2.0-py3-none-any.whl
Size 31.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc0cb91496e8f9e145a39e9e2191322275a9ffb997a129a9a324c15708dae148
BLAKE2b-256 checksum
How to use checksums
f181be93b0d5d9f1ff839d1101ac25918ba081e0e13f778b08b1ec5f4bde9697
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Security for snitch-stitch 0.2.0

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