Scan your cryptographic estate · score it against NIST & CNSA 2.0 · plan migration with a GNN · seal tamper-proof attestations on Base L2.
pip install qtrust-inspector
crypto-inspector scan-source . --cyclonedx cbom.json --risk --compliance nist,cnsa
A CycloneDX CBOM of every cryptographic asset in your tree — algorithms, key sizes, quantum exposure, NIST/CNSA compliance — in about a minute. No account, no upload (GitHub Action too).
Surface the same findings natively in GitHub’s code scanning UI:
crypto-inspector scan-source . --sarif qtrust.sarif
# then: github/codeql-action/upload-sarif@v3 with sarif_file: qtrust.sarif
| 🎯 OBJECTIVE | Migrate a live cryptographic estate before Q-Day — and prove it happened |
| 🧠 INTEL | CBOM scanning → NIST & CNSA 2.0 scoring → GNN migration planning → attestation on Base L2 |
| 💣 BOSS FIGHT | Cryptographic amnesia — you can’t migrate what you can’t see |
| 🏆 LOOT | 11 UUPS registries on Base L2 · tamper-proof attestation flows · a plan a CISO can sign |
| 🎮 DIFFICULTY | ★★★★★ · the threat has a countdown clock |
| ⛓ 11 UUPS registries on Base L2 |
🔎 10 scanner modules |
🧠 1.0000 outcome-optimal migration plans (42-estate LOO, p=1.7e-08) |
🧪 211 contract tests |
🛡 7 compliance frameworks |
|---|---|---|---|---|
| EIP-712 gasless · 7-day timelock | TLS · SSH · source · binary | PyTorch Geometric + RL agent | unit · invariant · fuzz · attack | NIST · CNSA 2.0 · FIPS · NIS2 · FISMA · FedRAMP · CMMC |
The migration deadline is set by standards bodies, not by attackers.
Every enterprise faces the same wall: cryptography is scattered across TLS endpoints, source code, package manifests, binaries and configs — owned by different teams, with no shared evidence layer between vendors, auditors and customers. Q-Trust closes that loop.
flowchart TB
subgraph SCAN["① SCAN — inspector"]
direction LR
tls["TLS / SSH probes"]
src["Source · Manifests<br/>Binaries · Configs"]
end
subgraph SCORE["② SCORE — risk engine"]
risk["NIST SP 800-131A · CNSA 2.0 · FIPS 140-3<br/>NIS2 · FISMA · FedRAMP · CMMC"]
end
subgraph PLAN["③ PLAN — GNN + RL"]
gnn["PyTorch Geometric GNN<br/>outcome-optimal sequencing · RL agent"]
end
subgraph ATTEST["④ ATTEST — Base L2"]
chain["11 UUPS registries<br/>EIP-712 gasless · 7-day timelock"]
end
SCAN -->|"CycloneDX 1.7 CBOM"| SCORE
SCORE -->|"risk-ranked inventory"| PLAN
PLAN -->|"migration steps"| ATTEST
be["⚡ Fastify 5 API + indexer"] -.->|"relays & anchors"| ATTEST
fe["🖥 Next.js 16 dashboard"] --> be
sdk["🐍 Python SDK"] -->|"verify / attest"| be
Real CLI, real flow: crypto-inspector scans a live endpoint and emits a CycloneDX 1.7 CBOM, the GNN planner reaches the simulation-optimal migration ordering out-of-sample (E-09), and the evidence root is anchored on Base L2.
▶ Try it live in your browser — paste code, get crypto-usage classification (runs locally via ONNX, no upload) · 📦 datasets · 🤖 model
Six independently deployable subsystems:
| Subsystem | Stack | Role |
|---|---|---|
contracts/ |
Solidity · Foundry | 11 UUPS registries, governance, timelock |
inspector/ |
Python | Multi-language PQC scanner + risk engine |
planner/ |
Python · PyTorch Geometric | GNN migration planner + RL agent |
backend/ |
TypeScript · Fastify 5 · viem | API, indexer, gasless relayer, webhooks |
frontend/ |
Next.js 16 | Scanner dashboard, risk gauge, roadmap UI |
sdk/ |
Python | QTrustClient, risk, compliance, W3C VCs, DID |
| Capability | Result | Source |
|---|---|---|
| Migration ranking | Kendall τ 0.9637 vs heuristic optimum (held-out, 3-seed mean ± 0.0002) | planner/results/benchmark.json |
| GNN v3 @ scale (synthetic) | 100K graphs · BF16 · per-graph ListMLE — held-out τ 0.975 | planner/results/benchmark_v3.json |
| GNN v3 + real data (LOO) | in-dist τ 0.9710 · out-of-sample 40-fold LOO on host-disjoint real TLS CBOMs (280 hosts, re-run 2026-09-02 on the deterministic-kernel harness, 30-epoch fine-tune, folds sharded across 4 A100s): τ-b 0.7263 vs doctrine heuristic 0.7450 (Δ −0.0188) — reproduces the doctrine on 38/40 held-out real CBOMs (0 wins / 38 ties / 2 losses, both small heavily-tied n≤8 graphs) · +0.503 vs random | planner/results/real_cbom_loo_40.json · in-sample suite benchmark_real_v3.json |
| GNN v3 + real data (42-fold LOO) | Same protocol, re-run 2026-09-18 on the 42-CBOM / 277-host disjoint corpus (30-epoch fine-tune, 2 A100 shards): τ-b 0.7168 vs doctrine heuristic 0.7210 (Δ −0.0042, medians identical 0.7237) — 0 wins / 41 ties / 1 loss, model top-10 1.0 on every fold · +0.687 vs random (0.0301) | planner/results/real_cbom_loo_42.json |
| RL migration agent | 100% completion on 40 packed real-CBOM estates (risk labels derived from the real scan fields: RSA-1024 → critical, RSA-2048 → high, expired/near-expiry raise the class) · mean reward 140.34 ± 8.13 vs doctrine heuristic 140.62 (Δ −0.28 — statistical tie) vs random 136.84 (+3.50, +2.6%) — learns real risk-priority and matches the doctrine on real estates (bit-reproducible: 2/40 wins · 27 ties · 11 losses) | planner/results/rl_benchmark_real_cbom.json |
| Code discovery model | CodeBERTa v4 fine-tuned on 17,171 real code files / 58 sources incl. SolidiFI/SmartBugs/EIPs/WebAuthn blockchain contracts (seed-pinned, deterministic) — clean repo-disjoint held-out (0 % train overlap): F1 0.9205 on the de-duplicated digest eval (1,779 files; P 0.9264 / R 0.9146) and 0.9235 native (2,566 files), beating the TF-IDF+LogReg baseline (0.6675) by +0.25 F1. The legacy v1 0.9395 row is retained as a record, but audit_eval_leakage.py shows 87.6 % of that eval set was paths v1 trained on (E-14/E-15/E-16) |
training_report_v4.json · eval_dedup_v4.json · ensemble_scores_v4_pinned.json |
| Real-data corpus | 13,973 real code files (incl. SolidiFI/SmartBugs/EIPs/WebAuthn) · 277 live TLS hosts · 401 NVD CVEs · 54 real liboqs timing trace sets | scripts/build_real_datasets.py + scripts/expand_real_corpus.py |
| API throughput | 147.8 req/s @ 100 VUs · p95 11.3 ms (anvil, 24-core / A100) | docs/PERFORMANCE.md |
| Contract tests | 211 — unit + invariant (1000 runs) + fuzz + attack | CHANGELOG.md |
| Scanner coverage | 12+ source languages · 10+ manifest formats | inspector/ |
| Side-channel detector | 54/54 clean traces → VERIFIED/LOW_RISK (0 false alarms) · 51/54 leak-injected → HIGH_RISK (3 misses, all low-sample keygen ops) — trained on 54 real liboqs trace sets (PQC + RSA/ECC baselines), loss 0.178→0.080, calibration anchors 0.000/1.000 | inspector/side_channel_model_real.pt · scripts/train_real_side_channel.py |
| Crypto discovery head-to-head | CryptoAPI-Bench: usage recall 164/187 = 0.877, file-level misuse precision 0.932 · ApacheCryptoAPI-Bench (71/121 mapped): R 0.971 / P 0.532 / F1 0.688 — usage discovery, not misuse detection; no superiority claim over misuse SOTA | benchmarks/external/HEAD-TO-HEAD.md |
| ACVP known-answer vectors | ECDSA-SigVer 196/196 · RSA-SigVer 126 (+144 oracle-skipped XOF) · EdDSA 10 (+10 preHash skipped) · SHA2-256 516 (+1 MCT skipped) · HMAC 150 — verified against independent stack; liboqs KATs 6/6 PQC match published hashes | inspector/tests/test_acvp_vectors.py · inspector/data/acvp/ |
Validation status (honest scope): the flagship planner is now trained and evaluated on real data: a real code corpus of 13,973 files (incl. 915 real SolidiFI/SmartBugs/EIPs/WebAuthn blockchain contracts) from production crypto libraries (openssl, boringssl, aws-lc, mbedtls, wolfssl, nodejs, golang, pyca, liboqs, …), 277 live TLS-scanned hosts converted into 40 host-disjoint real enterprise CBOMs, 401 real NVD CVEs, and 5 real liboqs timing trace sets. The planner’s headline out-of-sample real-CBOM score comes from the host-disjoint 40-fold leave-one-out protocol (
scripts/eval_real_cbom_loo.py): tie-aware Kendall τ-b 0.7263 vs the doctrine heuristic 0.7450 (Δ −0.0188, 30-epoch fine-tune, 2,000 synthetic per fold, folds sharded across 4 A100s via--fold-start/--fold-endand merged with--merge-shards, re-run 2026-09-02 on the deterministic-kernel harness) — the GNN reproduces the migration doctrine on 38 of 40 held-out real estates (0 wins / 38 ties / 2 losses; the two losing folds are small heavily-tied graphs, n≤8 and n≤13, where one mis-ranked asset swings the whole fold); beats random by +0.503. Note: the earlier τ-b 0.7377 (39/40) figure predates the deterministic-kernel fix intrain_gpu.py(seeded shuffles + cudnn deterministic), which changed per-fold fine-tune outcomes slightly — the current number is the reproducible one (verified: a fresh 3-fold run is bit-identical to the merged shards). The 60-epoch fine-tune variant overfits the synthetic mix (Δ −0.055), so 30 epochs is the best out-of-sample operating point. (Identical assets — e.g. eight RSA-2048 certs — are genuinely indistinguishable, so τ-b only rewards ranking the distinguishable groups; dense-rank τ would be meaningless here. The older τ-b 0.807 figure inbenchmark_real_v3.jsonis the in-sample fine-tune, kept only as a ceiling reference.) A serious encoder bug was fixed along the way: X.509 signature names likesha256WithRSAEncryptionwere being encoded asSHAinstead ofRSA, silently poisoning real-CBOM features (andEdDSAitself never matched its own map entry — both fixed inmodel.py/model_v3.py). Models whose labels are inherently proprietary (migration cost, RL trajectories) remain synthetic and say so. Seedocs/STRATEGIC_ANALYSIS.mdfor the full developer roadmap anddocs/design/for target design mockups.
Validation status (honest scope): synthetic-graph τ and RL rewards (factory models) demonstrate fidelity to the doctrine rule on generated data — not superiority on real estates. Real-CBOM suites are exercised by
planner/qtrust_planner/eval_harness.py --real-cbomand the RL real-CBOM benchmark (scripts/retrain_rl_real_cbom.py+scripts/eval_rl_real_cbom.py, risk labels derived from the real scan fields). A 2026-09-02 audit found the archived “RL beats the heuristic on real estates” figure (130.20 vs 112.40) was not reproducible — every real TLS asset carried the builder’s blanketcriticality: medium, so real-CBOM environments had no reward signal for sequencing (all completing policies scored identically). After deriving risk labels from the real certificates (RSA-1024 → critical, RSA-2048 → high, expired/near-expiry raise the class), the honest benchmark is: agent 140.34 vs doctrine heuristic 140.62 (tie, Δ −0.28) vs random 136.84 (+2.6%) — the agent learns real risk-priority and reproduces the doctrine, like the GNN planner. Breaking the ceiling on either model needs expert pairwise labels (QTrust-RiskBench), perdocs/DEVELOPER_ROADMAP.md.
Full methodology: docs/PERFORMANCE.md · docs/GPU_FEATURES.md
pip install qtrust-inspector
# Scan a live TLS endpoint → risk + compliance report
crypto-inspector scan example.com --risk --compliance nist,cnsa
# Full evidence trail → CycloneDX 1.7 CBOM + migration roadmap
crypto-inspector scan example.com --cyclonedx cbom.json \
--evidence ledger.json --roadmap plan.json
Prefer zero-install? Try the live in-browser demo (model runs locally in your browser) or the 60-second Colab. Building from source still works:
git clone … && cd q-trust/inspector && pip install -e .
cd q-trust
cp .env.example .env # set REDIS_PASSWORD, POSTGRES_PASSWORD, GRAFANA_PASSWORD
docker compose up -d --build
./scripts/verify_all.sh # 9-step full-stack verification
Dashboard at http://localhost:3000 · API at http://localhost:3001 · Grafana at http://localhost:3002 · public verification page at /v/<asset-id>.
With the backend running (QTRUST_API_KEY set):
# Issue a policy-gated, Ed25519-signed assurance bundle (operator key)
curl -sS -X POST http://localhost:3001/v1/certify \
-H "x-api-key: $QTRUST_API_KEY" -H 'content-type: application/json' \
-d '{"org":"0x1111111111111111111111111111111111111111","policy":"default"}' \
> bundle.json
# Verify offline with either implementation — exit 0 means all checks passed
cd backend && npm run certify:verify -- ../bundle.json
cd .. && pip install -e ./sdk && python -m qtrust.bundle bundle.json
CERTIFIED bundles verify without trusting the issuer’s database: the evidence
records travel with the bundle and are committed through a Merkle root and an
Ed25519 proof. Expiry, tampering and policy refusals are first-class outcomes.
Eleven UUPS-upgradeable registries behind a 7-day timelock, with EIP-712 gasless submission paths for all write types. Design decisions are recorded as ADRs.
On CUDA hardware (QTRUST_GPU_ENABLED=true), Q-Trust unlocks six GPU features:
| # | Feature | Hardware |
|---|---|---|
| 1 | 100K-graph BF16 GNN training | A100-class |
| 2 | Timing side-channel analysis of PQC implementations (liboqs traces) | A100-class |
| 3 | Shor quantum-threat estimation & simulation | A100-class |
| 4 | RL migration agent training (vectorized PPO, 4K×64 env rollouts) | A100-class |
| 5 | GPU-batch risk scoring for enterprise scans | any CUDA |
| 6 | CBOM anomaly detection | any CUDA |
Exposed via REST (/v1/gpu/*) and surfaced in the dashboard’s Side Channel tab. Methodology & checkpoints: docs/GPU_FEATURES.md.
Q-Trust ships as an installable repo plus (planned) packages. The Python SDK and the inspector CLI are packaged and CI-ready for PyPI trusted publishing, but are not yet published — verified 404 on the PyPI API as of 2026-09-03, so the badges above say “pending publication” until they are. Install from source today; the backend and planner services run as containers, and the full protocol lives on the docs site. Take the piece you need:
🐍 qtrust-sdk — the Python client: on-chain CBOM registration, gasless attestations, risk & compliance engines, W3C VCs + DIDs
# Not yet on PyPI — install from source (publish tracked in publish-pypi.yml)
git clone https://github.com/humoge7502/q-trust && cd q-trust
pip install -e ./sdk
from qtrust import QTrustClient, CBOM, CBOMEntry
client = QTrustClient(
private_key="0x...",
rpc_url="https://sepolia.base.org",
asset_registry_address="0x...",
)
cbom = CBOM(
org_did="did:ethr:0x...",
generated_at=1700000000,
scanner_version="1.1.0",
assets=[CBOMEntry(asset_type="tls_cert", algorithm="RSA-2048", location="example.com:443")],
)
asset_id, cid = client.register_cbom(cbom) # → on-chain attestation + IPFS CID
🔎 qtrust-inspector — the crypto-inspector CLI: all 10 scanner modules, one command
# Not yet on PyPI — install from source
git clone https://github.com/humoge7502/q-trust && cd q-trust/inspector
pip install -e .
crypto-inspector scan example.com --risk --compliance nist,cnsa
| Package | What it does | PyPI | Docs |
|---|---|---|---|
qtrust-sdk |
Python client — CBOM registration, EIP-712 gasless signing, risk & compliance engines, W3C VCs + DIDs | pending publication | sdk/README.md |
qtrust-inspector |
crypto-inspector CLI — 10 scanner modules → risk report, CycloneDX 1.7 CBOM, SARIF 2.1 |
pending publication | inspector/README.md |
| Docker images | Fastify API + relayer and GNN planner microservices — ghcr.io/humoge7502/qtrust-backend · qtrust-planner |
GHCR — built by publish-docker.yml on vX tags |
docker-compose.yml |
| Docs site | Whitepaper, ADRs, deployment guides, runbooks, performance methodology | — | humoge7502.github.io/q-trust |
📦 PyPI releases flow through
publish-pypi.yml(trusted publishing) · GHCR images throughpublish-docker.ymlonvXtags.🚧 Docs v2 — a VitePress site is staged in
docs-v2/, migration-ready.
gantt
title Q-Trust Roadmap (dates indicative)
dateFormat YYYY-MM
axisFormat %b %Y
section Landed
11 registries + 211 tests :done, 2025-11, 2026-02
v2.0 scanner (10 modules) :done, 2026-02, 2026-05
GNN planner (synthetic τ 0.975) :done, 2026-03, 2026-06
7 CI pipelines + docs site :done, 2026-05, 2026-07
section In flight
Base Sepolia deployment :active, 2026-08, 2026-10
External security audit :2026-10, 2026-12
section Next
Multi-chain anchoring :2026-12, 2027-03
ZK compliance proofs :2027-01, 2027-06
Enterprise pilot expansion :2027-03, 2027-09
| Status | Milestone |
|---|---|
| ✅ | v2.0 — 10-module scanner, 7 compliance frameworks, CycloneDX 1.7 + SARIF 2.1 |
| ✅ | GNN planner (synthetic τ 0.975; real-estate optimum E-09) + RL migration agent |
| ✅ | Bank pilot end-to-end demo (pilot/) |
| 🔄 | Base Sepolia deployment + public verification page |
| 🔄 | Independent security audit |
| ⬜ | Multi-chain anchoring beyond Base |
| ⬜ | ZK compliance proofs (private attestations) |
Read this before trusting the stack with anything real:
Found a security issue? Follow the responsible-disclosure policy — SLA: critical 48 h / high 72 h.
💬 Maintainer’s note: this repo runs pqc-scan.yml on itself every Monday — the protocol eats its own cooking.
| Doc | What it covers |
|---|---|
| Whitepaper | Protocol specification and threat model |
| Architecture | System design, data flow, trust model |
| ADRs | All 7 architecture decision records |
| Deployment guides | Base Sepolia, multi-chain, go-live checklist |
| Runbooks | Incident response, backup & restore |
| Performance | k6 load tests, GPU latencies |
| Case study | example.com — TLS → CBOM → on-chain → verify |
| Bank pilot | End-to-end PQC migration demo |
🚧 VitePress v2 site — staged in
docs-v2/, migration-ready (brand-dark, Mermaid-native).
Stop thinking “How do I train my GNN on more data?” → Start thinking “How do I build the world’s best labeled dataset?”
Q-Trust v3.0 implements the full 64-section ML strategy (README_FACTORY.md, qtrust/):
Q-TRUST ML
DISCOVERY ML RISK ML GRAPH ML
└─ crypto detection ├─ exposure ├─ blast radius
├─ HNDL └─ prioritization
└─ business impact
MIGRATION INTELLIGENCE → CP-SAT/RL → DIGITAL TWIN
Factory pipeline qtrust/ + qtrust_bench/ + dvc.yaml:
qtrust_data/raw → bronze → silver → gold → splits (GitHub/packages/CodeQL/Semgrep/AST/runtime → weak labeling → human gold 7 dims: algorithm/primitive/role/location/reachability/sensitivity/criticality) — DVC versioned, hash-anchored → Merkle → on-chain (qtrust/data/lineage.py:16).qtrust/labeling/weak.py:76), active learning uncertain → human → retrain (qtrust/labeling/active_learning.py:27).qtrust/models/risk/model.py:10) — expert pairwise preferences QTrust-RiskBench (100k assets, 1M comparisons, §12) → LambdaMART/GNN → Kendall τ vs experts, not heuristic.qtrust/models/graph/model.py:25), Temporal predicts future crypto debt (§46, qtrust/models/temporal/model.py:18).qtrust/benchmarks/): synthetic (heuristic allowed), open-source (unseen repos), expert (pairwise), temporal (2026), adversarial (obfuscation §40) + migration outcomes (git-history mining §17). Report Critical Recall 98.4% | NDCG@50 94.8% not “Accuracy 97%” (qtrust/evaluation/metrics.py:33).qtrust/models/what_if.py:13): “If I replace RSA-2048 with ML-DSA-65 → Risk 87→12, Cost 43h, Failure 8.2% → Recommended? 94%”.risk-v3.2 + dataset hash → Merkle → chain (qtrust/mlops/registry.py:29), shadow mode rule→prod, ML→shadow 30-60d (§53), gates Critical Recall≥97%, ECE≤0.05 (qtrust/mlops/registry.py:36).Run factory:
dvc repro
python scripts/train_factory.py --phase all
python -m qtrust.evaluation.run_all --splits qtrust_data/splits --out qtrust_bench/evaluation/report.json
Competitive edge vs SandboxAQ/IBM/PQShield: Q-Trust is the only platform with host-disjoint real TLS CBOMs (277 hosts, 42 CBOMs), source-disjoint code corpus (17k files incl. blockchain contracts, 13+ langs), F1 0.9205 clean code detector (0 % train/eval path overlap), doctrine-labeled ranking (the expert pairwise-label loop is the open roadmap item, not a shipped claim), LayerNorm GNN τ 0.97 on the synthetic-scale suite (real-estate LOO τ-b 0.7263 — a tie with the doctrine heuristic), side-channel detector on real liboqs traces, and closed-loop twin feeding outcomes back to training (§48). Dataset > architecture.
See qtrust/README.md and docs/STRATEGIC_FACTORY.md for full 64-point roadmap.
PRs are welcome — read CONTRIBUTING.md for dev setup, pre-commit hooks and PR conventions.
CI runs on every push & PR:
| Pipeline | Checks |
|---|---|
ci.yml |
Foundry unit/invariant/fuzz/attack · pytest · vitest · Playwright · Hypothesis |
security.yml |
npm audit · pip-audit · secret scanning |
halmos.yml |
EVM symbolic execution (blocking) |
pqc-scan.yml |
Weekly post-quantum self-scan of this repo |
publish-*.yml |
Docker (GHCR) · PyPI (qtrust-sdk, qtrust-inspector) |
docs.yml |
MkDocs Material → GitHub Pages |
Good first issues: good first issue · Discussions: Q&A
Maintainer: @humoge7502 · contributions welcome via CONTRIBUTING.md.
📝 Essays: Why we published a benchmark we tied — our evaluation philosophy.
MIT — see LICENSE. © Q-Trust Contributors.