dsh-privacy-gateway 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -56,6 +56,9 @@ someone@gmail.com → EMAIL
56
56
  - A documentation domain (`example.com`, `.example`) is no email; a phone number needs 11 digits, an ID card its check digit, a bank card its Luhn sum.
57
57
  - A field's value is no secret when it is a file's name: only a file name's characters, and an extension of a known kind (model weights such as `safetensors`, `gguf`, `ckpt`, archives, pictures, sound and video, documents and data); it goes out as it is ([ADR-0026](docs/adr/0026-file-name-values.md)).
58
58
  - One value seen again gets the same placeholder.
59
+ - A secret shorter than 8 characters (`abc123`, `666666`, `888888`: a short password) is no value: it goes as written and makes no record. It is guessed in no time, so masking it only promises a protection that is not there — and the value table never matched anything that short as known anyway ([ADR-0031](docs/adr/0031-no-short-or-template-values.md)).
60
+ - A value typed to stand for a key is no value: eight or more of one character in a row (`sk-proj-xxxx…`, `AKIA0000…`), or one that says what it is (`your_api_key`, `example`, `changeme`, `placeholder`, `dummy`, `***`). A random key has such a run with a chance below one in a billion, and a vendor's real test key (`sk_test_…`) is still masked ([ADR-0031](docs/adr/0031-no-short-or-template-values.md)).
61
+ - A key is masked the way a value is: the key in `{"metadata": {"sk-…": …}}` goes as a placeholder and comes back in the reply. The protocol's own keys (`model`, `role`, `type`, `name`, `id` and so on), the tool definitions and a tool call's argument names are never touched ([ADR-0029](docs/adr/0029-mask-json-keys.md)).
59
62
 
60
63
  ## Screens
61
64
 
@@ -67,7 +70,7 @@ The screenshots show the Chinese interface.
67
70
 
68
71
  ## Configuration
69
72
 
70
- The everyday settings can be changed on the Configure page of this plugin's row on the plugin page: `enabled`, `secrets`, `personal`, `shape`, `toolGuard`, `words`, `allow`, `record`, `keepDays`, `recordContext`, `vendorView`, `showPanel`, `excludeProviders`. A change is saved at once and applies from the next model call, with no restart ([ADR-0021](docs/adr/0021-live-settings.md)). The others are changed in the profile's `~/.dsh/profiles/<profile>/cordis.patch.yml`, under `config` of the `id: dsh-privacy-gateway` row; the `cordis.patch.yml` shipped in the package is replaced on upgrade, so do not edit it.
73
+ The everyday settings can be changed on the Configure page of this plugin's row on the plugin page: `enabled`, `secrets`, `personal`, `shape`, `toolGuard`, `maskKeys`, `words`, `allow`, `record`, `keepDays`, `recordContext`, `vendorView`, `showPanel`, `excludeProviders`. A change is saved at once and applies from the next model call, with no restart ([ADR-0021](docs/adr/0021-live-settings.md)). The others are changed in the profile's `~/.dsh/profiles/<profile>/cordis.patch.yml`, under `config` of the `id: dsh-privacy-gateway` row; the `cordis.patch.yml` shipped in the package is replaced on upgrade, so do not edit it.
71
74
 
72
75
  | Key | Default | Description |
73
76
  | --- | --- | --- |
@@ -77,6 +80,7 @@ The everyday settings can be changed on the Configure page of this plugin's row
77
80
  | `words` | `[]` | Your own words (a project's code name, a customer's name), masked as written as `TERM` |
78
81
  | `allow` | `[]` | Values never masked: whole values, in any case |
79
82
  | `actions` | `{}` | An action per kind: `mask` (the default, a placeholder), `warn` (sent as written and recorded) or `block` (the whole request is not sent). For example `{ PRIVATE_KEY: block, EMAIL: warn }` ([ADR-0013](docs/adr/0013-actions.md)) |
