Skip to main content

PatchProof

Deterministic exploit repro + AI patch verification engine. Bridging the gap between "we found a bug" and "we proved the fix works."

PatchProof takes a target source tree and a Proof-of-Concept exploit (curl, raw HTTP, Nuclei template, Python script), spins up an ephemeral Docker sandbox, confirms the exploit reproduces (๐Ÿ”ด Red), iteratively asks an LLM to draft a fix, hot-reloads the app, re-runs the exact same PoC, and emits a verified .patch + regression test + signed attestation when the exploit is blocked (๐ŸŸข Green) without breaking the rest of the test suite.

   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
   โ”‚  Ingest PoC โ”‚ โ†’  โ”‚   Sandbox   โ”‚ โ†’  โ”‚  Red state  โ”‚
   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                               โ–ผ
                                       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                       โ”‚  AI patch loopโ”‚
                                       โ”‚  (โ‰คN attempts)โ”‚
                                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                              โ–ผ
                              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                              โ–ผ                              โ–ผ
                       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                       โ”‚ Still red?  โ”‚                โ”‚   Green โœ”   โ”‚
                       โ”‚  refineโ€ฆ    โ”‚                โ”‚ regression? โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                            โ–ผ
                                            โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                            โ”‚ fix.patch + regression    โ”‚
                                            โ”‚ test + signed attestation  โ”‚
                                            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Install

PyPI/npm name: patchproof-repro (the patchproof names were taken). Import as patchproof, run as patchproof.

pip install patchproof-repro
# or from source:
git clone https://github.com/purvanshbhatt/patchproof
cd patchproof
uv pip install -e '.[all]'          # or: pip install -e '.[all]'

Requires a running Docker daemon.

CLI

patchproof --help
patchproof run   --app ./tests/fixtures/vuln-fastapi-sqli/app \
                --poc ./tests/fixtures/vuln-fastapi-sqli/poc.txt
patchproof run   --app ./my-app --poc ./sqli.curl --max-attempts 5 --model gpt-4o-mini
patchproof verify --app ./my-app --poc ./sqli.curl --patch ./fix.patch
patchproof init   # scaffold ./patchproof.toml

Run artifacts land in patchproof-out/<run-id>/:

fix.patch                     โ† drop-in git diff
attestation.json              โ† signed evidence (target SHA + PoC SHA + verdict)
evidence/red.json             โ† red baseline response
evidence/attempt_<n>.json     โ† every retry
test_security_patchproof.py   โ† regression test, ready for CI

Use as a library

from pathlib import Path
from patchproof.pipeline import Pipeline

Pipeline(
    app_path=Path("./my-app"),
    poc=Path("./sqli.curl"),
    max_attempts=5,
    model="gpt-4o-mini",
).run()

MCP server (Cursor / Claude Code)

{
  "mcpServers": {
    "patchproof": {
      "command": "python",
      "args": ["-m", "patchproof.mcp.server"],
      "cwd": "<path to patchproof checkout>"
    }
  }
}

Tools exposed:

  • patchproof_run(app_path, poc_path, hardcoded_patch?, max_attempts?, model?)
  • patchproof_verify(app_path, poc_path, patch_path)

CI / pre-commit

  • GitHub Actions: see examples/github/patchproof.yml.
  • pre-commit hook: see examples/hooks/pre-commit (symlink into .git/hooks/).

Architecture

module role
ingest.normalize curl / raw HTTP / Nuclei / Python โ†’ normalized PoC
sandbox.app_spec Detect runtime + framework, pick base image & reload cmd
sandbox.docker Ephemeral container, hot-reload, exec PoC, run tests
patch.locator tree-sitter / regex โ†’ most likely vulnerable file:line
patch.llm LiteLLM โ†’ unified diff
patch.apply git apply (or hand-rolled) + snapshot rollback
regression.runner docker exec the framework test suite
report.attestation JSON evidence + optional ed25519 signature
report.tui Rich live display

Development

uv pip install -e '.[dev]'
pytest -m 'not integration'          # unit tests (no Docker)
pytest                                # all tests (needs Docker)
ruff check src tests

License

Apache-2.0.

Download files

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

Source Distribution

patchproof_repro-0.1.0.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

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

patchproof_repro-0.1.0-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

Details for the file patchproof_repro-0.1.0.tar.gz.

File metadata

  • Download URL: patchproof_repro-0.1.0.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.3

File hashes

Hashes for patchproof_repro-0.1.0.tar.gz
Algorithm Hash digest
SHA256 64019370b719481d679720646ff14a7f3474b57b835ac1a332227135fc5344c2
MD5 bd151d1808b7a546942393786ad03426
BLAKE2b-256 34e8140313278c5c152e9c0d3cba895b510dd531310d42ddff3cb25fc7a39174

See more details on using hashes here.

File details

Details for the file patchproof_repro-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for patchproof_repro-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2686a7451e2668e7d6f68917df08b00e9e71c2ca401260fd5a98d81d6f05f6e7
MD5 4a1b089a18b56dcc2950adcc6afcc310
BLAKE2b-256 8318ed8de6289de6eb5cf05e5b36b78e41bac9741c8144f0ec6c450cdba8a5c9

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

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