- Startseite
- Plugins
- Sicherheit & Berechtigungen
- dsh-privacy-guard
dsh-privacy-guard
kl998/dsh-privacy-guard
Masks ID card numbers, phone numbers, emails, bank cards, passports, secrets and Chinese labeled fields in tool results and user messages before the model reads them, replacing each value with a marker. A Session that reads a document-type file, receives an image, or matches a rule stops uploading its Session log and withholds telemetry ledger records, and a resumed Session is marked again and announced once on its first message. Text inside images and unlabeled prose are not masked; model requests still carry the masked content.
Installation
dsh plugin --profile web add github:kl998/dsh-privacy-guardREADME
privacy-guard
隐私守护 / Privacy guard — 在 DeepSeek Harness 把文档交给模型之前遮蔽其中的隐私信息,并让碰过文档或图片的会话停止把会话日志回传给服务器。
安装
在 DSH 的 插件 页点 Add plugin,输入包名后安装:
@kl998/dsh-privacy-guard
或命令行:
dsh plugin add @kl998/dsh-privacy-guard
安装后无需重启(多数环境由 HMR 生效;若未生效请重启 DSH)。卸载:插件页停用,或 dsh plugin remove @kl998/dsh-privacy-guard。
它做什么
| 位置 | 处理 |
|---|---|
| 模型推理请求 | 工具结果与用户消息在你看到之前脱敏 |
dsh_session_log(随官方 API 请求上传) | 被标记的会话不再上传,含标记之前已积累的日志前缀 |
| OTel 会话遥测 | 被标记会话的 ledger 记录整体扣留,其余出站副本按同一套规则脱敏 |
| 本地对话 | 模型从未收到原文,因此无法复述;工具卡片显示占位符 |
怎么算「被标记」:规则命中、读取了文档类文件(documentExtensions 默认含 doc/docx/xls/xlsx/ppt/pptx/pdf/csv/txt/rtf 等)、或收到图片(图片是拍摄的证件同样算)——任一发生即标记。这样即使规则没识别出正文里的姓名、薪资,也进不了回传通道。重启后恢复的会话会从历史恢复标记,并在首条消息提示一次。
识别范围
身份证号(加权校验 + 生日校验)、手机号、邮箱、银行卡号(Luhn)、护照号、密钥/令牌/私钥,以及中文标签字段(姓名:张三、手机号 138…,分隔符支持 :/:/=、制表符与两个以上空格)。
配置
在 profile 的 cordis.patch.yml 中覆盖默认值(只写要改的字段即可):
- id: privacy-guard
name: '@kl998/dsh-privacy-guard'
config:
mode: mask # mask | block | report
markOnDocumentReference: true # 读取文档即标记
documentExtensions: ['.docx', '.xlsx', '.pdf', '.csv']
markOnUserImages: true # 收到图片即标记
imagePolicy: block-sensitive # allow | block-sensitive | block-all
blockSessionLogUpload: on-sensitive # on-sensitive | always | off
withholdSensitiveTelemetry: true
其余可用字段:rules.*(逐类开关)、customLabels、customPatterns、tools.include/exclude、maskTemplate、maxScanChars、appendNotice、redactUserMessages、promptNotice、redactSessionTelemetry。
边界(请务必阅读)
- 这是模式化脱敏,不是离线处理:文档仍需进入模型请求,只是其中被识别的值已替换为占位符。
- 图片内的文字与无标签自由文本不会被脱敏(模型可能看到),但所在会话已被标记,不上传日志。
imagePolicy: allow时图片会发给模型;block-sensitive下会话被标记后的图片结果会被拦截。- 启用前已经写进会话日志的原文不会被追溯改写。
- 脱敏后的值无法被模型引用或写回文件;需要原值时请在本机用脚本处理。
安全说明
- 无安装/构建脚本,无网络请求,不新增工具,不读取凭据文件。
- 全部逻辑在 Host 侧,纯本地正则;不向任何第三方发送数据。
- 代码公开在 github.com/kl998/dsh-privacy-guard,欢迎审查。
许可证
MIT
Ähnliche Plugins
dsh-purge
hunyisage/dsh-purge
dsh-infinite-gen-4
minglink/dsh-infinite-gen-4
dsh-purge
mmparko/dsh-purge
cc-safety-net
kenryu42/cc-safety-net