dsh-model-redactor
其他 活跃维护

dsh-model-redactor

zerodegress/dsh-model-redactor

模型可见内容脱敏插件,可自动识别并遮蔽模型输入中的API密钥、令牌、凭证等敏感信息,无需额外配置即可生效,避免敏感数据被模型误用或泄露。

1
Stars 标星
0
Forks 分支
1
Watchers 关注
0
Open Issues
TypeScript
主要语言
MIT
开源协议
26 KB
仓库大小
1 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:zerodegress/dsh-model-redactor
git clone https://github.com/zerodegress/dsh-model-redactor.git
git clone git@github.com:zerodegress/dsh-model-redactor.git
README.md main

dsh-model-redactor

Model-visible redaction plugin for DeepSeek Harness (dsh). It redacts
sensitive material (API keys, tokens, credentials) from what the model sees:

  • Input (agent/pre-step): user messages are rewritten to redacted copies
    before they enter the session log and the model request. Already-logged tool
    results are redacted through session surface replacement, preserving the
    original append-origin events in the durable log.
  • Output (llm/stream): text, reasoning, and tool-call argument deltas are
    redacted before the agent loop logs them, so the log and future model context
    stay consistent. block-end payloads are also redacted so the assembled
    assistant message cannot reintroduce a secret.

Install / compose

Add the row to a Cordis patch:

- insert:
    - id: dsh-model-redactor
      name: dsh-model-redactor
      config:
        enabled: true

The package ships cordis.patch.yml and declares dsh.bundle.patch for bundle
profiles.

Configuration

Field Type Default Description
enabled boolean true Master switch.
replacement string [REDACTED] Replacement text (1..128 chars). Must not itself match a built-in secret pattern.
customRegexes Array<{ pattern, flags?, replacement? }> [] Extra regex rules.
customWords Array<string \| { word, replacement? }> [] Exact-word rules.

Built-in rules are fixed and cannot be disabled. They cover OpenAI-style sk-,
Bearer, Basic, GitHub tokens, Slack tokens, JWTs, assignment patterns,
PEM private-key blocks, and AWS AKIA access key IDs.

Build and test

pnpm build
pnpm test

tsc emits lib/. Unit and integration tests use Vitest.