DeepSeek Harness 的 PII 脱敏:请求前匿名化姓名、电话、邮箱、证件与密钥,展示层还原,明文不进入会话日志。
安装
# npm 包(预构建)
dsh plugin --profile web add dsh-mask
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:PerryLink/dsh-mask
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
dsh-mask
- 1024 商店渠道:先
npm i -g dsh1024,再dsh1024 plugin --profile web add dsh-mask(计入 deepseek1024.com 安装排行)。
面向 DeepSeek Harness 的 PII 脱敏中间件——在个人数据进入模型前匿名化,在展示层还原。
电话、邮箱、身份证、银行卡、密钥等在模型边界变成占位符;原文绝不进入会话日志。
English · 简体中文 · Español · Português · हिन्दी
📖 生态实测知识库(实测数据,不是营销):插件开发指南 · 选型实测数据 · 维护取舍判据。
⭐ 如果它帮到了你
这个插件是 DSH 插件家族的一员(40+ 个,全部 Apache-2.0)。如果你在用,给个 star —— 它不会解锁任何功能,但会让下一个人在搜索里更容易找到它。
English: part of a 40+ plugin family for DeepSeek Harness. If it is useful, a star helps the next person find it — nothing is gated behind it.
What is dsh-mask?
面向 DeepSeek Harness 的 PII 脱敏中间件——在个人数据进入模型前匿名化,在展示层还原。
电话、邮箱、身份证、银行卡、密钥等在模型边界变成占位符;原文绝不进入会话日志。


同一次运行,动图版。
Comparison

