One Scan. Twenty Regulations.
Two complementary tools: ckb audit scores file-level risk across 8 weighted factors. ckb audit compliance maps your code against 20 regulatory frameworks with 131 checks, cross-framework mapping, and --recommend to auto-detect what applies. Fully local, zero tokens, deterministic results.
Risk Audit — 8-Factor File Scoring
ckb audit evaluates every file on a 0-100 risk scale using 8 weighted factors. The result: a prioritized list of your riskiest files with actionable recommendations.
Complexity is calculated via tree-sitter AST analysis — cyclomatic and cognitive complexity per function across Go, TypeScript, Python, Java, Kotlin, Rust, Ruby, and C/C++.
| Factor | Weight | Score Range | What It Measures |
|---|---|---|---|
| Complexity | 20% | 0-20 | Cyclomatic + cognitive complexity via tree-sitter AST analysis |
| Test Coverage | 20% | 0-20 | No tests for high-complexity code = maximum risk |
| Bus Factor | 15% | 0-15 | 1 active author in 12 months = single point of failure |
| Security Sensitive | 15% | 0-15 | 19 security keywords (password, token, key, jwt, etc.) |
| Staleness | 10% | 0-10 | Months since last change — stale code may be dead or brittle |
| Error Rate | 10% | 0-10 | Runtime error frequency (requires telemetry integration) |
| Co-Change Coupling | 5% | 0-5 | Files that always change together indicate hidden dependencies |
| Churn | 5% | 0-5 | High commit frequency in 90 days may indicate design instability |
Score ≥ 80 — immediate action required
Score ≥ 60 — address soon
Score ≥ 40 — monitor, improve when possible
Score < 40 — acceptable risk
{
"items": [
{
"file": "drivers/modbus/handler.go",
"riskScore": 78.5,
"riskLevel": "high",
"recommendation": "Security-sensitive code; review before changes",
"factors": [
{ "factor": "security_sensitive", "value": "password, token, key", "contribution": 15.0 },
{ "factor": "bus_factor", "value": "1 (alice only)", "contribution": 15.0 },
{ "factor": "complexity", "value": "42", "contribution": 8.4 },
{ "factor": "test_coverage", "value": "no tests found", "contribution": 15.0 }
],
"functionComplexity": [
{ "name": "handleModbusWrite", "cyclomatic": 18, "cognitive": 12, "lines": 86 },
{ "name": "parseRegisterMap", "cyclomatic": 14, "cognitive": 9, "lines": 65 }
]
}
],
"quickWins": [
{ "action": "Add tests", "target": "drivers/modbus/handler.go", "effort": "medium", "impact": "high" },
{ "action": "Assign backup owner", "target": "protocol/iec104/stack.go", "effort": "low", "impact": "medium" }
]
}Use --quick-wins to surface files where low effort yields high impact — like adding tests to untested complex code or assigning a backup owner to single-author files.
131 Checks Across 8 Categories
Every check references the specific regulatory article, includes a CWE ID where applicable, a confidence score, and an actionable recommendation.
21
Privacy & Data Protection
GDPR, CCPA, ISO 27701
8
AI Governance
EU AI Act
33
Security Standards
ISO 27001, NIST 800-53, OWASP ASVS, SOC 2
28
Industry Regulations
PCI DSS, HIPAA, DORA, NIS2, FDA 21 CFR 11
6
EU Product Regulations
EU CRA
5
Supply Chain
SBOM/SLSA
17
Safety-Critical
DO-178C, IEC 61508, ISO 26262
14
Coding Standards
MISRA C, IEC 62443
20 Regulatory Frameworks
Every finding is automatically mapped to the regulations it violates. No manual tagging, no external databases.
| Framework | Scope | Checks | What CKB Checks |
|---|---|---|---|
| GDPR | Data privacy (EU) | 11 | PII handling, consent, data retention, right-to-erasure, encryption |
| CCPA | Consumer privacy (CA) | 5 | Do-not-sell opt-out, data sharing, sensitive PI, deletion rights |
| ISO 27701 | Privacy extension | 5 | Data subject rights, privacy processing, data portability |
| EU AI Act | AI governance (EU) | 8 | Human oversight, logging, risk classification, bias testing |
| ISO 27001 | Information security | 8 | Cryptography, secure development, config management, data leakage |
| NIST 800-53 | Security controls (US) | 6 | Access control, audit logging, input validation, crypto |
| OWASP ASVS | App security verification | 13 | Authentication, session mgmt, validation, crypto, communications |
| SOC 2 | Service organizations | 6 | Access control, change management, monitoring, error handling |
| PCI DSS | Payment card data | 6 | PAN detection, secure coding, authentication, SQL injection |
| HIPAA | Healthcare (US) | 5 | PHI detection, access control, audit trails, encryption |
| DORA | Financial services (EU) | 7 | Change management, anomaly detection, resilience testing |
| NIS2 | Critical infrastructure (EU) | 5 | Supply chain security, vulnerability management, crypto |
| FDA 21 CFR 11 | Electronic records (US) | 5 | Audit trails, electronic signatures, validation |
| EU CRA | Cyber resilience (EU) | 6 | Vulnerability handling, SBOM, secure defaults |
| SBOM/SLSA | Supply chain | 5 | SBOM generation, provenance attestation, dependency pinning |
| DO-178C | Aviation software | 5 | Requirements traceability, structural coverage, dead code |
| IEC 61508 | Functional safety | 7 | SIL classification, defensive programming, complexity limits |
| ISO 26262 | Automotive safety | 5 | ASIL checks, defensive programming, coding standards |
| MISRA C | Safety-critical C/C++ | 7 | Control flow, type safety, memory safety rules |
| IEC 62443 | Industrial automation | 7 | Authentication, integrity verification, secure development |
Auto-Detect Applicable Frameworks
ckb audit compliance --recommend scans your codebase for indicators — HTTP handlers, PII fields, payment SDKs, ML imports — and recommends frameworks with confidence scores.
Always recommended (universally applicable): ISO 27001 (0.95 confidence), OWASP ASVS (0.90 confidence).
| Signal in Code | Recommended Frameworks | Confidence |
|---|---|---|
| HTTP handlers (REST/gRPC) | NIST 800-53, SOC 2 | 0.85 |
| PII fields (email, name, address) | GDPR, CCPA, ISO 27701 | 0.85 |
| Payment processing | PCI DSS 4.0 | 0.90 |
| Health data / PHI fields | HIPAA | 0.85 |
| Financial services code | DORA | 0.80 |
| AI/ML imports & model handling | EU AI Act | 0.85 |
| C/C++ codebase | IEC 61508, MISRA C | 0.75 |
| Dependency manifests | SBOM/SLSA | 0.70 |
| Infrastructure / network services | NIS2 | 0.75 |
Cross-Framework Mapping
A single finding can violate multiple regulations simultaneously. CKB maps each finding to every applicable framework — one scan replaces separate audits. A hardcoded credential triggers findings in 9 frameworks at once.
Hardcoded credential detected (CWE-798)
Req 8.6.2 PCI DSS 4.0
IA-5(1) — Authenticator management
CC6.1 — Logical access security
A.8.4 — Secret authentication management
V2.10.4 — Credential storage
Art. 21(2)(g) — Cryptographic controls
Art. 9(2) — ICT change management
Art. 13 — Product security
CR 1.1 — Access control
PII in log statements (CWE-532)
Art. 25, 32 — Data protection by design
§1798.100 — Consumer rights
§164.312(b) — Audit controls
A.8.12 — Data leakage prevention
A.7.4.5 — PII processing
V7.1.1 — Logging
Art. 21(2)(g) — Information handling
Weak cryptographic algorithm MD5 (CWE-327)
A.8.24 — Cryptographic controls
SC-13 — Cryptographic protection
Req 4.2.1 — Strong cryptography
V6.2.5 — Algorithm verification
Art. 32 — Security of processing
§164.312(a)(2)(iv) — Encryption
§11.10(a) — System controls
Top cross-framework findings by regulation count
From 11,356 to ~50 Findings
In v8.3 we rewrote the false-positive filtering for the compliance engine. Confidence scoring, context-aware analysis, and AST-based checks replaced naive pattern matching.
What changed
False-positive prevention
Scoring & Verdicts
Each framework is scored individually, then aggregated into a total compliance score. CI mode returns exit codes so you can gate deployments on compliance.
PASS
Score ≥ 90 and zero errors
CI exit code: 0
WARN
Score ≥ 70 and ≤ 3 errors
CI exit code: 0 (configurable)
FAIL
Score < 70 or > 3 errors
CI exit code: 1
Per-framework score: (passed checks / total checks) × 100. Use --fail-on=error|warning|none to set the severity gate.
How CKB Compares
Most tools check for vulnerabilities. CKB maps findings to the regulatory language auditors actually ask about.
| Feature | CKB | Snyk | SonarQube | Semgrep |
|---|---|---|---|---|
| Regulatory frameworks | 20 frameworks, 131 checks | 3-5 | 5-8 | 10-12 |
| Cross-framework mapping | Automatic | Manual | Manual | Partial |
| Risk scoring (8-factor) | Yes — complexity, bus factor, churn, etc. | No | Partial | No |
| Structural code analysis | Full (SCIP + tree-sitter + call graph) | Pattern matching | AST-based | Pattern matching |
| One finding, many regs | Yes — up to 9 frameworks per finding | No | No | Partial |
| PII detection patterns | 110+ (incl. German variants) | Limited | No | Limited |
| CI/CD integration | Native (SARIF, JSON, markdown, compliance) | Native | Native | Native |
| Runs locally (no cloud) | Yes — zero tokens | No | Server required | Yes |
| False-positive rate | ~50 findings (tuned in v8.3) | High | Moderate | Moderate |
| Cost | Free (personal) | Freemium | Freemium | Freemium |
CI/CD Integration
Gate pull requests on compliance. Output as SARIF for GitHub Code Scanning, or markdown for PR comments. Weekly risk audits via cron to catch drift.
name: Compliance Audit
on:
pull_request:
types: [opened, synchronize, reopened]
env:
FRAMEWORKS: "iec62443,iso27001,owasp-asvs"
FAIL_ON: "error"
jobs:
compliance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install CKB
run: npm install -g @tastehub/ckb
- name: Initialize CKB
run: ckb init && ckb index
- name: Run Compliance Audit
run: |
ckb audit compliance \
--framework="${FRAMEWORKS}" \
--ci --fail-on="${FAIL_ON}" \
--format=json > compliance.json
- name: Upload SARIF to GitHub Code Scanning
run: |
ckb audit compliance \
--framework="${FRAMEWORKS}" \
--format=sarif > compliance.sarifConfiguration
Customize PII patterns, AI component paths, SIL levels, and default frameworks per repository via .ckb/config.json.
{
"compliance": {
"piiFieldPatterns": ["customer_id", "tax_number"],
"aiComponentPaths": ["src/ml/**", "models/**"],
"silLevel": 2,
"specialCategoryPaths": ["src/health/**", "src/biometric/**"],
"defaultFrameworks": ["iec62443", "iso27001"]
}
}Quick Start
Four output formats: human, JSON, markdown, and SARIF. Use --recommend to auto-detect, or specify frameworks directly.
ckb audit compliance --recommendckb audit compliance --framework=gdpr,iso27001,owasp-asvsckb audit --min-score=60 --quick-winsckb audit compliance --framework=gdpr,pci-dss --ci --fail-on=errorckb audit compliance --framework=all --format=sarifauditCompliance(frameworks: ["gdpr", "iso27001"])Runs via MCP using the persistent SCIP index. Also available as the /ckb-audit skill.
======================================================
CKB COMPLIANCE AUDIT REPORT
======================================================
Repository: myapp
Verdict: WARN
Score: 72/100
Files: 245 scanned, 12 with issues
Findings: 18 total (3 errors, 8 warnings)
FRAMEWORK COVERAGE
------------------------------------------------------
GDPR 12 checks score=75%
ISO 27001:2022 15 checks score=80%
OWASP ASVS 4.0 13 checks score=76%
CHECK RESULTS
------------------------------------------------------
gdpr/weak-pii-crypto FAIL Art. 32 GDPR
Also violates: ISO 27001 A.8.24, NIST SC-13,
PCI DSS 4.2.1, ASVS V6.2.5 (CWE-327)
Finding 2/7: PII logged without redaction
File: api/handler.go:118
Check: pii-in-logs (high)
Regulations:
GDPR Art. 5(1)(f)
CCPA 1798.150
HIPAA 164.312(b)
Summary by Framework:
PCI DSS 3 findings
HIPAA 2 findings
GDPR 2 findingsWhat It Detects — and What It Doesn't
Reliably detects
Does not detect
CKB finds structural compliance violations deterministically and reproducibly. It doesn't replace the compliance advisor who judges whether a framework applies — but it reduces manual audit effort by 80-90% and provides the machine-readable evidence auditors need.
Ship compliant code by default
Add compliance checks to your existing workflow in one command. 131 checks, 20 frameworks, zero tokens. Free for personal use.