83
+ | `maskKeys` | `true` | A **JSON key** that reads like a secret or personal data goes as a placeholder too (`{"sk-…": …}`). The protocol's own keys (`model`, `role`, `type`, `name`, `id` and so on), the tool definitions and a tool call's argument names are never touched, or the vendor could not read the request. When off, such keys go as they are ([ADR-0029](docs/adr/0029-mask-json-keys.md)) |
80
84
  | `toolGuard` | `off` | When a tool call's arguments would have a value restored and name a host off this machine: `off` only counts it, `warn` logs and records it, `block` leaves the placeholders in that call's arguments, so the tool gets the placeholder ([ADR-0014](docs/adr/0014-tool-guard.md)) |
81
85
  | `shape` | `false` | Send a key as a made-up key of its own form (same prefix, length and kinds of character) instead of a `{{…}}` placeholder; a value under 8 characters, or holding anything but letters, digits, `-`, `_` and `.`, keeps the placeholder; replies put it back the same way ([ADR-0015](docs/adr/0015-shape.md)) |
82
86
  | `cookieNames` | `[]` | More cookie names to mask |
@@ -88,7 +92,7 @@ The everyday settings can be changed on the Configure page of this plugin's row
88
92
  | `maxValues` | `5000` | Size of the in-memory value table; when full, the oldest half is dropped |
89
93
  | `record` | `true` | Write the masking records to disk; when off, the statistics stay in memory |
90
94
  | `keepDays` | `30` | Days of records kept |
91
- | `recordContext` | `true` | Each value in a record keeps where it was (a user message, a tool result and so on) and about 80 characters each side, taken from what was sent, with every masked value a placeholder ([ADR-0024](docs/adr/0024-record-context.md)) |
95
+ | `recordContext` | `true` | Each value in a record keeps every place it was at (a user message, a tool result and so on, up to 8 a value) and about 80 characters each side of the first, taken from what was sent, with every masked value a placeholder ([ADR-0024](docs/adr/0024-record-context.md), [ADR-0028](docs/adr/0028-record-every-place.md)) |
92
96
  | `keepMegabytes` | `100` | Megabytes of records kept; past it, the oldest days are deleted |
93
97
  | `keepRecords` | `500` | Latest records kept in memory |
94
98
  | `vendorView` | `false` | Keep in memory the body each recorded request went out with, for the side-by-side view in the statistics card; at most 100 bodies and 64 MiB in all, never on disk ([ADR-0016](docs/adr/0016-vendor-view.md)) |
@@ -107,13 +111,13 @@ No answer of the command has a value in it.
107
111
 
108
112
  ## Records and statistics
109
113
 
110
- Only a model request that had something masked or restored makes a record, one each (a request with neither makes none): the time, how long masking took, the host, the model, the session id with its workspace name and session title, the places replaced, each value's placeholder / kind / finder / head / length / tail, the places the reply had restored (with those in tool call arguments counted apart), and the placeholders the reply had that the value table has no value for. A record never holds a value, nor a URL's query ([ADR-0008](docs/adr/0008-masking-records.md), [ADR-0020](docs/adr/0020-record-attribution.md)).
114
+ Only a model request that had something masked or restored makes a record, one each (a request with neither makes none): the time, how long masking took, the host, the model, the session id with its workspace name and session title, the places replaced, each value's placeholder / kind / finder / head / length / tail / every place it was at, the turn and step the request was sent in, the turn and step it was first sent in this run, the places the reply had restored (with those in tool call arguments counted apart), and the placeholders the reply had that the value table has no value for. A record never holds a value, nor a URL's query ([ADR-0008](docs/adr/0008-masking-records.md), [ADR-0020](docs/adr/0020-record-attribution.md)).
111
115
 
112
116
  The head keeps a few characters to recognize it by: a key with a prefix keeps the prefix and the 4 characters after it, one without keeps its first 4, and a long value also keeps its last 2 (`sk-proj-g6sx…3QaZ`); shorter values keep fewer. Personal data and the user's words still keep one character ([ADR-0019](docs/adr/0019-hint.md)).
113
117
 