108 synthetic samples (60 positive, 48 negative) · from benchmark/RESULTS.md
Compatibility
| 维度 | 状态 |
|---|---|
| Harness | DeepSeek Harness dsh-v0.2.1-alpha.1(2026-09-18 已适配):会话信封保留 ignorable 字段但仅用于存量日志读取兼容——Session.append 仍无法盖章,门控行为不变。已于 2026-09-18 针对 dsh-v0.1.7-alpha.1 master checkout 核验(全量门禁链 + profile 安装冒烟测试)。 |
| Node | ^22.19.0 || >=24.0.0 |
| 平台 | 任何 DSH 可运行处(纯 host、零依赖正则;无浏览器半) |
| 模型 | 文本模型完全支持;无需额外模型能力 |
What you get
dsh-mask 在模型边界匿名化个人数据——消息进入模型之前——并维护一张恢复表,以便在展示层把占位符映射回原文:
- 请求前遮罩 —— 重写
agent/pre-step消息,使电话、邮箱、身份证、银行卡、密钥(默认开启)与 IP(可选)变成<PHONE_1>之类的占位符。被遮罩的文本才是落盘并发送给模型的内容。 - 恢复表 ——
占位符 → 原文映射只存内存与受控 storage domain(dsh_mask);原文绝不进会话日志。 - 审计不含明文 ——
mask/applied会话事件只记「替换了 N 处 + 类型分布」,不记原文与映射。 /mask命令 ——status(计数 + 分布)、on/off(运行时开关)、restore <text>(还原占位符)、help。mask_test工具 —— 试跑一段文本看替换效果;绝不回显原文。
用户消息 ──agent/pre-step──▶ 占位符 ──模型──▶ 占位符 ──restore──▶ 展示
▲ │
└──── 恢复表(内存 + dsh_mask)──────────┘
Quick start
dsh plugin --profile web add github:PerryLink/dsh-mask
# 1. 把 bundle 安装进 profile
dsh plugin --profile web add github:PerryLink/dsh-mask
# 或从 npm(发布版本)
dsh plugin --profile web add dsh-mask
# 2. 校验行是否挂载
dsh --profile web --dump-config | grep -A2 'id: mask'
然后在 profile patch 里调整实体列表:
- insert:
- id: mask
name: dsh-mask
config:
entities: [phone, email, id-card, bank-card, key]
> /mask status
> /mask restore <PHONE_1>
Install & uninstall
- git 通道(最新
main):dsh plugin --profile web add github:PerryLink/dsh-mask(等价于从git+https://github.com/PerryLink/dsh-mask.git安装)。无构建步骤——index.mjs与lib/即发布产物。 - npm 通道(发布版本):
dsh plugin --profile web add dsh-mask。 - tarball 通道:在本仓库
pnpm pack,再dsh plugin --profile web add ./dsh-mask-<version>.tgz。 - 卸载:
dsh plugin --profile web remove dsh-mask(或从 profile patch 删掉该行)。
dsh-mask 不再自带 storage 栈。已组合该栈的 profile(web profile 通过 @deepseek-ai/dsh-web-app 提供)自带 storageDomain,持久化开箱即用。未组合 storage 的 bare profile 仍可正常挂载与遮罩,但恢复表仅存内存(重启丢失)——请在 profile patch 中组合 storage 栈,或将 persistRestoreTable 设为 false。
Configuration
所有可调项都是 Schemastery Config 字段(可从 cordis.yml 覆盖)。按 id 覆盖会替换整行——请重述所有需要的键。cordis.patch.yml 逐键内联注释。
| 键 | 默认值 | 含义 |
|---|---|---|
enabled |
true |
总开关;false 卸载监听器、/mask 命令与 mask_test 工具 |
mode |
regex |
检测模式;只有 regex 实现(regex+ner 姓名/地址识别预留并响亮失败) |
entities |
[phone, email, id-card, bank-card, key] |
要遮罩的 PII 类型;ip 也支持正则(可选),person/address 需要 NER |
scope |
[messages] |
遮罩作用域;messages 遮罩 agent/pre-step 消息,tools 遮罩 tools/post-execute 工具结果。可为字符串或数组,如 [messages, tools] |
registerCommand |
true |
注册 /mask 命令 |
registerTools |
true |
tools 服务存在时注册 mask_test 工具 |
persistRestoreTable |
true |
把恢复表持久化到受控 dsh_mask 领域(false = 仅内存) |
maxRestoreEntriesPerSession |
500 |
每会话恢复条目上限(最旧先逐出) |
maxSessions |
1000 |
内存会话上限(LRU 逐出,映射按需回载) |
profile patch 覆盖示例:
- insert:
- id: mask
name: dsh-mask
config:
entities: [phone, email, id-card, bank-card, key, ip]
persistRestoreTable: false
registerCommand: true
Tools & surfaces
| 表面 | 是否回显原文 | 说明 |
|---|---|---|
agent/pre-step 遮罩 |
永不 | 把消息重写为占位符后再落盘/送模型 |
/mask status |
永不 | 启用状态、替换总数、类型分布 |
/mask on / /mask off |
永不 | 运行时开关(重启回到 config.enabled) |
/mask restore <text> |
是(显式) | 把占位符还原为本会话存储的值 |
mask_test |
永不 | 遮罩一段文本并报告占位符结果 + 计数 |
Permissions & data
- 权限:
dsh-mask不做网络请求、不存凭据;只在agent/pre-step边界读取会话,并写入自己的dsh_mask领域。dshWorkshopmanifest 声明network:none与credentials:none。 - 数据:
占位符 → 原文恢复表存内存;persistRestoreTable: true时另存受控dsh_mask领域——这是 PII 原文唯一落点,绝不写会话日志。 - 会话日志:
mask/applied在types.d.ts声明,仅在宿主收录该类型时 append(见 Known limitations)。载荷只有计数 + 类型分布。
Security boundaries
- 原文绝不进会话日志。 落盘并送模型的是遮罩(占位符)形式,因此模型可见内容可自日志以占位符形式重建;原文留在恢复表。
- 展示/日志前脱敏。
lib/sanitize.mjs在文本进入模型或日志前打码 PII、密钥与 URL 凭据;mask_test与/mask status永不回显原文。 - 受控还原。
/mask restore是唯一的显式还原面,且只读当前会话的映射。 - 失败关闭。 未实现的
mode(regex+ner)、scope(tools)、NER 实体与越界数值均在加载期响亮失败。 - 注册即 effect。 监听器、命令、工具与领域关闭都是 Cordis effect——停止/热重载即可撤销。
Known limitations
- 仅正则。 姓名(
person)与地址(address)识别需要外部 NER 识别器,纯 host 零依赖形态未捆绑;mode: regex+ner与这些实体在加载期响亮失败。开箱即用覆盖电话、邮箱、身份证、银行卡、密钥与(可选)IP。 - 正则具地域局限。
phone与id-card只匹配中国大陆格式:phone为1[3-9]加九位数字,id-card为 18 位中国居民身份证(17 位数字加一位数字或X)。其他国家的电话号码与证件号码不会被检出。email、ip、key与地域无关;bank-card以较低置信度接受任意 16-19 位数字串。 - 展示层还原需要浏览器半。 遮罩完全在 host 侧,但客户端 UI 中透明还原助手气泡属于浏览器半功能,本纯 host 形态未交付。host 侧保留恢复表与已导出的
RestoreStoreseam(其方法需要会话 id),因此未来的客户端半需经 host 远程面间接消费,而非直接使用;当前的反遮罩入口是/mask restore <text>命令;maskClientEnabled键会被 schema 声明与校验,但尚无任何运行时代码读取它。 0.1.7-rc.2会话事件。 宿主收录 59 个会话事件类型,其中没有mask/*;其Session.append也无法盖章ignorable信封,因此会话日志审计 append 被跳过(会话仍可加载)。门控不再静默:每个会话首次被拒时打一条可见告警,写明被跳过的事件类型与本限制。宿主收录该类型或支持ignorable信封后自动开启。
Development
pnpm install # node ^22.19 || >=24
pnpm run typecheck && pnpm run typecheck:ci # 两把尺子:checkout 面(带守卫,无 checkout 时不可验证)+ 已发布线面
pnpm test # node --test
pnpm run verify:self-contained # 依赖 spec 均来自 registry
pnpm run verify:artifacts # 发布文件齐全 + index.mjs 可 import
pnpm run check:readmes # 五语 README 一致性
pnpm pack # 发布 tarball
无构建步骤:纯 ESM,index.mjs 与 lib/ 即发布产物。
Benchmark
PII 基准(108 个合成样本的逐类 P/R/F1)见 benchmark/RESULTS.md;用 node benchmark/run.mjs 复现(无需构建、零新依赖)。
Interoperability with other DSH plugins
已对照 DSH 0.2.0-rc.2(本 README 面向的运行时)与 2026-10-05 实测的高星插件集验证。
本插件不干扰其他插件,包括广泛安装的高星插件:
- 无工具名冲突。 所有工具都带命名空间,不占用任何已被内置工具或其他插件持有的裸名。
- 无服务键冲突。 不提供任何服务键,因此不存在服务键冲突。
- 无 slot 冲突。 不注册客户端 slot key,因此不参与
shadows-shipped-ui座位争抢。 - 无 HTTP 路由冲突。 不注册任何
webServer前缀。 - 无 patch 层冲突。 组合包 patch 只
insert自己那一行,从不覆写内置行的config。 - 无全局改写。 不改原型、不改写
process.env、不替换全局 fetch dispatcher。
共享事件监听器在构造上就不互相干扰。 它用 ctx.on() 监听顺序敏感事件 agent/pre-step, tools/post-execute —— Cordis 的广播语义:每个监听器都会运行,任何一个都无法饿死其他监听器。此处每个监听器都通过 next() 委托,因此链条绝不会被短路;改写作用在 next() 产出的值上,而不是用它顶替返回:
agent/pre-step— also used bydsh-routing-suite(7000★, 7 listeners),modlens(4122★),dsh-purge(3317★),dsh-agent-teams(1923★),dsh-context(1849★).tools/post-execute— also used bycc-safety-net(1576★).
静态证据:dsh-plugin-doctor 的 K10–K13 在本仓全部为 pass。
Topics
dsh, dsh-plugin, deepseek-harness, deepseek, cordis, pii, mask, privacy, anonymization, security
Contributors
- @PerryLink —— 创建者与维护者:从 Pii-Stripper-Middleware 移植的正则 PII 检测器、
agent/pre-step遮罩 seam、恢复表、/mask命令与mask_test工具、五语文档。
PerryLink DSH Plugin Family
本项目是 PerryLink 维护的 DeepSeek Harness 插件家族成员:34 个活跃维护,名册共 42 个,其中 5 个已冻结、3 个已退役——每一个都在下表保留自己的行,原因见「状态」列。如果它能帮到你,其他的也会:
| Plugin | 一句话 | 状态 |
|---|---|---|
| dsh-auto-review | Second-model auto-review on the approval chain, fail-closed by default | |
| dsh-autotier | Automatic strong/cheap model-tier routing with deterministic risk guards and a /tier command |
|
| dsh-background-agents | Durable background child agents with a Web UI sidebar, messaging and interrupt | 🚫 已退役 — 见上方说明 |
| dsh-budget | Cost governance for DeepSeek Harness: budgets, carbon, and latency in one panel. | 🧊 已冻结 — 见仓库 README |
| dsh-catalog | DSH Desktop Market standard catalog source for the PerryLink family | |
| dsh-cert-mcp | Read-only MCP server exposing the certification registry: grades, snapshots and five-dimension evidence | |
| dsh-checkpoint-rewind | Claude Code /rewind-equivalent: snapshots, session forks, one-shot restore | |
| dsh-claude-move | Migrate Claude Code sessions, memory, skills and CLAUDE.md into DSH | 🧊 已冻结 — 见仓库 README |
| dsh-click | Cross-platform native desktop control for DeepSeek Harness — Windows first. | |
| dsh-composer-history | Terminal-style input history for the web composer: arrows, Ctrl+R search | |
| dsh-data-quality | Dataset quality checks and citation cross-checks (the optional numeric bridge consumed here) | |
| dsh-defend | Prompt-injection, jailbreak, and secret-leak defense for DeepSeek Harness. | 🧊 已冻结 — 见仓库 README |
| dsh-doublecheck | Engineering-discipline guard: requirements grill, test gates, adversary review | |
| dsh-draw | Unified static-image generation routing for DeepSeek Harness. | 🧊 已冻结 — 见仓库 README |
| dsh-fast | Read-only performance diagnostics for DeepSeek Harness. | |
| dsh-fund-research | Deterministic research reports for Chinese public mutual funds | |
| dsh-github | GitHub PR/issues integration for DSH, every write gated by approval | |
| dsh-industry-research | Industry research orchestration that seals its deliverables through this plugin's ctx.researchReport.assemble |
|
| dsh-laya | Laya typed decisions (noul/choice/score) as a first-class Cordis service and model-visible tools |
|
| dsh-library | Local document knowledge base for DeepSeek Harness. | |
| dsh-local-ai | Local-model (Ollama) integration for DeepSeek Harness. | |
| dsh-lsp-actions | LSP diagnostics, formatting, completion, code actions and rename over language servers | |
| dsh-mask | PII masking middleware: anonymize at the model boundary, restore at the display layer | |
| dsh-mcp-panel | Read-only MCP runtime panel: /mcp command + Settings tab with status, tools and errors | |
| dsh-memento | Approval-gated cross-session memory: ctx.memory seam + SQLite + memory tool | |
| dsh-observe | OpenTelemetry and Langfuse observability exporter for DeepSeek Harness. | |
| dsh-output-styles | Claude Code outputStyles-equivalent runtime style switching | |
| dsh-permission-rules | Claude Code-style declarative allow/deny/ask permission rules with audit | |
| dsh-plugin-certification | Community certification registry with repro-checkable grades and badges | |
| dsh-plugin-doctor | Zero-dependency static + sandbox smoke detector for DSH plugins | |
| dsh-plugin-guide | Plugin-development knowledge base as an on-demand agent skill | |
| dsh-plugin-kit | Shared zero-runtime-dependency toolkit for the PerryLink DSH plugins | |
| dsh-plugin-upgrade | One-package, one-corridor-index plugin upgrade skill: routes a repository to the matching closed corridor card | |
| dsh-plugin-upgrade-015 | Merged 0.1.3-alpha.1 → 0.1.5-rc.1 upgrade corridor card plus a zero-dependency seam scanner |
🚫 已退役 —— 走廊由 dsh-plugin-upgrade 承担 |
| dsh-reach | Multi-channel approval/question bridge: WeChat/Telegram/Feishu, session console | 🧊 已冻结 — 见仓库 README |
| dsh-research-report | Verifiable research-report engine: content-addressed evidence ledger and sealed versions | |
| dsh-score | Multi-dimensional quality scoring for DeepSeek Harness plugins. | |
| dsh-session-pin | Pin sessions in the Web sidebar with durable ordering | 🚫 已退役 — 见上方说明 |
| dsh-session-sync | Cross-device session sync for DeepSeek Harness — a dedicated git mirror of your session store. | |
| dsh-skill-pack-security | Security-audit skill pack: secret scan, dependency and supply-chain review | |
| dsh-talk | Voice-first session loop for DeepSeek Harness: talk to it, hear it answer. | |
| dsh-team-rooms | Cross-session team rooms: shared message bus, task board and timeline | 🚫 已退役 — 见上方说明 |
| dsh-test-drive | Isolated install-and-smoke test drives for DeepSeek Harness plugins. | |
| dsh-ticktick | TickTick/Dida365 task bridge: session-header panel + 11 tools | |
| dsh-translate | Vendor parameter translation and deterministic JSON repair for DeepSeek Harness. |
License
LICENSE(Apache License 2.0)© 2026 dsh-mask contributors
从 DSH Desktop 市场安装
所有 PerryLink 插件均可在 DSH Desktop 内置市场中浏览:市场 → 来源 → 添加来源 → 粘贴 https://perrylink-dsh-catalog.perrylink.workers.dev/catalog-source.json → 选中。安装仍需通过市场的 npm 身份校验与你的确认。
链接
同类插件
toby-bridges/api-relay-audit★ 880
从 DeepSeek Harness 对 AI API 中转站和 LLM 代理运行本地安全审计,生成 Markdown 报告,覆盖提示词注入、模型替换信号、工具调用改写、错误泄漏、流完整性和按 profile 启用的 Web3 风险。
SeaOf0/dsh-redteam-model★ 688
面向授权安全研究的 DSH 合集:九个工作模式(redteam 总控、渗透测试、代码审计、二进制分析、攻防评估、免杀对抗、应急溯源、云安全攻防、CTF 解题)与十五个运行时插件,设置页管理台支持一键部署、安装、更新与卸载。
howmp/dsh-pentest★ 607
面向 DeepSeek Harness 的授权渗透模式:以探索链路记录目标、线索、资产与漏洞,并在 Web 中可视化展示。
PerryLink/dsh-auto-review★ 234
审批链上的第二模型自动审查:只读审查子代理返回带理由的 allow/deny 结构化裁决,默认 fail-closed。
ADWMC/helm-d#helmd★ 168
单包逆向与渗透测试安全分析插件:首轮工具收敛、领域路由与 33 个工具,覆盖 APK、Web、原生二进制、协议、恶意样本与 LLM 场景的逆向分析、加壳脱壳与 License 破解绕过;内置 H-CoT 评估引擎(语义路由、/hcot 命令)、账本驱动的 Web 工作台与工具货架、磁盘案件工作区(证据链自动存证、E 编号结论校验、上下文压缩后恢复)、GitHub 工具检索与 361 篇按需参考文档。
NanmiCoder/dsh-auto-mode★ 164
在 Workspace Write 与 Full access 之间增加 Auto 权限档:日常操作留在官方 workspace-write 沙箱内,由当前会话模型复核升权与破坏性调用,精确的越界访问按次放行一次,意图不明时询问,命中关键路径则拒绝。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。