Skip to main content

SecAudit Kit — self-running, provider-agnostic core

The Claude Code plugin (in ../plugins/secaudit) drives an audit inside a Claude Code session. This kit/ is the standalone counterpart: a dependency-free Python CLI that runs on its own — in CI, cron, or a shell — and is not tied to Claude.

It is built in two tiers:

Tier Needs an LLM? What it does
0 — deterministic core No Built-in regex detector pack + npm audit (and any installed scanner). Always runs, always produces a report. Reproducible.
1 — enrichment (optional) Yes, any provider An LLM triages each Tier-0 finding (confirm/refute/adjust severity) and surfaces logic bugs the pattern scan can't (e.g. IDOR). Backend is pluggable: anthropic (Claude, best default), openai, ollama (local, no key, code never leaves the host), or none.

Claude remains the highest-quality default — but it is optional, not required.

Install

Zero runtime dependencies (standard library only). Run it in place, or install the secaudit console command:

pip install ./kit          # or: pipx install ./kit   (from the repo root)
secaudit /path/to/repo --min high

No install needed either — python -m secaudit_core.cli … works straight from kit/.

Usage

# Pure Tier 0 — no LLM, no API key, runs anywhere:
python -m secaudit_core.cli /path/to/repo

# Gate a CI build (non-zero exit if any High+ finding):
python -m secaudit_core.cli /path/to/repo --min high

# JSON for pipelines; write to a file:
python -m secaudit_core.cli /path/to/repo --format json -o report.json

# Add LLM enrichment (triage + logic-bug discovery). Provider-agnostic:
ANTHROPIC_API_KEY=…  python -m secaudit_core.cli /path/to/repo --backend anthropic
OPENAI_API_KEY=…     python -m secaudit_core.cli /path/to/repo --backend openai
                     python -m secaudit_core.cli /path/to/repo --backend ollama   # local model

--backend, --format {md,json,sarif}, --min {low,medium,high,critical}, --no-deps, -o FILE. Pick the model with SECAUDIT_MODEL (default claude-opus-5 / gpt-4o / qwen2.5-coder).

What the deterministic tier actually catches — measured, not claimed

tests/test_engine.py runs the Tier-0 engine (no LLM, no external tools) against the two shipped corpora and prints reproducible numbers:

recall (vulnerable-app):  19/19 deterministic classes  (19/20 of all 20; V3/IDOR is LLM-tier by design)
precision (secure-app):   0 HIGH-confidence false positives  ·  0 medium leads
classes reserved for the LLM tier: ['V3']
  • Recall — the pack finds 19 of the 20 planted sink classes. The one it does not is V3 (IDOR / missing authorization): a logic flaw with no reliable static signature. That gap is the concrete argument for Tier 1 — it is exactly what an LLM backend adds.
  • Precision — zero HIGH-confidence findings on the safe negative control, because each detector clears itself when the corresponding control is present (suppress_if).

Real-code precision (not fixture-tuned): tests/test_dogfood.py runs the engine on the kit's own ~1.5k-line production source — real code, nothing planted — and requires 0 High/Critical findings. This is a false-positive check against genuine code, the honest complement to the fixture numbers.

Live two-tier proof: tests/test_enrich_e2e.py runs the whole pipeline (Tier-0 scan → LLM triage → report) in CI using a replayed model response (no key), asserting the LLM tier adds the IDOR/V3 finding Tier-0 can't reach. tests/test_live_llm.py runs the same against a real provider when ANTHROPIC_API_KEY / OPENAI_API_KEY is set or Ollama is up, and skips cleanly otherwise — so you can validate the live path yourself.

Honest bound: the built-in detectors are regex, tuned against the shipped fixtures; on arbitrary real code recall is lower (precision holds up better — see the dogfood test). This tier is the reproducible floor, not a guarantee. Installed scanners (semgrep/osv/gitleaks) and the LLM tier raise the ceiling. The 115 built-in detectors span JS/TS, Python, Go, Java, PHP, Ruby, C#, Kotlin, Swift, Dart, Dockerfile, Terraform, Kubernetes, and secret patterns — including 2025–2026 classes: AI/agent sinks (LangChain allow_dangerous_*, exposed Python-REPL/ shell tools, model output into eval/exec), modern token secrets (Anthropic sk-ant-, GitHub fine-grained PATs, Hugging Face, npm), and software-supply-chain / CI (mutable-branch GitHub Action pins — the tj-actions CVE-2025-30066 class — and curl | sh install piping).

CI & GitHub code scanning

Emit SARIF and upload it so findings land in the repo's Security → Code scanning tab:

python -m secaudit_core.cli . --format sarif -o secaudit.sarif

A ready-made composite GitHub Action is bundled (action.yml) — it runs the scan, writes SARIF, and optionally gates the build on severity. A copy-paste workflow is in examples/github-workflow.yml:

- uses: mtvrkan/secaudit/kit@main      # pin to a release SHA in production
  with: { path: '.', min-severity: 'high' }
- uses: github/codeql-action/upload-sarif@v3
  with: { sarif_file: secaudit.sarif }

A sample Tier-0 report is committed at examples/example-report.md (secrets redacted — the kit never prints secret values).

Architecture

secaudit_core/
  schema.py      Finding / Severity / Confidence / Verdict / ScanResult
  detectors.py   built-in deterministic detector pack (regex + suppress_if controls)
  engine.py      walk target → run detectors + npm audit → dedupe → ScanResult
  backends.py    Backend ABC · NoneBackend · Anthropic/OpenAI/Ollama (urllib, no SDK)
  report.py      Markdown / JSON renderer
  cli.py         argparse entry point + CI gate exit code
tests/
  test_engine.py recall/precision measurement on the two corpora (CI-gated, LLM-free)

Adding a detector = one entry in detectors.py (id, CWE/OWASP, severity, confidence, regex, optional suppress_if, fix). Adding a backend = subclass Backend (or _HTTPBackend) and register it in get_backend. The LLM backends are wired end-to-end but are not exercised in CI (no keys / no local model there); the none path is fully tested.

Metadata

Release files for secaudit-kit 1.0.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 secaudit-kit 1.0.0
File Size Uploaded Provenance Actions
secaudit_kit-1.0.0.tar.gz 398.3 kB With provenance Details for secaudit_kit-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for secaudit-kit 1.0.0
File Interpreter ABI Platform Actions
secaudit_kit-1.0.0-py3-none-any.whl Python 3 none any Details for secaudit_kit-1.0.0-py3-none-any.whl

Total release size: 701.7 kB

Release files / secaudit_kit-1.0.0.tar.gz

Download URL secaudit_kit-1.0.0.tar.gz
Size 398.3 kB
Tags Source
SHA-256 checksum
How to use checksums
af7a6049c6e1e5bec054e8974e15cb50ba45a2e541fb6b71520ad61762fd7ca6
BLAKE2b-256 checksum
How to use checksums
d1e9990fb9a3ccd05938c74089cb7fcd30d6ad107499d46a17e8b730aa8a2b11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Release files / secaudit_kit-1.0.0-py3-none-any.whl

Download URL secaudit_kit-1.0.0-py3-none-any.whl
Size 303.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
85e16c0c26684939e061bc5b5e11a06ee9668ae13387f48c8ba93ef654df38e8
BLAKE2b-256 checksum
How to use checksums
94877c4f9a2d413d62f43d754912d12b1873aea2bab4452ee4a418b427954d63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Security for secaudit-kit 1.0.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for secaudit_kit-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

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