Install
openclaw skills install @1beekeeper/security-hardenerHarden a ZK-Bankir sovereign banking deployment — threat model audit, hash-chain integrity, dependency scanning, access control review, and runbook validation against De 10 Gebuden.
openclaw skills install @1beekeeper/security-hardenerHarden a ZK-Bankir sovereign banking deployment. Audits the threat model, verifies hash-chain integrity, scans for vulnerable dependencies, reviews access controls, and cross-references runbooks against De 10 Gebuden.
http://localhost:3000)curl, jq, ruby, bundle on PATHdocs/03-threat-model.md and docs/04-runbooks.mdVerify the Decision Ledger's SHA-256 hash chain (Gebud 6 — mandatory):
cd ZK_BANKIR_PATH
bin/rails runner "puts Decision.verify_chain ? '✅ Chain intact' : '❌ CHAIN BROKEN — RESTORE FROM BACKUP'"
If chain is broken, do NOT proceed with any other operations. Restore from backup immediately.
Check Ruby gems for known CVEs:
cd ZK_BANKIR_PATH
bundle audit check --update 2>&1
Also check for outdated gems:
bundle outdated --filter-patch 2>&1 | head -30
Validate that all 15 threats from docs/03-threat-model.md have mitigations in place:
cd ZK_BANKIR_PATH
echo "=== Threat Model Status ==="
# T1: Server compromise
echo -n "T1 (Server compromise): "
grep -q "watch-only" app/models/treasury_service.rb && echo "✅ No keys on server" || echo "❌ CHECK"
# T2: Database breach
echo -n "T2 (Database breach): "
grep -q "encrypted" app/models/decision.rb && echo "✅ Encrypted fields" || echo "⚠️ PARTIAL"
# T3: API abuse
echo -n "T3 (API abuse): "
grep -q "rack-attack" Gemfile && echo "✅ Rate limiting active" || echo "❌ MISSING"
# T4: Hash chain tampering
echo -n "T4 (Hash chain): "
grep -q "verify_chain" app/models/decision.rb && echo "✅ Verification method exists" || echo "❌ MISSING"
# T5: Unauthorized trades
echo -n "T5 (Unauthorized trades): "
grep -q "PolicyEngine" app/controllers/api/v1/decisions_controller.rb && echo "✅ Policy-gated" || echo "⚠️ CHECK"
# T6: Private key leak
echo -n "T6 (Private key leak): "
grep -q "NEVER STORE" app/models/kraken_service.rb 2>/dev/null && echo "✅ Guard documented" || echo "⚠️ CHECK — verify no key storage"
# T7: Backup failure
echo -n "T7 (Backup failure): "
test -f backups/backup-*.tar.gz 2>/dev/null && echo "✅ Recent backup found" || echo "⚠️ No recent backup"
# T8: Dependency hijack
echo -n "T8 (Dependency hijack): "
test -f Gemfile.lock && echo "✅ Lockfile present" || echo "❌ MISSING"
# T9: Configuration leak
echo -n "T9 (Config leak): "
grep -q "credentials" config/environments/production.rb 2>/dev/null && echo "✅ Encrypted creds" || echo "⚠️ CHECK"
# T10: RPC endpoint exposure
echo -n "T10 (RPC exposure): "
grep -q "127.0.0.1\|localhost" config/deploy.yml 2>/dev/null && echo "✅ Local binding" || echo "⚠️ CHECK binding"
Verify the Policy Engine's 3-tier evaluation is intact:
cd ZK_BANKIR_PATH
# Check policy rules exist (stored as JSON in `rules` column)
echo "=== Policy Engine Status ==="
bin/rails runner "
Policy.where(active: true).each do |p|
puts \"Policy ##{p.id}: #{p.name}\"
puts \" Rules: #{p.rules}\"
puts \" Auto-approve: <\$#{p.rules['approval_threshold']}\"
puts \" Hard-deny: >\$#{p.rules['max_trade_size']}\"
end
" 2>&1
Verify the risk tiers:
Check that daily operations match runbook procedures:
cd ZK_BANKIR_PATH
echo "=== Runbook Compliance ==="
# Check daily health endpoint
echo -n "Health endpoint: "
curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/health
echo ""
# Check treasury endpoint
echo -n "Treasury endpoint: "
curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/api/v1/treasury/balances
echo ""
# Check decision ledger
echo -n "Decision ledger: "
curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/api/v1/decisions
echo ""
# Verify hash chain
echo -n "Hash chain: "
bin/rails runner "puts Decision.verify_chain ? 'INTACT' : 'BROKEN'" 2>&1
Verify that the kill switch mechanism works (Gebud 10 — Test What You Fear):
# Check that Decision#destroy raises
cd ZK_BANKIR_PATH
bin/rails runner "
begin
Decision.last.destroy
puts '❌ KILL SWITCH FAILED: destroy allowed'
rescue => e
puts '✅ Kill switch active: destroy blocked'
end
" 2>&1
When the user requests a full security audit:
Before deploying to production:
If a security incident is suspected:
This skill enforces ZK-Bankir's non-negotiable doctrine:
| Variable | Default | Description |
|---|---|---|
ZK_BANKIR_HOST | http://localhost:3000 | ZK-Bankir server URL |
ZK_BANKIR_PATH | /home/cwn/App/domains/finance/zk-bankir | Project path for local checks |
AUDIT_ALERT_WEBHOOK | (optional) | Slack/Discord webhook for audit alerts |
| Symptom | Likely Cause | Fix |
|---|---|---|
| bundle-audit not found | gem not installed | gem install bundler-audit |
| Hash chain verification fails | DB corruption | Restore from backup, verify chain post-restore |
| Policy count is 0 | No policies seeded | bin/rails db:seed |
| rack-attack not in Gemfile | Missing dependency | Add gem "rack-attack" to Gemfile |