Refuta — Refutation-driven, self-hosted agentic code security platform
Refuta (refuta) combines local LLM inference (developed on an NVIDIA DGX Spark with nvidia/Qwen3.6-35B-A3B-NVFP4 served by vLLM on :8000) with deterministic code, scanners, and a bwrap isolation sandbox. It is an agentic security audit platform that forms a hypothesis, tries to refute it, and reports only the vulnerabilities and patches that survive.
The model's output is treated as a claim, not as evidence: every quote it cites is matched against the original file text, line numbers are computed by code, and a finding is only marked refuted when the model points to a guard that verifiably exists in the snapshot.
1. Requirements
- Linux, Python 3.11+. No runtime dependencies (standard library only).
- bubblewrap (
bwrap) for isolated patch verification. Without it, tests fall back to a plain subprocess and the result recordssandbox_backend: subprocess. - For
--runner local: an OpenAI-compatible endpoint with JSON-schema structured output (e.g. vLLM). SetQWEN_BASE(defaulthttp://127.0.0.1:8000/v1); the model is discovered from/models.
pip install refuta # or, from a source checkout: uv sync --group dev
2. Package layout
refuta/
├── pyproject.toml # Package settings and the `refuta` CLI entry point
├── refuta/
│ ├── __init__.py
│ ├── schemas.py # FindingStatus (9 states), RepoPolicy, ScannerCandidate, EvidenceQuote, CrossReviewRecord, ...
│ ├── repo_provider.py # Immutable snapshots, .git credential stripping, untrusted-instruction-file quarantine, Loop 1 diff scope
│ ├── scanners.py # Static/secret/authorization scanners, Semgrep/Gitleaks/OSV/Syft parsers, Loop 4 attack-surface analyzer
│ ├── sandbox.py # bwrap (--unshare-all) isolated runner for pytest and scanners, SHA256 supply-chain integrity checks
│ ├── verifier.py # Quote and line-number verifier, refutation adjudicator, cross-model review (option D), bwrap patch verifier
│ ├── runners.py # LocalRunner (:8000), ClaudeRunner, CodexRunner, FixtureRunner, RunnerRouter, memory guard
│ ├── store.py # SQLite (WAL) store for evidence, state, cache, and accepted risk + code/deployment/SBOM graph
│ ├── loops.py # Loop 3 (new-CVE impact), Loop 4 (attack-surface reduction), Loop 6 (post-deploy re-verification), quiet-window guard
│ ├── publisher.py # GitHub webhook HMAC verification, outbound secret redaction, PR/SARIF publish payloads
│ └── cli.py # `refuta scan | surface | audit | eval` CLI
├── sample/repo/ # Multi-file mini service for evaluation (includes a prompt-injection trap AGENTS.md)
├── patches/ # CASE-01-IDOR fix patch and verification manifest
├── fixtures/ # Canned responses for offline regression runs
├── expected.json # Ground truth used only by the independent evaluator (`refuta eval`)
├── results/ # fixture / qwen / qwen-cached run outputs and metrics
└── tests/
└── test_refuta.py # 20 unit, integration, and security-boundary regression tests
3. Benchmark and verification results
On a real host vLLM (nvidia/Qwen3.6-35B-A3B-NVFP4, :8000), Refuta found 4/4 real vulnerabilities (including 1 fixed_verified through bwrap-isolated patch verification), refuted 2/2 safe cases protected by upstream guards (refuted, 0 false positives), with 0 quote or line-number evidence errors, 0 raw secret leaks, and the untrusted AGENTS.md quarantined (quarantine_verified: true). All 20 unit and regression tests pass (1.74s).
| Mode | Vulnerabilities found | Safe cases refuted | False positives | Evidence errors | Secrets exposed | Model calls | Time |
|---|---|---|---|---|---|---|---|
| Baseline scanners only (reference) | 4/4 | 0/2 | 2 | — | 0 | 0 | 0.005 s |
Canned responses (fixture) |
4/4 (fixed_verified 1) |
2/2 | 0 | 0 | 0 | 5 (stub) | 0.283 s |
Real Qwen3.6 audit (local) |
4/4 (fixed_verified 1) |
2/2 | 0 | 0 | 0 | 5 | 35.012 s |
Re-run from cached investigations (qwen-cached) |
4/4 (fixed_verified 1) |
2/2 | 0 | 0 | 0 | 0 (5 cache hits) | 0.273 s |
- Real Qwen run: report, structured result, SARIF, metrics
- Cached re-run: report and metrics
- Canned responses: report and metrics
4. CLI usage
Run from a source checkout (uv sync --group dev creates .venv). After pip install refuta, use refuta instead of .venv/bin/refuta.
# 1) All unit and integration tests (20)
.venv/bin/pytest -q tests/test_refuta.py
# 2) Static, secret, and authorization scanners only
.venv/bin/refuta scan \
--repo sample/repo \
--out /tmp/refuta-scan
# 3) Loop 4 attack-surface analysis (unauthenticated endpoints, debug routes, privileged routes)
.venv/bin/refuta surface \
--repo sample/repo \
--out /tmp/refuta-surface
# 4) Full security audit on the local vLLM (Qwen3.6 :8000) + bwrap patch verification
.venv/bin/refuta audit \
--repo sample/repo \
--runner local \
--patches patches/manifest.json \
--out results/qwen
# 5) Evaluate against the independent ground truth (expected.json)
.venv/bin/refuta eval \
--result results/qwen/result.json \
--expected expected.json \
--repo sample/repo
# Offline, no model needed: --runner fixture --fixture fixtures/responses.json
audit exits 0 when the run completes and 2 when some candidates failed (partial); eval exits 1 when the result does not match the ground truth.
5. Security and verification boundaries covered by tests (tests/test_refuta.py)
- Untrusted instruction-file quarantine and credential stripping (
RepoProvider): when a snapshot is created, tokens in.git/configare removed andAGENTS.md,CLAUDE.md,.claude/,.codex/, and.github/copilot-instructions.mdare quarantined automatically. - Loop 1 diff scope (
compute_diff_scope): computes exactly which files were added, modified, or deleted between two snapshots. - Immediate secret masking (
scanners.py):ghp_...,sk-..., andAKIA...values are replaced withREDACTED_SHA256:<12 hex>as soon as they are detected; tests verify that no raw value reaches prompts, SQLite, reports, or SARIF. - External scanner parsers (
parse_semgrep_json,parse_gitleaks_json,parse_osv_scanner_json,parse_syft_cyclonedx_json): normalize Semgrep, Gitleaks, OSV-Scanner, and Syft CycloneDX SBOM output into the standard schema, masking secrets automatically. - Deterministic evidence verifier (
verifier.py): checks that thevulnerable_quotesandguard_quotesthe model cites exist verbatim in the original files, and computes line numbers itself. Missing files, path escapes (../), and altered code quotes are rejected immediately asinvalid_evidence. - Strict refutation: even if the model claims
is_refuted: true, the refutation is rejected (needs_review) unless it presents guard-code quotes (guard_quotes) verified against the snapshot files. - Option D cross-model review (
adjudicate_cross_review): adjudicates agreement and disagreement between the primary analyst and a second refuting reviewer, switching torefutedonly when the refuting side presents a valid guard-code quote. bwrap(bubblewrap) isolated patch and scanner runner (sandbox.py):- Isolates test and scanner processes with
/usr/bin/bwrap(--unshare-all --die-with-parent --new-session --ro-bind / / --tmpfs $HOME --ro-bind <venv> <venv> --ro-bind <base interpreter under $HOME, e.g. uv Python> --tmpfs /tmp --ro-bind <work_repo> /tmp/work --clearenv). - Demonstrated inside the sandbox: (1)
$HOMEis not accessible, (2) the source under/tmp/workcannot be written (Read-only file system), (3) neither the host's127.0.0.1:8000nor external networks are reachable (Network is unreachable). - A finding is promoted to
fixed_verifiedonly when all four conditions hold: (1) test files (tests/) are unmodified, (2) the security test fails before the patch (the vulnerability reproduces), (3) the security test passes after the patch, (4) the functional regression tests pass after the patch. - Execution is blocked when an external binary or model weight does not match its pinned SHA256 digest (
verify_artifact_sha256).
- Isolates test and scanner processes with
- Default deny for sending code off-host, and a memory guard (
RunnerRouter): withlocal_only=True(the default),ClaudeRunnerand externalCodexRunnercalls are blocked; local inference is refused withInsufficientMemoryErrorwhenMemAvailableis below the threshold (min_mem_available_gb, default 8). - Accepted-risk expiry and invalidation on file change (
RefutaStore): anaccepted_riskexception is released and the finding restored toconfirmedwhen the exception expires or the SHA256 of the target file changes. - Continuous security loops and publishing safeguards (
loops.py,publisher.py):- Loop 3 (new-CVE response): queries the deployment/SBOM graph to identify affected services, environments, and runtime images immediately, without any code change.
- Loop 4 (attack-surface reduction): automatically identifies unauthenticated public routes, debug endpoints, and privileged admin paths.
- Loop 6 (post-deploy re-verification): fails while a pre-patch commit is still running in production, and completes only once the patched commit is deployed and passes its health check.
- Quiet-window guard (
QuietWindow,is_in_quiet_window): tells heavy scheduled audits when to yield the host, e.g. to another model server sharing the GPU. Windows are configured by the caller (time zone, start/end, weekdays); the test uses a DGX Spark schedule (Mon/Thu 03:50–09:00 KST, daily 06:50–07:30 KST) as its example. - Publishing safeguards: GitHub webhook HMAC-SHA256 signature verification, blocking publication on a commit SHA mismatch (
StaleCommitPublishError), and automatic redaction of secret tokens in outbound text.
License
Apache License 2.0. Copyright 2026 DAPADA Inc. and Refuta contributors.
Metadata
Release files for refuta 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| refuta-0.0.2.tar.gz | 51.8 kB | Without provenance | Details for refuta-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| refuta-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for refuta-0.0.2-py3-none-any.whl |
Total release size: 96.1 kB
Release files / refuta-0.0.2.tar.gz
| Download URL | refuta-0.0.2.tar.gz |
|---|---|
| Size | 51.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
25a74a38cda174a3f1928570ca00dba1a09e5be28f7a33241eaac7257aae1731
|
|
BLAKE2b-256 checksum How to use checksums |
2f7eab9fb3a9f3bb5c774111b5a5b827c6740e21466f481055f4c89598c76879
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / refuta-0.0.2-py3-none-any.whl
| Download URL | refuta-0.0.2-py3-none-any.whl |
|---|---|
| Size | 44.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
035b1d11011d71bf025318597a88b0ec922397a187f775ebcd9e9b935d56b782
|
|
BLAKE2b-256 checksum How to use checksums |
6e551a48e9255bc684f3b7407504bc385b006a328f634dedeb0f27bbc5c89ea8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for refuta 0.0.2
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.