114
118
  Records go to a `masking/YYYY-MM-DD.jsonl`, one file a day; the directory is 0700 and the files 0600. State lives in the current instance's own directory (`~/.dsh/profiles/<profile>/plugin-data/dsh-privacy-gateway/`), so two instances never write into each other ([ADR-0027](docs/adr/0027-per-instance-state.md)). A failed write is logged as a warning and the request goes on.
115
119
 
116
- The plugin's detail page has a statistics card at the bottom: today / 7 days / 30 days, the counts, the distributions by kind / finder / host, and the latest 200 records, 10 a page, each with its workspace · session title; open one to see each of its values. The card's 「清空数据」 (Clear data) button, once its confirmation box is checked, deletes the records, counts and record files of every session; this cannot be undone ([ADR-0022](docs/adr/0022-reset.md)). With `showPanel` on, the same view is a 「隐私保护」 (Privacy) tab at the top of the session, counting only that session. The tab's 「本会话脱敏」 (Mask this session) switch turns masking off for that one session after a confirmation; other sessions are still masked, and the choice holds across restarts ([ADR-0023](docs/adr/0023-session-switch.md)).
120
+ The plugin's detail page has a statistics card at the bottom: today / 7 days / 30 days, the counts, the distributions by kind / finder / host, and the latest 200 records, 10 a page, each with its time, the turn and step its request went out in (written `42·3` on the row, numbered as the 「轨迹」, Trajectory, tab numbers them; hidden on a narrow screen, where the details say 「这次请求在第 42 轮 · 第 3 步发出」, this request went out in turn 42, step 3) and its workspace · session title; open one to see each of its values, a line under it naming the message it went in (「用户消息 · `messages.3`」, a user message, with its path; the 3 is the message's index in the request body, counted from 0, the same as in 「查看发出内容」, what was sent) and the text around it, then, where the same value was sent again, another line with the other places (「还出现在 `messages.7`、`messages.9`」, also at those; the places past the eighth are counted, not listed), so the conversation can be found and checked: each value also says which turn and step it was first sent in during this run (counted afresh after a restart), and the turn and step of the record say which step the request went out in, the message index says which message of that request the value was in (a record from before the gateway read them, or a request made outside a step, leaves that column empty). It is the step that SENT it: a step’s output only reaches the next step’s request, so searching the trajectory for a value usually finds it one step earlier — a place marked as an assistant reply says the value came from an earlier one. The card's 「清空数据」 (Clear data) button, once its confirmation box is checked, deletes the records, counts and record files of every session; this cannot be undone ([ADR-0022](docs/adr/0022-reset.md)). With `showPanel` on, the same view is a 「隐私保护」 (Privacy) tab at the top of the session, counting only that session. The tab's 「本会话脱敏」 (Mask this session) switch turns masking off for that one session after a confirmation; other sessions are still masked, and the choice holds across restarts ([ADR-0023](docs/adr/0023-session-switch.md)).
117
121
 
118
122
  With `vendorView` on (「保留发出内容,供对照查看」, Keep what was sent to compare, on the Configure page), a record's details have a 「查看发出内容」 (What was sent) button, to check what the model service actually got and whether anything slipped through: on the right the body as the model service got it, on the left the same body with each replaced place shown as a "kind · head · length" marker; by default only the lines with replacements are listed. Neither side has a value in it; a value a warn action sent as written is a placeholder in the copy too.
119
123
 
