dsh-mask
PII masking middleware for DeepSeek Harness: regex-detect and replace phones, emails, ID cards, bank cards, keys, and (opt-in) IPs with placeholders before they reach the model, keep the restore table host-side (memory plus a controlled storage domain, never the session log) with the /mask restore command and the exported RestoreStore seam, and expose /mask status and the mask_test tool. Name and address recognition needs an external NER recognizer, which this pure-host form does not bundle: mode "regex+ner" and the person/address entities fail loudly at load. The phone and ID-card detectors match mainland-China formats only.
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:PerryLink/dsh-mask说明文档
阅读完整 README ↗Configuration
All tunables are Schemastery Config fields (changeable from cordis.yml). An id-targeted override replaces the whole row — restate every key you need. cordis.patch.yml documents each key inline.
| Key | Default | Meaning |
|---|---|---|
enabled | true | Master switch; false unregisters the listener, the /mask command, and the mask_test tool |
mode | regex | Detection mode; only regex is implemented (regex+ner for name/address recognition is reserved and fails loud) |
entities | [phone, email, id-card, bank-card, key] | Which PII types to mask; ip is also regex-capable (opt-in), person/address require NER |
scope | [messages] | Masking surface(s); messages masks agent/pre-step messages, tools masks tool-result text on tools/post-execute. Accepts a string or an array, e.g. [messages, tools] |
registerCommand | true | Register the /mask command |
registerTools | true | Register the mask_test tool when the tools service is present |
persistRestoreTable | true | Persist the restore table to the controlled dsh_mask storage domain (false = memory only) |
maxRestoreEntriesPerSession | 500 | Per-session restore entry cap (oldest evicted first) |
maxSessions | 1000 | In-memory session cap (least-recently-used evicted, mapping reloaded on demand) |
maskClientEnabled | false | Feature flag for the browser half "reveal" bubble (defensive; off by default until the live slot catalog verifies the target slot). The key is schema-declared and validated, but no runtime code reads it yet, so it changes nothing until the browser half ships |
Example override in your profile patch:
- insert:
- id: mask
name: dsh-mask
config:
entities: [phone, email, id-card, bank-card, key, ip]
persistRestoreTable: false
registerCommand: true