The AI security knowledge base.
Give an agent a codebase — get the checks that matter.
secure-kb merges 67 tracked sources into 2,052 atomic check cards (from 15 repositories + 5 official-doc sources). Each card traces to a real file, anchor and commit — so an agent can go from “I have this codebase” to “here are the 15–25 checks that matter” in seconds.
What it is — and what it is not
A knowledge base of security checks, packaged for retrieval by AI agents. It contains no running service and executes nothing against your code.
A retrieval layer
Distilled, normalised, atomic cards with provenance, a router, a fast gate, and a SQLite FTS5 index.
A merged corpus
OWASP ASVS 5.0, MASVS/MASTG, WSTG, Top 10, API Top 10, LLM Top 10, 137 cheat sheets, web3, IoT and more.
A scanner
It tells an agent what to verify. Tool adapters describe how to call scanners; they don’t run them for you.
A substitute for an audit
It does not replace a professional security review. Card text is defensive guidance, never exploit payloads.
Install in 60 seconds
Zero required dependencies — standard-library Python only. index/ and kb.sqlite build themselves on first use.
git clone https://github.com/pavnxet/ai-security-knowledge-base.git
cd ai-security-knowledge-base
python3 cli/secure_kb.py detect /path/to/your/project
python3 cli/secure_kb.py profile web --gate fast --format brief
python3 cli/secure_kb.py search "how do I stop sql injection" --k 5
python3 cli/secure_kb.py get SKB-ASVS-V1-2-4 --format md
The five-step agent workflow
Detect → profile → fast gate → drill down → report.
Fingerprint files and signals to rank platforms: web, api, mobile, telegram, cloud, web3, llm, vibe, browser-ext, desktop.
Each platform maps to an ordered gate. Multiple profiles merge (e.g. Cloudflare Worker + Telegram bot + LLM).
The top checks by priority, domain-balanced, in a tiny token budget.
Fetch one card by id with get, or resolve by CWE / ASVS / MASVS / OWASP ref.
Record pass / fail / n-a / unknown with evidence; no “pass” without evidence.
Coverage
Cards by platform. Every declared platform has cards; no platform is empty.
| Platform | Source examples | Status |
|---|---|---|
| Web / API | ASVS, WSTG, Top 10, API Top 10, Cheat Sheets | covered |
| Mobile (Android / iOS) | MASVS, MASTG | covered |
| LLM / AI apps | OWASP LLM Top 10, RAG & prompt-injection cheat sheets | covered |
| Cloud / DevOps / IoT | OWASP ISTG, Docker, Kubernetes, CI/CD cheat sheets | covered |
| Smart contracts | kadenzipfel, crytic | covered |
| Vibe-coded apps | vibe-security-skill, secure-coding-baseline | covered |
| Telegram bots / browser-ext / desktop | Authored cards (official-doc verified) | authored |
Measured benchmarks — reported honestly
Held-out sets, frozen. Lower numbers are shown as they are; this is a beta.
| Set | n | recall@5 | Target | Status |
|---|---|---|---|---|
| Held-out (all) | 154 | 0.70 | ≥ 0.70 | below |
| Curated v1 | 59 | 0.25 | — | reference |
| Curated v2 (standards-derived) | 59 | 0.48 | ≥ 0.60 | below |
| v2_dev (developer vocabulary) | 40 | 0.53 | ≥ 0.60 | below |
| Templated | 95 | 0.92 | ≥ 0.90 | met |
| Lab coverage (strict) | 30 | 73.3% | — | partial |
| Fast-gate recall (strict) | 30 | 46.7% | ≥ 0.70 | below |
Verifiable Security Attestation
An agent's "I checked it and it's fine" is normally unfalsifiable prose. Here it's a signed, offline-verifiable proof of what was checked, against which KB build, on which exact code.
Bound to the code
A SHA-256 fingerprint over the target's sorted file hashes. Change one byte and verification fails.
Bound to the KB
The attestation carries the KB's deterministic content_hash, so two claims are only comparable on the same corpus.
Tamper-evident
attestation_id = SHA-256(canonical(payload)), optionally HMAC-signed. Any edit breaks it.
Offline & stdlib-only
Verify with no network and no trust in the agent: secure-kb verify-attestation → VALID / INVALID.
secure-kb attest ./my-app --gate fast --key "$KEY" --out attestation.json
secure-kb verify-attestation attestation.json --key "$KEY" --path ./my-app
# -> {"status":"VALID","kb_match":true,"checks":25} exit 0
Known limitations
Stated plainly, so you can judge fit.
Retrieval below target
Free-text paraphrase recall is the weakest area. Corpus growth added distractors; dedupe and re-rank experiments did not recover it.
First-call index build
Building kb.sqlite on first use takes ~19s on a cold checkout; later queries are sub-second.
Not-yet-implemented
kind: check/guidance, deterministic fix_refs, official-source CWE enrichment, and real-lab end-to-end runs.
Unverified items
8 of 12 tool adapters; the Telegram secret_token claim; two project-declared licences.
License & attribution
Content — CC BY-SA 4.0
Derived largely from OWASP material; attribution and ShareAlike preserved. Sources that are unlicensed or reference-only are not redistributed.
Code — MIT
The CLI, MCP server and build scripts. No GPL/AGPL tool code is vendored.