跳过主要内容
Z

cloakpack (dsh-cloak)

zhangmiao03/cloakpack/packages/dsh-cloak

DeepSeek Harness 的上下文防火墙:成功的纯文本工具结果中的凭据在进入模型之前先变成不透明的 ⟦cloak:category:n⟧ 占位符,原值只保存在进程内存的 agent 级保险库中。36 类内置签名(与 cloakpack git pre-push 守卫共享同一引擎)、针对未知格式的键名规则、自定义正则、dry-run 模式、审计日志与 /cloak 命令。

安装

dsh plugin --profile web add github:zhangmiao03/cloakpack

该插件位于仓库的 packages/dsh-cloak 子路径下。

README

cloakpack

One product, one vault, two gates. 密钥安全包:一个本地加密保险库,守两道门——出机门(git push 阻断)与入模门(DeepSeek Harness 上下文防火墙)。共享同一套检测引擎。

中文说明 · Monorepo: packages/core(引擎) · packages/cli(cloakpack CLI) · packages/dsh-cloak(DSH 插件)

Gates

GatePackageInstallWhat it blocks
出机门cloakpack (CLI)npm i -g cloakpack → cloakpack initgit push with credentials in the pushed tree — blocks, then one-command pack (vault + placeholders) fixes it; unpack restores locally
入模门dsh-cloak (DSH plugin)dsh plugin --profile web add dsh-cloakcredentials in tool results before they enter model context (placeholders + system-prompt guidance)

Both share: 36 high-precision signature families (incl. 飞书/企微/腾讯云 for the CN ecosystem), sensitive-key-name rules, custom regex, ⟦cloak:category:n⟧ stable placeholders, AES-256-GCM local vault (~/.cloakpack/keys/, 0600).

Engine (best practices from the field)

  • Inline allowlist — a cloakpack:allow comment suppresses that line (gitleaks parity)
  • Config allowlist — .cloakpack/rules.json → allow.paths (globs) / allow.values
  • Baseline — cloakpack scan --update-baseline: 存量入册不拦、新密钥必拦 (detect-secrets parity); fingerprints only, no plaintext
  • Entropy gate — Shannon-entropy secondary filter on generic formats (gitleaks parity)
  • Honest limits: secrets already pushed must be rotated; packing can't save history

Threat model

Protects the project directory leaving your machine (sharing, judges, USB, demos). Does not protect against same-user malware on the same machine. Vault + key never committed.

Development

npm install --legacy-peer-deps && npm run build && npm test   # 71 tests incl. real-git E2E

License: MIT. Roadmap: opt-in live verification (truffleHog-style), base64/URL decoders, scan --history full-blob sweep, DSH approval-gated reveal sharing this vault.

中文

一个产品、一个保险库、两道门:cloakpack(CLI,npm 包)在 git push 时阻断密钥出机,dsh-cloak(DSH 插件)在密钥进入模型上下文前打码;引擎同源(36 签名族+键名规则+自定义正则),占位符与保险库格式互通。行内 cloakpack:allow 豁免、配置豁免、基线(存量不拦新增拦)、熵过滤均已内置;已出过门的密钥必须轮换——工具会直说。

相关插件