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 intoeval/exec), modern token secrets (Anthropicsk-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 — andcurl | shinstall 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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file secaudit_kit-1.0.0.tar.gz.
File metadata
- Download URL: secaudit_kit-1.0.0.tar.gz
- Upload date:
- Size: 398.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af7a6049c6e1e5bec054e8974e15cb50ba45a2e541fb6b71520ad61762fd7ca6
|
|
| MD5 |
a6689792d6b13bc1faf27550cf93613f
|
|
| BLAKE2b-256 |
d1e9990fb9a3ccd05938c74089cb7fcd30d6ad107499d46a17e8b730aa8a2b11
|
Provenance
The following attestation bundles were made for secaudit_kit-1.0.0.tar.gz:
Publisher:
release.yml on mtvrkan/secaudit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
secaudit_kit-1.0.0.tar.gz -
Subject digest:
af7a6049c6e1e5bec054e8974e15cb50ba45a2e541fb6b71520ad61762fd7ca6 - Sigstore transparency entry: 2538365771
- Sigstore integration time:
-
Permalink:
mtvrkan/secaudit@fc3ebe541550c348bbd59f17f601baffd253f080 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/mtvrkan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fc3ebe541550c348bbd59f17f601baffd253f080 -
Trigger Event:
push
-
Statement type:
File details
Details for the file secaudit_kit-1.0.0-py3-none-any.whl.
File metadata
- Download URL: secaudit_kit-1.0.0-py3-none-any.whl
- Upload date:
- Size: 303.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85e16c0c26684939e061bc5b5e11a06ee9668ae13387f48c8ba93ef654df38e8
|
|
| MD5 |
91c7524bd4e7990a33f6f864a9302520
|
|
| BLAKE2b-256 |
94877c4f9a2d413d62f43d754912d12b1873aea2bab4452ee4a418b427954d63
|
Provenance
The following attestation bundles were made for secaudit_kit-1.0.0-py3-none-any.whl:
Publisher:
release.yml on mtvrkan/secaudit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
secaudit_kit-1.0.0-py3-none-any.whl -
Subject digest:
85e16c0c26684939e061bc5b5e11a06ee9668ae13387f48c8ba93ef654df38e8 - Sigstore transparency entry: 2538365918
- Sigstore integration time:
-
Permalink:
mtvrkan/secaudit@fc3ebe541550c348bbd59f17f601baffd253f080 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/mtvrkan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fc3ebe541550c348bbd59f17f601baffd253f080 -
Trigger Event:
push
-
Statement type: