DSH Telemetry Redactor:对导出遥测副本做凭证脱敏

前言

在 DSH 中,session telemetry 可能在发送到 backend 前经过多个 listener 和 deployment rules。对安全敏感的 profile 来说,开发者需要在不改写 canonical session log 的前提下,降低 outbound telemetry copy 中敏感值被带出的风险。

下面介绍 dsh-telemetry-redactor。它由 030611 维护,许可证为 MIT,属于社区维护项目,不是 DeepSeek 官方项目。

这是什么

dsh-telemetry-redactor 是一个 minimal DeepSeek Harness Profile Bundle,用于在 backend 接收 session telemetry 之前,对敏感值做 redaction。

它挂载在官方 session-telemetry/record waterfall 上,调用 next(),让其他 deployment rules 可以继续组合,然后返回一个新的递归 redacted record。它只修改 outbound copy,不会重写 canonical session log。

这个 bundle 不添加、不替换、也不启用 telemetry backend。

脱敏范围

它覆盖三类内容:

1、高风险键名下的值,例如:

authorization
cookie
credential
password
secret
token
apiKey
access_token
clientSecret
privateKey

2、字符串中嵌入的 Bearer 和 Basic authorization 值。

3、常见凭证形式,包括 sk-...、GitHub tokens、Slack tokens、JWT-like triples,以及 token=... / api_key: ... assignments。

它会保留遥测计数和字段,例如 inputTokensoutput_tokenstokenUsagetokenCountcontextTokenCount,以及普通字段 tokenizer

如果一个键名匹配到敏感键,插件会 redact 完整值。这个策略偏向安全,而不是保留 credential 字段下面的结构。

脱敏发生在 telemetry capture path 上,是同步的,并且递归处理最多 64 个 nested containers。

安装与启用

先安装到指定 profile:

dsh plugin --profile web add dsh-telemetry-redactor

再检查 resolved configuration:

dsh --profile web --dump-config

dump 中必须包含插入的 telemetry-redactor row。

典型配置

它只有一个配置项:replacement,默认值为 [REDACTED]。它需要包含 1 到 128 个字符,并且不能本身匹配受支持的 credential pattern。

示例:

- id: telemetry-redactor
  config:
    replacement: '[TELEMETRY-REDACTED]'

key 和 pattern rules 是 fixed security behavior,不能通过配置关闭。

边界与注意

fail-closed 在这里只表示:这个 coordinator 会 withhold 一个 failing export copy,然后继续 agent loop。它不是对每条 telemetry path 或每个 listener order 都无法绕过的保证。

listener 被 prepend,所以通常可以包裹在它前面或后面挂载的 deployment rules,并 redact 它们的最终输出。但在安全敏感的部署中,一个 deliberately prepended outer listener 仍可能在这个插件之后加入内容;应检查完整 waterfall listener set。

没有敏感键、也没有命中已识别 string pattern 的未知 secret formats,可能通过。不要把该插件当作任意未知凭证格式的完整性证明。

Accessor properties 和 non-plain objects 会被拒绝,而不是被读取或静默转换。Proxy 可以在插件检查内容前,从 reflection traps 中运行或抛出。

dsh.plugin.json 是 supplemental community metadata。DSH installation 由 package.jsondsh.bundle 字段和 cordis.patch.yml 控制。

适用场景

适合已经配置了 telemetry backend,并希望在 outbound telemetry copy 中降低已知敏感键和常见凭证 pattern 暴露风险的部署。

它不适合替代所有安全控制。插件以当前 dsh 进程权限运行,安装前应检查源码与许可证。

链接

GitHub 仓库:

https://github.com/030611/dsh-telemetry-redactor
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

小夜