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
羽毛球分组比赛记分
小程序二维码

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

小夜