Metadata-Version: 2.5
Name: vulnhound
Version: 0.1.1
Summary: Token-thrifty vulnerability finder for Python projects: finds, proves, fixes.
Project-URL: Repository, https://github.com/bu-ra34/vulnhound
License: MIT
License-File: LICENSE
Keywords: claude-code,security,static-analysis,taint-analysis,vulnerability
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Security
Requires-Python: >=3.10
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Description-Content-Type: text/markdown

# vulnhound

**Finds real vulnerabilities. Proves them. Fixes them. Without burning your tokens.**

> Status: early alpha. `analyze`, `slice`, `report`, `estimate` and `prove` work today;
> `prove` needs docker or unshare (it never runs the PoC on the host).

[Türkçe](README.tr.md)

## Why

Asking an LLM to security-review a codebase usually means feeding it the whole repo.
That is expensive, slow, and most of those tokens are code that has nothing to do with
any vulnerability. vulnhound avoids this: cheap static analysis finds candidate flows
first, so the LLM only reads a short list and a few small code slices.

## How it works

- **The core is the eyes.** A stdlib-only Python program builds an AST index and runs
  taint analysis from untrusted sources to dangerous sinks. It never calls an LLM and
  prints short JSON.
- **Claude is the brain.** Inside Claude Code, the bundled skill tells Claude to run the
  CLI, read only that output plus small slices, judge each finding, write a PoC for the
  likely-real ones, prove it in a sandbox, and patch it.

Zero runtime dependencies. Python 3.10+. MIT licensed.

## Install

As a Claude Code plugin:

```
/plugin marketplace add bu-ra34/vulnhound
/plugin install vulnhound@vulnhound
```

The CLI itself (the skill needs it on your PATH):

```
pip install vulnhound
```

## CLI

| Command | What it does |
|---|---|
| `vulnhound analyze [path] [--json] [--no-cache] [--min-severity S] [--fail-on S] [--baseline FILE]` | Find candidate vulnerabilities. Exit 1 if any. Findings sharing a sink/helper are grouped (`--no-group` to list all); tests/examples/docs dirs and `test_*.py` are skipped unless `--include-tests`; `--include-local-sources` adds local/CLI inputs as sources. `--fail-on S` fails CI only at severity S and above; `--baseline FILE` hides already-known findings. |
| `vulnhound slice <id>` | Minimal code slice for one finding. |
| `vulnhound prove <id> --poc FILE [--root DIR] [--backend auto\|docker\|unshare] [--timeout S] [--json] [--verbose]` | Run a PoC in a sandbox (no network, resource-limited). Prints PROVEN (exit 0), SAFE (1) or UNVERIFIED (3). |
| `vulnhound estimate [path] [--json]` | Rough token cost (bytes/4) of reading the whole repo. |
| `vulnhound report [--format json\|sarif\|markdown] [-o FILE]` | Render findings. |
| `vulnhound version` | Print version. |

Exit codes: 0 ok / no findings, 1 findings found, 2 usage error (e.g. unknown id), 3 UNVERIFIED (prove).

## Proving a finding

`vulnhound prove <id> --poc poc.py` runs a small standalone Python PoC in a sandbox (network off, memory/CPU/time limited, project mounted read-only) and reports a verdict. The PoC triggers the vulnerable code with a malicious input and calls `proven("detail")` from `vulnhound.poc` when the exploit works, or `safe("detail")` when it is blocked. `canary_path()` returns a secret file outside the project, for path-traversal PoCs to read. No marker and exit 0 means SAFE; sandbox missing, timeout or a crashing PoC means UNVERIFIED. The PoC never runs on the host.

Caveat: the sandbox needs docker or unshare. The PoC runs against your project, so third-party imports must be importable inside it: the `unshare` backend sees the host venv read-only, while the `docker` backend uses a clean python image, so PoCs needing framework imports may report UNVERIFIED there. Pick `--backend unshare` when the PoC imports your installed deps.

## Continuous integration

Run vulnhound on every push and upload results to GitHub code scanning:

```yaml
# .github/workflows/vulnhound.yml
name: vulnhound
on: [push, pull_request]
jobs:
  scan:
    runs-on: ubuntu-latest
    permissions:
      security-events: write
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - run: pip install vulnhound
      - run: vulnhound analyze . --fail-on high
      - if: always()
        run: vulnhound report --format sarif -o vulnhound.sarif
      - if: always()
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: vulnhound.sarif
```

`--fail-on high` keeps the build green on low/medium noise while still failing on high and critical findings. To adopt vulnhound on a codebase that already has findings, commit a baseline and fail only on new ones:

```bash
vulnhound analyze . --json --no-group > .vulnhound-baseline.json   # once, reviewed and committed
vulnhound analyze . --baseline .vulnhound-baseline.json            # in CI: only new findings fail
```

As a [pre-commit](https://pre-commit.com/) hook:

```yaml
# .pre-commit-config.yaml
repos:
  - repo: local
    hooks:
      - id: vulnhound
        name: vulnhound
        entry: vulnhound analyze
        language: system
        pass_filenames: false
        always_run: true
```

## Security

Scan only code you own. See [SECURITY.md](SECURITY.md).

## License

MIT