@@ -121,7 +125,7 @@ With `vendorView` on (「保留发出内容,供对照查看」, Keep what was
121
125
 
122
126
  - The session log holds the real values: replies are restored before the log is written ([ADR-0003](docs/adr/0003-restore-before-session-log.md)). Session sync, backups and shares carry the real values.
123
127
  - Only traffic through the global `fetch()` is covered; direct `node:http`, worker threads and separate processes bypass the gateway ([ADR-0001](docs/adr/0001-intercept-at-undici-global-dispatcher.md)).
124
- - Compressed requests and replies are decompressed before they are masked or restored; a `content-encoding` with no decoder fails the request ([ADR-0025](docs/adr/0025-compression-and-upgrades.md)). Upgrades (the WebSocket handshake) are refused as well: Codex falls back to SSE the first time and takes SSE from then on in that session; a WebSocket another plugin opens through the global dispatcher is refused too, so put its host in `excludeHosts` if it needs one.
128
+ - Compressed requests and replies are decompressed before they are masked or restored; a `content-encoding` with no decoder fails the request ([ADR-0025](docs/adr/0025-compression-and-upgrades.md)). An upgrade (the WebSocket handshake) or a `CONNECT` tunnel inside a model call is refused as well: Codex falls back to SSE the first time and takes SSE from then on in that session. One opened by a plugin outside a model call (dsh-im-infoflow's inbound, say) is let through, its messages unmasked, with one warning per host ([ADR-0032](docs/adr/0032-upgrade-scoped-to-masked-calls.md)) — a fail-closed to fail-open trade whose cost the ADR records; a host that needs a transparent link can still go into `excludeHosts`.
125
129
  - The value table is in memory only ([ADR-0009](docs/adr/0009-value-table-and-restore-exfiltration.md)). After a restart, a value no rule finds, masked only because it was remembered, goes as written the first time it is sent again.
126
130
  - Replies are restored everywhere, tool call arguments included: a model led into writing a placeholder into a command such as `curl` runs the tool with the real value. The plugin counts these places (the tool-argument count on the card and in `/privacy status`) and does not block them ([ADR-0009](docs/adr/0009-value-table-and-restore-exfiltration.md)).
127
131
  - When masking fails, the request is not sent and fails with `dsh-privacy-gateway: masking failed, request not sent` ([ADR-0005](docs/adr/0005-fail-closed.md)). To recover, run `/privacy off`, or disable the plugin on the Plugins page or set `enabled` to `false`.
package/README.md CHANGED
@@ -56,6 +56,9 @@ someone@gmail.com → EMAIL
56
56
  - 文档域名(`example.com`、`.example`)不算邮箱;手机号要 11 位、身份证要过校验位、银行卡要过 Luhn,否则不换。
57
57
  - 字段的值是一个文件名时不是密钥:只由文件名的字符组成、且扩展名是已知的文件类型(模型权重 `safetensors`/`gguf`/`ckpt` 等、压缩包、图片音视频、文档数据),原样发出([ADR-0026](docs/adr/0026-file-name-values.md))。
58
58
  - 同一个值重复出现,占位符相同。
59
+ - 短于 8 个字符的秘密(`abc123`、`666666`、`888888` 这类口令)不算值:照原样发出,也不进记录。它们随时能被爆破,遮住只是给人一种并不存在的保护;值表本来也不把这么短的值当作已知值([ADR-0031](docs/adr/0031-no-short-or-template-values.md))。
60
+ - 明显是占位写法的值不算值:8 个以上相同字符连排(`sk-proj-xxxx…`、`AKIA0000…`),或自带「这是占位」说明(`your_api_key`、`example`、`changeme`、`placeholder`、`dummy`、`***`)。随机 key 出现 8 连排的概率低于十亿分之一,`sk_test_…` 这种真测试 key 照旧脱敏([ADR-0031](docs/adr/0031-no-short-or-template-values.md))。
61
+ - 键名和值一样脱敏:`{"metadata": {"sk-…": …}}` 里的键名也换成占位符,回复里再换回来;协议自身的键(`model`、`role`、`type`、`name`、`id` 等)、工具定义和工具调用的参数名不动([ADR-0029](docs/adr/0029-mask-json-keys.md))。
59
62
 
60
63
  ## 界面
61
64
 
@@ -65,7 +68,7 @@ someone@gmail.com → EMAIL
65
68
 
66
69
  ## 配置
67
70
 
68
- 插件页面里本插件那一行的「配置」页上可以直接改日常项:`enabled`、`secrets`、`personal`、`shape`、`toolGuard`、`words`、`allow`、`record`、`keepDays`、`recordContext`、`vendorView`、`showPanel`、`excludeProviders`。改了即时保存,从下一次模型调用起生效,不用重启([ADR-0021](docs/adr/0021-live-settings.md))。其余项在 profile 的 `~/.dsh/profiles/<profile>/cordis.patch.yml` 里改,写在 `id: dsh-privacy-gateway` 那一行的 `config` 下;插件包自带的 `cordis.patch.yml` 升级时会被覆盖,不要改它。
71
+ 插件页面里本插件那一行的「配置」页上可以直接改日常项:`enabled`、`secrets`、`personal`、`shape`、`toolGuard`、`maskKeys`、`words`、`allow`、`record`、`keepDays`、`recordContext`、`vendorView`、`showPanel`、`excludeProviders`。改了即时保存,从下一次模型调用起生效,不用重启([ADR-0021](docs/adr/0021-live-settings.md))。其余项在 profile 的 `~/.dsh/profiles/<profile>/cordis.patch.yml` 里改,写在 `id: dsh-privacy-gateway` 那一行的 `config` 下;插件包自带的 `cordis.patch.yml` 升级时会被覆盖,不要改它。
69
72
 
70
73
  | 键 | 默认 | 说明 |
71
74
  | --- | --- | --- |
@@ -75,6 +78,7 @@ someone@gmail.com → EMAIL
75
78
  | `words` | `[]` | 自己的词(项目代号、客户名),按原样换成 `TERM` 占位符 |
76
79
  | `allow` | `[]` | 永不脱敏的值:整值匹配,不分大小写 |
77
80
  | `actions` | `{}` | 按 kind 选动作:`mask`(默认,换成占位符)、`warn`(照发并记一条)、`block`(整个请求不发)。例:`{ PRIVATE_KEY: block, EMAIL: warn }`([ADR-0013](docs/adr/0013-actions.md)) |
81
+ | `maskKeys` | `true` | 读起来像密钥或个人信息的 **JSON 键名**也换成占位符(`{"sk-…": …}`);协议自身的键(`model`、`role`、`type`、`name`、`id` 等)、工具定义和工具调用的参数名永不动,否则供应商读不懂请求。关闭后这类键名原样发出([ADR-0029](docs/adr/0029-mask-json-keys.md)) |
78
82
  | `toolGuard` | `off` | 工具调用参数里还原出值、又指向本机以外的 host 时怎么办:`off` 只计数,`warn` 告警并记一条,`block` 这次调用的参数里不还原,工具拿到占位符([ADR-0014](docs/adr/0014-tool-guard.md)) |
79
83
  | `shape` | `false` | 密钥换成同形的假 key(前缀、长度、字符类别不变),而不是 `{{…}}` 占位符;不足 8 个字符、或含字母数字与 `-` `_` `.` 以外字符的值仍用占位符;回复里照样还原([ADR-0015](docs/adr/0015-shape.md)) |
80
84
  | `cookieNames` | `[]` | 追加要脱敏的 cookie 名 |
@@ -86,7 +90,7 @@ someone@gmail.com → EMAIL
86
90
  | `maxValues` | `5000` | 内存值表上限,满了淘汰最老的一半 |
87
91
  | `record` | `true` | 脱敏记录写盘;关掉只在内存里统计 |
88
92
  | `keepDays` | `30` | 记录保留天数 |
89
- | `recordContext` | `true` | 记录里每个值带上它所在的位置(用户消息、工具结果等)和前后各约 80 个字符,取自发出的内容,被脱敏的值都是占位符([ADR-0024](docs/adr/0024-record-context.md)) |
93
+ | `recordContext` | `true` | 记录里每个值带上它出现过的每一处(用户消息、工具结果等,每值最多 8 处)和第一处前后各约 80 个字符,取自发出的内容,被脱敏的值都是占位符([ADR-0024](docs/adr/0024-record-context.md)、[ADR-0028](docs/adr/0028-record-every-place.md)) |
90
94
  | `keepMegabytes` | `100` | 记录总量上限(MB),超了从最老的一天删 |
91
95
  | `keepRecords` | `500` | 内存里保留的最近记录条数 |
92
96
  | `vendorView` | `false` | 在内存里留最近记录的请求实际发出的 body,统计卡里可以左右对照;最多 100 份、共 64 MiB,不落盘([ADR-0016](docs/adr/0016-vendor-view.md)) |
@@ -105,13 +109,13 @@ someone@gmail.com → EMAIL
105
109
 
106
110
  ## 记录与统计
107
111
 
108
- 只记有脱敏或还原的模型请求,一个请求一条(既没脱敏也没还原的不记):时间、脱敏耗时、host、model、会话 id 及其工作区名与会话标题、替换处数、每个值的占位符 / kind / finder / 开头 / 长度 / 结尾、回复里还原的处数(工具调用参数里的另计),以及回复里出现、值表里却没有的占位符数。记录里不写值本身,也不记 URL 的 query([ADR-0008](docs/adr/0008-masking-records.md)、[ADR-0020](docs/adr/0020-record-attribution.md))。
112
+ 只记有脱敏或还原的模型请求,一个请求一条(既没脱敏也没还原的不记):时间、脱敏耗时、host、model、会话 id 及其工作区名与会话标题、替换处数、每个值的占位符 / kind / finder / 开头 / 长度 / 结尾 / 出现过的每一处、这次请求所在的轮次与步数、值本次运行里首次被发出的轮次与步数、回复里还原的处数(工具调用参数里的另计),以及回复里出现、值表里却没有的占位符数。记录里不写值本身,也不记 URL 的 query([ADR-0008](docs/adr/0008-masking-records.md)、[ADR-0020](docs/adr/0020-record-attribution.md))。
109
113
 
110
114
  「开头」保留的是辨识用的几个字符:有前缀的密钥留下前缀和它后面的 4 个,没有前缀的留前 4 个,长值再加末尾 2 个(`sk-proj-g6sx…3QaZ`),短值更少;个人信息和自定义词仍只留 1 个([ADR-0019](docs/adr/0019-hint.md))。
111
115
 
112
116
  记录按天写在一个按天命名的 `masking/YYYY-MM-DD.jsonl`,目录 0700、文件 0600。状态放在当前实例自己的目录里(`~/.dsh/profiles/<profile>/plugin-data/dsh-privacy-gateway/`),几个实例不会写到一起([ADR-0027](docs/adr/0027-per-instance-state.md))。写盘失败只告警,不影响请求。
113
117
 
114
- 插件详情页下方有一张统计卡:今日 / 7 天 / 30 天切换,计数、按 kind / finder / host 的分布、最近 200 条记录(每页 10 条,每条带着工作区 · 会话标题),点开一条看每个值的明细。卡片右上角的「清空数据」勾选确认后,删除所有会话的记录、统计和磁盘上的记录文件,无法恢复([ADR-0022](docs/adr/0022-reset.md))。打开 `showPanel` 后,同样的内容也出现在会话顶部的「隐私保护」标签页里,只统计当前会话。标签页头部的「本会话脱敏」开关可以只关掉这一个会话的脱敏,确认后生效,其他会话照常脱敏,重启后仍然保持([ADR-0023](docs/adr/0023-session-switch.md))。
118
+ 插件详情页下方有一张统计卡:今日 / 7 天 / 30 天切换,计数、按 kind / finder / host 的分布、最近 200 条记录(每页 10 条,每条带着时间、这次请求在第几轮第几步发出(行上写作 `42·3`,与「轨迹」标签页的编号一致;窄屏隐藏,明细里写全「这次请求在第 42 轮 · 第 3 步发出」)、工作区 · 会话标题),点开一条看每个值的明细:值下面一行标出它出现在哪条消息(「用户消息 · `messages.3`」,3 是请求 body 里消息的下标,从 0 起算,和「查看发出内容」里看到的 body 对得上)和前后文字,同一个值在别处也出现过的,再一行列出其余的(「还出现在 `messages.7`、`messages.9`」,超过 8 处只说还有多少处),据此可以直接回到那段对话里核对:每个值下面还会写它本次运行里首次被发出的是第几轮第几步(重启后重新计),轮次和步数说这次请求是哪一步发出的,消息序号说值在那次请求的哪条消息里(记录里没有轮次步数的老记录、以及不在某一步里发出的请求,这一列留空)。注意它是**发出**的那一步:某一步的输出要到下一步的请求里才发出去,所以按值在轨迹里搜到的往往是更早一步,值下面标着「模型回复」就说明它来自更早的一条回复。卡片右上角的「清空数据」勾选确认后,删除所有会话的记录、统计和磁盘上的记录文件,无法恢复([ADR-0022](docs/adr/0022-reset.md))。打开 `showPanel` 后,同样的内容也出现在会话顶部的「隐私保护」标签页里,只统计当前会话。标签页头部的「本会话脱敏」开关可以只关掉这一个会话的脱敏,确认后生效,其他会话照常脱敏,重启后仍然保持([ADR-0023](docs/adr/0023-session-switch.md))。
115
119
 
116
120
  打开 `vendorView`(配置页上叫「保留发出内容,供对照查看」)后,记录明细里多一个「查看发出内容」按钮,用来核对模型服务实际收到了什么、有没有漏脱敏:右边是模型服务收到的原文,左边是同一份内容里每个替换处换成「kind · 开头 · 长度」的标记,默认只列有替换的行。两边都不出现真值,warn 照发的值在副本里也换成了占位符。
117
121
 
@@ -119,7 +123,7 @@ someone@gmail.com → EMAIL
119
123
 
120
124
  - 会话日志里是真值:还原发生在日志落盘之前([ADR-0003](docs/adr/0003-restore-before-session-log.md))。会话同步、备份、分享带走的是真值。
121
125
  - 覆盖面只有走全局 `fetch()` 的流量;`node:http` 直连、worker 线程、独立进程不经过网关([ADR-0001](docs/adr/0001-intercept-at-undici-global-dispatcher.md))。
122
- - 压缩的请求与回复先解压再脱敏、还原;认不出的 `content-encoding` 不发([ADR-0025](docs/adr/0025-compression-and-upgrades.md))。带 `upgrade` 的握手(WebSocket)也不发:Codex 第一次被拒后回落到 SSE,之后同一会话直接走 SSE;其他插件经全局 dispatcher 打开的 WebSocket 同样被拒,需要时把它的 host 加进 `excludeHosts`。
126
+ - 压缩的请求与回复先解压再脱敏、还原;认不出的 `content-encoding` 不发([ADR-0025](docs/adr/0025-compression-and-upgrades.md))。模型调用里的 `upgrade` 握手(WebSocket)与 `CONNECT` 隧道也不发:Codex 第一次被拒后回落到 SSE,之后同一会话直接走 SSE;模型调用之外的升级与隧道(别的插件自己的连接,如 dsh-im-infoflow 的入站)放行,消息不脱敏,每个 host 提示一次([ADR-0032](docs/adr/0032-upgrade-scoped-to-masked-calls.md))——这是 fail-closed 往 fail-open 的取舍,代价见 ADR;需要整条链路放行的 host 仍可加进 `excludeHosts`。
123
127
  - 值表只在内存里([ADR-0009](docs/adr/0009-value-table-and-restore-exfiltration.md))。重启后,规则命不中、只靠记忆兜住的值第一次出站会按原文发出。
124
128
  - 还原发生在回复里,包括工具调用参数:模型被诱导把占位符写进 `curl` 之类的命令时,工具执行时用的是真值。插件只记账(统计卡与 `/privacy status` 里的「工具参数」计数),不拦截([ADR-0009](docs/adr/0009-value-table-and-restore-exfiltration.md))。
125
129
  - 脱敏出错时请求不会发出,报错 `dsh-privacy-gateway: masking failed, request not sent`([ADR-0005](docs/adr/0005-fail-closed.md))。止血办法是 `/privacy off`,或在插件页停用本插件、把配置 `enabled` 设为 `false`。