dsh-plugin-wsl-env 0.24.0 → 0.26.0

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.
Files changed (94) hide show
  1. package/CHANGELOG.md +136 -0
  2. package/CODE_OF_CONDUCT.md +85 -0
  3. package/CODE_OF_CONDUCT.zh.md +85 -0
  4. package/CONTRIBUTING.md +19 -3
  5. package/CONTRIBUTING.zh.md +200 -0
  6. package/README.md +18 -6
  7. package/SECURITY.md +12 -0
  8. package/SECURITY.zh.md +108 -0
  9. package/SUPPORT.md +2 -0
  10. package/SUPPORT.zh.md +99 -0
  11. package/client.js +409 -8
  12. package/cordis.patch.yml +17 -0
  13. package/docs/AGENT-PROTOCOL-V7.md +2 -2
  14. package/docs/API.md +2 -0
  15. package/docs/API.zh.md +38 -0
  16. package/docs/ARCHITECTURE.md +30 -9
  17. package/docs/ARCHITECTURE.zh.md +511 -0
  18. package/docs/COMPATIBILITY.md +2 -0
  19. package/docs/COMPATIBILITY.zh.md +117 -0
  20. package/docs/CONFIGURATION.md +45 -2
  21. package/docs/CONFIGURATION.zh.md +39 -3
  22. package/docs/DIAGNOSTICS.md +12 -2
  23. package/docs/DIAGNOSTICS.zh.md +5 -1
  24. package/docs/LIMITATIONS.md +60 -9
  25. package/docs/LIMITATIONS.zh.md +45 -9
  26. package/docs/MIGRATION.md +6 -3
  27. package/docs/MIGRATION.zh.md +91 -0
  28. package/docs/PEER-PARITY.md +63 -51
  29. package/docs/PERFORMANCE.md +2 -0
  30. package/docs/PERFORMANCE.zh.md +59 -0
  31. package/docs/QUICKSTART.md +21 -6
  32. package/docs/QUICKSTART.zh.md +16 -4
  33. package/docs/README.zh.md +28 -19
  34. package/docs/RELEASING.md +19 -14
  35. package/docs/REQUIREMENTS.zh.md +6 -3
  36. package/docs/ROADMAP-1.0.md +1 -1
  37. package/docs/UPSTREAM-FILE-REFERENCE-SEAM.md +1 -1
  38. package/docs/UPSTREAM-FSIO-EXPORT.md +5 -4
  39. package/docs/UPSTREAM-OPEN-IN-APP.md +33 -11
  40. package/docs/UPSTREAM-PROMPT-ADAPTERS.md +85 -0
  41. package/docs/UPSTREAM-SESSION-NOTICE.md +7 -0
  42. package/docs/VALUE.md +146 -0
  43. package/docs/VALUE.zh.md +15 -13
  44. package/docs/root-fs-routing.md +1 -1
  45. package/lib/agent-confined.d.ts +7 -1
  46. package/lib/agent-confined.js +3 -3
  47. package/lib/auto-preset-seam.d.ts +45 -0
  48. package/lib/auto-preset-seam.js +47 -0
  49. package/lib/auto-preset.d.ts +33 -10
  50. package/lib/auto-preset.js +148 -44
  51. package/lib/bwrap.d.ts +14 -0
  52. package/lib/bwrap.js +11 -0
  53. package/lib/cwd-prompt.d.ts +41 -3
  54. package/lib/cwd-prompt.js +125 -8
  55. package/lib/doctor-live.d.ts +30 -0
  56. package/lib/doctor-live.js +37 -0
  57. package/lib/doctor-report.d.ts +50 -0
  58. package/lib/doctor-report.js +172 -0
  59. package/lib/fs-routing.d.ts +1 -1
  60. package/lib/fs-routing.js +1 -1
  61. package/lib/fs.d.ts +1 -1
  62. package/lib/fs.js +1 -1
  63. package/lib/index.d.ts +6 -1464
  64. package/lib/index.js +5 -2120
  65. package/lib/messages.d.ts +20 -1
  66. package/lib/messages.js +31 -3
  67. package/lib/open-in-app.d.ts +206 -0
  68. package/lib/open-in-app.js +300 -0
  69. package/lib/preflight.d.ts +7 -4
  70. package/lib/preflight.js +27 -13
  71. package/lib/preset-choice.d.ts +13 -0
  72. package/lib/preset-choice.js +18 -1
  73. package/lib/provider-common.d.ts +58 -0
  74. package/lib/provider-common.js +123 -0
  75. package/lib/sandbox-core.d.ts +1 -0
  76. package/lib/sandbox-core.js +4 -2
  77. package/lib/session-runtime.d.ts +7 -1
  78. package/lib/session-runtime.js +9 -2
  79. package/lib/shell.d.ts +1 -1
  80. package/lib/shell.js +1 -1
  81. package/lib/status.js +2 -1
  82. package/lib/writable-roots.d.ts +109 -0
  83. package/lib/writable-roots.js +257 -0
  84. package/lib/wsl-doctor-command.js +2 -1
  85. package/lib/wsl-doctor-tool.js +2 -2
  86. package/lib/wsl-filesystem.d.ts +692 -0
  87. package/lib/wsl-filesystem.js +897 -0
  88. package/lib/wsl-shell.d.ts +742 -0
  89. package/lib/wsl-shell.js +965 -0
  90. package/lib/wsl.d.ts +1 -1
  91. package/lib/wsl.js +1 -1
  92. package/package.json +48 -24
  93. package/scripts/doctor.mjs +1 -1
  94. package/scripts/profile-preset.mjs +17 -5
package/README.md CHANGED
@@ -37,7 +37,7 @@ Use this plugin when the harness has to stay on Windows:
37
37
 
38
38
  Mixing the two has one trap: the `desktop` profile name is owned by the Electron
39
39
  app, and the npm CLI refuses to manage that profile's plugins — use the app's
40
- Plugins page for it. [docs/VALUE.zh.md](docs/VALUE.zh.md) has the full
40
+ Plugins page for it. [docs/VALUE.md](docs/VALUE.md) has the full
41
41
  comparison and the cases this plugin is not for.
42
42
 
43
43
  ## Why this plugin
@@ -48,7 +48,7 @@ A Windows coding tool that works on WSL projects has three options: run the whol
48
48
  - **No service in the distro.** There is no helper server, no daemon and no listening port. The only persisted artifact is a content-addressed copy of the native agent in `~/.cache/dsh-wsl/agent/`.
49
49
  - **Sandboxed by default.** Confined commands run under `bubblewrap` inside the distro. If `bubblewrap` is missing, the command fails; it does not run unconfined.
50
50
  - **Per-session.** A session opened on a distro folder gets the distro environment. A session opened on a Windows folder keeps the normal Windows tools. Both can run in one harness process.
51
- - **Integrated with the GUI.** The folder picker lists installed distros, the terminal opens a shell in the distro, and the model can see listening ports. The sidebar's **WSL environment** panel runs a quick doctor check per distro — host-side, no model turn — and the session-start preflight announces the environment verdict on every session.
51
+ - **Integrated with the GUI.** The folder picker lists installed distros, the terminal opens a shell in the distro, and the model can see listening ports. The sidebar's **WSL environment** panel runs a quick doctor check per distro — host-side, no model turn — and the session-start preflight logs the environment verdict on every session, adding a blocked verdict to the session's context.
52
52
 
53
53
  ### Why Linux, not PowerShell
54
54
 
@@ -100,6 +100,12 @@ no arguments. The app opens the profile it is configured with — the one the
100
100
  Plugins page writes into — so a different profile is a CLI-distribution thing
101
101
  (`dsh --profile <name>`).
102
102
 
103
+ **No host patch.** The plugin never edits the installed
104
+ `resources/app.asar`. The **在 VS Code 中打开(WSL)** bridge is a plugin row, so
105
+ an app upgrade cannot drop it and a plugin update only needs reinstall plus
106
+ restart — there is no archive re-patch step. The shipped "Open in app" item is a
107
+ separate upstream defect; see [docs/UPSTREAM-OPEN-IN-APP.md](docs/UPSTREAM-OPEN-IN-APP.md).
108
+
103
109
  **CLI distribution** (`dsh` on `PATH`), in a Windows terminal:
104
110
 
105
111
  ```powershell
@@ -115,7 +121,7 @@ Install `bubblewrap` before the first command:
115
121
  wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
116
122
  ```
117
123
 
118
- From a checkout, `pnpm run doctor` is the one-command environment check: the Windows/WSL platform, the per-distro WSL mode and identity, `.wslconfig` and `/etc/wsl.conf` cross-checks, the distro and host volumes, clock and DNS, bubblewrap usability, systemd / the user manager / Linger, the optional tools, peer versions, the native agent and its cache, a fresh-agent handshake, the shell smoke legs that prove the chain (frame I/O, the confined fence, the batched substrate) and a native HELLO leg, stale session scopes, and the known profile-patch and deprecated-key traps. The report itemizes every check — grouped by distro, each with an explicit status marker and a copy-paste remedy under every failure — and ends in a verdict, `ready` (the first command should succeed) or `blocked` (the named checks to fix), computed under the effective configuration. A run can be scoped: `--quick` probes the first-command prerequisites only (~10 s), `--sections <list>` (comma-separated) runs the named sections, and a scoped report lists the checks it did not run as explicit skips. `--json` is the machine contract; `--fix` re-verifies what it fixed — the plugin-owned stale-scope sweep and agent-cache purge are safe and automatic, packages need `--fix --install` and an explicit confirmation, and `--fix-owned` narrows a run to the plugin-owned two — `--all` checks every installed distro, and `--bundle <path>` writes the diagnostic file a setup report attaches (`--redact` strips the paths). The fixed skeleton renders in the host's language — detected from the Windows locale, overridable with `--locale <tag>` or `DSH_WSL_DOCTOR_LOCALE`; `--json` stays language-independent. The same report answers through three surfaces: this CLI, the `/wsl-doctor` command (typed in the composer — host-side, no model turn), and the `wsl_doctor` model tool (in-process, merging the live resident's state). `DSH_WSL_DOCTOR` additionally carries a ready-to-run command (`sh -c "$DSH_WSL_DOCTOR --json"`) that replays the doctor inside the distro. `pnpm run diagnose` is the CLI's read-only alias. `pnpm run bootstrap <distro>` remains the narrower tool-install helper.
124
+ From a checkout, `pnpm run doctor` is the one-command environment check: the Windows/WSL platform, the per-distro WSL mode and identity, `.wslconfig` and `/etc/wsl.conf` cross-checks, the distro and host volumes, clock and DNS, bubblewrap usability, systemd / the user manager / Linger, the optional tools, peer versions, the native agent and its cache, a fresh-agent handshake, the shell smoke legs that prove the chain (frame I/O, the confined fence, the batched substrate) and a native HELLO leg, stale session scopes, and the known profile-patch and deprecated-key traps. The report itemizes every check — grouped by distro, each with an explicit status marker and a copy-paste remedy under every failure — and ends in a verdict, `ready` (every check that run covered passed — not a promise about a later command) or `blocked` (the named checks to fix), computed under the effective configuration. A run can be scoped: `--quick` probes the first-command prerequisites only (~10 s), `--sections <list>` (comma-separated) runs the named sections, and a scoped report lists the checks it did not run as explicit skips. `--json` is the machine contract; `--fix` re-verifies what it fixed — the plugin-owned stale-scope sweep and agent-cache purge are safe and automatic, packages need `--fix --install` and an explicit confirmation, and `--fix-owned` narrows a run to the plugin-owned two — `--all` checks every installed distro, and `--bundle <path>` writes the diagnostic file a setup report attaches (`--redact` strips the paths). The fixed skeleton renders in the host's language — detected from the Windows locale, overridable with `--locale <tag>` or `DSH_WSL_DOCTOR_LOCALE`; `--json` stays language-independent. The same report answers through three surfaces: this CLI, the `/wsl-doctor` command (typed in the composer — host-side, no model turn), and the `wsl_doctor` model tool (in-process, merging the live resident's state). `DSH_WSL_DOCTOR` additionally carries a ready-to-run command (`sh -c "$DSH_WSL_DOCTOR --json"`) that replays the doctor inside the distro. `pnpm run diagnose` is the CLI's read-only alias. `pnpm run bootstrap <distro>` remains the narrower tool-install helper.
119
125
 
120
126
  The plugin notices its own updates about once a day (first check 2–10 minutes after startup) by asking the app's plugin manager — it never fetches on its own. When a newer stable release exists, the managed `DSH_WSL_PLUGIN_UPDATE` variable in every distro session carries the fact; `wsl-update-check.enabled: false` in the patch config turns the check off. Upgrading stays manual, because the harness has no hot reload: install again (Plugins page, or the `add` command), then restart. Uninstall on
121
127
  the Plugins page, or with `dsh plugin --profile wsl remove dsh-plugin-wsl-env`
@@ -133,7 +139,7 @@ Open a distro folder as the workspace, for example `\\wsl.localhost\ubuntu\home\
133
139
  - **New terminal** opens a shell in the same distro and directory.
134
140
  - The model sees listening ports and can return the URL of a dev server. WSL 2 forwards localhost to Windows.
135
141
  - The Permissions selector offers `read-only`, `workspace-write` (default) and `danger-full-access`. Only `danger-full-access` runs without the sandbox.
136
- - The sidebar's **WSL environment** panel is the diagnostic page: the installed distros, an on-demand quick doctor check per distro (bwrap / systemd / Linger and the other prerequisites), and a full-run action (`--fix-owned`, labeled **修复** when a finding is one the plugin can repair and **完整检查** otherwise) that sweeps stale session scopes and purges a broken agent cache, then re-verifies both — without touching packages or Windows-owned configuration; every other warning keeps its manual remedy. Each checked row also states when the check ran, where it came from (**手动** or the page-load **后台** refresh), and how its results landed — the per-status totals and the per-section tallies. Each checked row also expands to the full list of checks that run executed, grouped by section with each status and its evidence (the catalog rows a quick run never touched are counted, not listed), so a green or blocked row can be audited instead of trusted. The next action is visible without opening the doctor. The last result per distro is stored under `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json` (falling back to `~/.dsh`), so a page reload or an app restart still shows it; on load, stored results for distros that are currently running are re-checked in the background (never a stopped one), and a failed background run replaces the stored result exactly as observed. No result is labeled expired: the timestamp is the timestamp. **Add workspace** on a distro folder asks once between **Remote WSL** (the default, everything runs in the distro) and **Windows access** (the folder as a 9p share, without the Linux toolchain), recorded in the `auto-preset` row's `windowsWorkspaces`.
142
+ - The sidebar's **WSL environment** panel is the diagnostic page: the installed distros, an on-demand quick doctor check per distro (bwrap / systemd / Linger and the other prerequisites), and a full-run action (`--fix-owned`, labeled **修复** when a finding is one the plugin can repair and **完整检查** otherwise) that sweeps stale session scopes and purges a broken agent cache, then re-verifies both — without touching packages or Windows-owned configuration; every other warning keeps its manual remedy. Each checked row also states when the check ran, where it came from (**手动** or the page-load **后台** refresh), and how its results landed — the per-status totals and the per-section tallies. Each checked row also expands to the full list of checks that run executed, grouped by section with each status and its evidence (the catalog rows a quick run never touched are counted, not listed), so a green or blocked row can be audited instead of trusted. The next action is visible without opening the doctor. The last result per distro is stored under `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json` (falling back to `~/.dsh`), so a page reload or an app restart still shows it; on load, stored results for distros that are currently running are re-checked in the background (never a stopped one), and a failed background run replaces the stored result exactly as observed. No result is labeled expired: the timestamp is the timestamp. **Add workspace** on a distro folder asks once between **Remote WSL** (the default, everything runs in the distro) and **Windows access** (the folder as a 9p share, without the Linux toolchain), recorded in the `auto-preset` row's `windowsWorkspaces`. Those recorded directories are also called out where the consequence is felt: a distro workspace running a non-WSL preset keeps a warning above the composer (a one-click switch while the session is still blank, and the durable access-record fix once a turn has started), the session header keeps a small **WSL工作区正以Windows模式打开** marker after the warning is collapsed, and the panel lists the recorded directories for audit.
137
143
 
138
144
  ## Configure
139
145
 
@@ -146,11 +152,13 @@ Settings live on named rows in `$DSH_HOME/profiles/<name>/cordis.patch.yml`. The
146
152
  | | `sessionSandbox` | `false`; shipped `true` | run the session's commands in one systemd user scope |
147
153
  | | `agentBackend` | `auto` | `auto`, `native` or `shell` for the in-distro agent |
148
154
  | | `maskWindowsDrive` | `false` | hide `/mnt` from confined commands |
155
+ | | `writableRoots` | `[]` | extra distro directories to grant (toolchain caches; put the same list on `wsl-fs`) |
149
156
  | `wsl-fs` | `distro` | `''` | distro mode; empty/`auto` follows each target path |
150
157
  | | `restrictToDistro` | `true` | under a fixed distro, refuse paths that belong to another distro |
151
158
  | | `sandbox` | `true` | check confined writes against the policy |
152
159
  | | `sessionSandbox` | `false`; shipped `true` | run confined writes in the session runtime |
153
160
  | | `substrate` | `agent` | in-distro agent; `share` is rejected at startup |
161
+ | | `writableRoots` | `[]` | the same extra-writable list as `wsl-shell` |
154
162
  | `directory-picker-wsl` | `includeHostHome` | `true` | also offer the Windows path branch (starting at the drives) |
155
163
  | `subprocess-wsl` | `distro` | `''` | distro mode; empty/`auto` follows the launch directory |
156
164
  | `wsl-preflight` | `distro` | `''` | distro the environment checks probe; empty/`auto` follows the session workspace |
@@ -189,7 +197,7 @@ wsl preset (per session)
189
197
  | Mode | What a command can do |
190
198
  |---|---|
191
199
  | `read-only` | read the whole distro; a fresh `/dev` is mounted, nothing else is writable |
192
- | `workspace-write` | the above, plus the session workspace; `/tmp` is the distro's real `/tmp` with the session runtime |
200
+ | `workspace-write` | the above, plus the session workspace and any configured `writableRoots`; `/tmp` is the distro's real `/tmp` with the session runtime |
193
201
  | `danger-full-access` | no sandbox |
194
202
 
195
203
  With `sessionSandbox: false`, a `workspace-write` command gets a private `/tmp` instead of the distro's real one. `read-only` does not mount a writable `/tmp`.
@@ -205,6 +213,7 @@ Enforcement is reported as `partial`. A command inside the distro can still star
205
213
  | every command reports `SANDBOX_UNAVAILABLE` | install `bubblewrap` in the distro, or set `sandbox: false` |
206
214
  | the session refuses before the first command | run `pnpm run doctor`; enable systemd and linger, or set `sessionSandbox` to `auto` or `false` on `wsl-shell` and `wsl-fs` |
207
215
  | `glob` and `grep` are slow in the distro | run `pnpm run bootstrap <distro>` and use its printed install command to install `ripgrep` |
216
+ | `npm install` / `pnpm add` fail with `EROFS` | the sandbox grants only the workspace by default; configure `writableRoots` on `wsl-shell` and `wsl-fs` (e.g. `~/.npm`, `~/.cache`, `~/.local/share/pnpm`); see [CONFIGURATION](docs/CONFIGURATION.md#toolchain-caches-and-extra-writable-roots) |
208
217
  | `dsh plugin add` prints nothing, or the Plugins page finishes without feedback | trust the profile's `package.json` and its `dsh.profile.bundles` entry: the plugin listed there is installed |
209
218
  | a profile patch for `wsl-shell`/`wsl-fs` changes nothing | those rows are nested inside `preset-wsl`. Run `pnpm run preset --check <patch>`; it fails with the complete block to paste |
210
219
  | changes under `lib/` have no effect | run `pnpm run sync:windows`, then restart the app |
@@ -225,6 +234,9 @@ The toolchain follows the harness host: Node `^22.19.0 || >=24.0.0`. `src/` is T
225
234
 
226
235
  Real-machine probes run on Windows + WSL only. See [CONTRIBUTING.md](CONTRIBUTING.md) and `test/probe/`.
227
236
 
237
+ Community-facing documents are available in English and Chinese. The Chinese
238
+ README is [docs/README.zh.md](docs/README.zh.md).
239
+
228
240
  ## Documentation
229
241
 
230
242
  | Document | Content |
@@ -239,7 +251,7 @@ Real-machine probes run on Windows + WSL only. See [CONTRIBUTING.md](CONTRIBUTIN
239
251
  | [docs/LIMITATIONS.md](docs/LIMITATIONS.md) | what the plugin does not do |
240
252
  | [docs/ROADMAP.md](docs/ROADMAP.md) | current plan and deferred work |
241
253
  | [docs/ROADMAP-1.0.md](docs/ROADMAP-1.0.md) | the 1.0 and ecosystem plan |
242
- | [docs/VALUE.zh.md](docs/VALUE.zh.md) | value and trade-offs in Chinese |
254
+ | [docs/VALUE.md](docs/VALUE.md) | value and trade-offs |
243
255
  | [CONTRIBUTING.md](CONTRIBUTING.md) | development loop, gates, probes |
244
256
  | [SECURITY.md](SECURITY.md) | private vulnerability reporting |
245
257
  | [SUPPORT.md](SUPPORT.md) | supported versions and support channels |
package/SECURITY.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Security policy
2
2
 
3
+ [中文](SECURITY.zh.md)
4
+
3
5
  ## Supported versions
4
6
 
5
7
  Only the latest published version receives security fixes.
@@ -103,6 +105,16 @@ A report is still welcome if you find an escape that does not depend on interop,
103
105
  if the masked profile is bypassable from `/mnt`, or if the plugin ever reports
104
106
  `full` while interop is reachable.
105
107
 
108
+ One escape of that kind is known and unfixed: a confined command can ask the
109
+ distro user's own service manager to start a unit, and that unit runs outside the
110
+ mount profile — a write to the distro user's home succeeds where the same write
111
+ from inside the fence is refused. Masking `/mnt` does not narrow this path
112
+ because it never involves interop. The socket paths and the reproduction steps are
113
+ withheld until a fix ships; the finding, its verification and the deferred
114
+ decision are recorded in
115
+ [docs/superpowers/value-discovery-2026-11-10.md](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/docs/superpowers/value-discovery-2026-11-10.md)
116
+ (E4). Report new instances through the private channel above, as with any escape.
117
+
106
118
  ## Credentials
107
119
 
108
120
  No credential, token, or private key belongs in this repository. That includes npm
package/SECURITY.zh.md ADDED
@@ -0,0 +1,108 @@
1
+ # 安全政策
2
+
3
+ [English](SECURITY.md)
4
+
5
+ ## 支持的版本
6
+
7
+ 只有最新发布版本会获得安全修复。
8
+
9
+ | 版本 | 是否支持 |
10
+ |---|---|
11
+ | npm 的 `latest` 标签所指向的版本 | 是 |
12
+ | 所有更早版本 | 否 |
13
+
14
+ ## 报告漏洞
15
+
16
+ 私下报告疑似漏洞。使用本仓库的 GitHub 私有漏洞报告:
17
+
18
+ https://github.com/Big-Dao/dsh-plugin-wsl-env/security/advisories/new
19
+
20
+ 如果你无法使用该表单,请开一个普通 issue 索取私有渠道。不要在该 issue 中写入
21
+ 利用细节。维护者会回复一个可私下发送细节的渠道。
22
+
23
+ 在修复发布之前,不要在公开 issue、discussion 或 pull request 中发布利用细节。
24
+
25
+ ## 报告应包含的内容
26
+
27
+ - 你测试的插件版本。`npm ls dsh-plugin-wsl-env` 会打印它,或注明你构建所用的
28
+ tag。
29
+ - 你的 Windows 版本与你使用的发行版。`wsl.exe -l -v` 列出各发行版。
30
+ - DSH 版本与 profile 名称。
31
+ - 你期望发生什么,实际发生了什么。
32
+ - 你能构造的最小复现,附精确命令。
33
+ - 当时是否启用了沙箱。`sandbox: true` 是默认值。
34
+
35
+ ## 响应时间
36
+
37
+ 这些是目标,不是承诺。
38
+
39
+ | 阶段 | 目标 |
40
+ |---|---|
41
+ | 确认收到报告 | 3 个工作日内 |
42
+ | 初步评估与严重性判定 | 10 个工作日内 |
43
+ | 修复,或已记录的缓解措施 | 30 个工作日内 |
44
+
45
+ 如果报告不在范围内,我们会说明并解释原因。
46
+
47
+ ## 披露
48
+
49
+ 确认的漏洞通过常规发布流程修复与披露,而不是单独的安全流程。
50
+
51
+ - 修复随包的下一个版本发布;上方的“支持的版本”表只覆盖该版本。
52
+ - 该版本在 [`CHANGELOG.md`](CHANGELOG.md) 中记录修复,GitHub
53
+ Release 说明取自该节。
54
+ - 携带修复的版本发布后,公告会发布在本仓库的 Security 标签页,即私有报告
55
+ 提交之处。
56
+
57
+ 不在范围内、或无法确认为漏洞的报告会被关闭,不发布公告。
58
+
59
+ ## 范围
60
+
61
+ 在范围内:
62
+
63
+ - 插件自身 `lib/` 下的代码;
64
+ - 已发布的包 `dsh-plugin-wsl-env`。
65
+
66
+ 不在范围内:
67
+
68
+ - `@deepseek-ai/` 下的上游 DSH 包。请报告给各自的项目。
69
+ - WSL 本身、Windows 内核,以及 `bubblewrap`。
70
+ - 用户自己发行版的配置。这包括其 `sudoers` 规则、挂载的文件系统,以及其中
71
+ 安装的解释器。
72
+ - 任何需要攻击者已经控制用户的 Windows 账户或其发行版账户的情形。
73
+
74
+ ## 沙箱隔离按设计为 `partial`
75
+
76
+ 插件将沙箱隔离级别报告为 `partial`,而非 `full`。发行版内的进程仍可通过
77
+ WSL interop 启动 Windows 程序,例如 `/mnt/c/.../*.exe`。该程序在 Linux
78
+ 沙箱之外运行。
79
+
80
+ 这是已记录的设计边界,本身不是漏洞。在发行版内运行
81
+ `npm run probe:sandbox` 会在你的机器上演示这一点;发行版内必须安装
82
+ `bubblewrap` 与 `node`。README 的“沙箱”一节对此有说明。
83
+
84
+ 严格 profile(`maskWindowsDrive: true` 配合 `sandbox: true`,且没有覆盖性的
85
+ `interopVisibility: visible`)会收窄这一点:
86
+ 受限 profile 用空的 tmpfs 遮蔽 `/mnt`,因此无法从那里启动 `/mnt` 路径下的
87
+ 可执行文件。其他挂载点与不受约束的文件读取不在覆盖范围内。它并未堵死这个
88
+ 洞——写入工作区的 Windows 可执行文件仍会运行,因为 WSL 的 `binfmt_misc`
89
+ 按内容而非位置分派——所以上报的隔离级别仍是 `partial`。彻底关闭需要发行版
90
+ 级别(`/etc/wsl.conf` 中的 `[interop] enabled=false`)。三种状态及其证据列在
91
+ [docs/CONFIGURATION.md](docs/CONFIGURATION.zh.md#windows-interop) 的表中。
92
+
93
+ 如果你发现不依赖 interop 的逃逸、遮蔽后的 profile 可从 `/mnt` 绕过,或插件
94
+ 在 interop 可达时报告 `full`,仍欢迎报告。
95
+
96
+ 已知有一类逃逸尚未修复:受限命令可以请求发行版用户自己的服务管理器启动一个
97
+ unit,而该 unit 在挂载 profile 之外运行——对发行版用户主目录的写入会成功,
98
+ 而围栏内同样的写入会被拒绝。遮蔽 `/mnt` 不能收窄这条路径,因为它从不涉及
99
+ interop。在修复发布前,socket 路径与复现步骤暂不公开;发现、验证与推迟决定
100
+ 记录在
101
+ [docs/superpowers/value-discovery-2026-11-10.md](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/docs/superpowers/value-discovery-2026-11-10.md)
102
+ (E4)。与其他逃逸一样,请通过上方的私有渠道报告新实例。
103
+
104
+ ## 凭据
105
+
106
+ 本仓库不应包含任何凭据、token 或私钥,包括 npm token、GitHub token 和发行版
107
+ 密码。如果你发现此类内容被提交到这里,请通过上方的私有渠道报告。不要为此
108
+ 开公开 issue。
package/SUPPORT.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Support
2
2
 
3
+ [中文](SUPPORT.zh.md)
4
+
3
5
  ## What is supported
4
6
 
5
7
  | Area | Supported |
package/SUPPORT.zh.md ADDED
@@ -0,0 +1,99 @@
1
+ # 支持政策
2
+
3
+ [English](SUPPORT.md)
4
+
5
+ ## 支持范围
6
+
7
+ | 领域 | 支持情况 |
8
+ |---|---|
9
+ | 操作系统 | Windows 10 与 Windows 11 |
10
+ | Linux 侧 | WSL2,至少一个发行版;随包的会话 runtime 需要 systemd 作为 PID 1,并启用 lingering 用户管理器(`loginctl enable-linger`)。若要在 preset 中保留逐命令沙箱,请在 `wsl-shell` 和 `wsl-fs` 上都设置 `sessionSandbox: false` |
11
+ | DSH 包 | `peerDependencies` 声明 `0.2.2-rc.1` 下限;更新的版本需要兼容性验证 |
12
+ | 插件版本 | 仅最新发布版本 |
13
+ | Node | 22.19+(`^22.19.0`),或 24 及以后(`>=24.0.0`) |
14
+
15
+ DSH 这一行每周检查:`.github/workflows/peer-canary.yml` 解析每个钉定 peer 的
16
+ `next` dist-tag,将该版本线安装到临时副本,并运行 `pnpm test` 与组合启动测试。
17
+ 成功运行会在摘要中打印确切的版本差异;请据此更新上表。运行失败(红色)表示
18
+ 插件尚未针对新版本线验证。
19
+
20
+ Node 20 被有意排除在区间外:下限就是 harness 宿主自身的版本,CI 覆盖 22 与 24。
21
+ `package.json` 中的 `engines` 才是权威声明,而不是本表。
22
+
23
+ 在 Windows 之外,插件没有可接入的对象。它通过 `wsl.exe` 在发行版内运行
24
+ `ctx.shell`。Linux 宿主、macOS 宿主或 WSL1 都不是受支持的配置。
25
+
26
+ ## 获取帮助
27
+
28
+ 在仓库中开一个 issue:
29
+
30
+ https://github.com/Big-Dao/dsh-plugin-wsl-env/issues/new/choose
31
+
32
+ 选择器提供 **feature request** 与 **setup report**;setup report 要求提供
33
+ `doctor --json` 输出,这正是让首次运行问题无需往返即可诊断的关键。安全 issue
34
+ 请改用私有公告链接(见 [SECURITY.md](SECURITY.zh.md))。
35
+
36
+ 用 issue 提交 bug 报告与配置问题。先搜索未关闭和已关闭的 issue,并检查答案
37
+ 是否已经成文:[docs/LIMITATIONS.md](docs/LIMITATIONS.zh.md) 列出已知的设计边界,
38
+ [README.md](docs/README.zh.md#常见问题) 中的“常见问题”表覆盖常见故障
39
+ (`SANDBOX_UNAVAILABLE`、缺少 `rg` 等)。
40
+
41
+ 安全 issue 请遵循 [SECURITY.md](SECURITY.zh.md)。不要为此开公开 issue。
42
+
43
+ ## 不支持的范围
44
+
45
+ - macOS,以及非 WSL2 的 Linux 宿主。
46
+ - 没有 WSL2 的 Windows。
47
+ - 修改过的 DSH 构建,或 harness 包的分支。
48
+ - 插件无法识别的发行版,即其探针报告的情况:`wsl.exe -l -q` 中没有发行版,
49
+ `$HOME` 为空或不是绝对路径,或 `getent passwd` / `$SHELL` 探针得不到绝对
50
+ shell。检测逻辑位于 `src/wsl.ts`。
51
+ - 没有 `bwrap` 的发行版。此类环境中的命令失败关闭,而不是无约束运行。
52
+ - 上游 `@deepseek-ai/*` 包。请报告给各自的项目。
53
+ - 第三方 npm 镜像。请从包发布所在的 registry 安装。
54
+
55
+ ## 兼容性预期
56
+
57
+ DSH peer 区间从 `0.2.2-rc.1` 开始;开发依赖为测试精确钉定该版本。Cordis 与
58
+ Schemastery 使用 caret peer 区间。接受的区间并不保证与每个更新的版本兼容:
59
+ 上游变更可能需要本插件发布新版本。
60
+
61
+ 没有长期支持分支。修复只进入最新版本。
62
+
63
+ ## 分类处理与发布节奏
64
+
65
+ - **路线图。** 公开计划是 [docs/ROADMAP-1.0.md](docs/ROADMAP-1.0.md);
66
+ 未关闭的 issue #5–#22 对应其 WSL-1xx/2xx/3xx 块。
67
+ - **分类目标。** `priority:P1` 报告在三个工作日内获得首次响应,尽力而为。
68
+ 安全报告遵循 [SECURITY.md](SECURITY.zh.md) 中的响应目标。
69
+ - **节奏。** 有值得发布的变化时发布,大约每两到四周一次;tag 工作流及其门禁见
70
+ [docs/RELEASING.md](docs/RELEASING.md),配置稳定性与迁移规则见
71
+ [docs/MIGRATION.md](docs/MIGRATION.zh.md)。没有长期支持分支。
72
+ - **Good first issues。** `good first issue` 标签标记无需先前上下文的改动;
73
+ [Good first issue 与贡献者路径](CONTRIBUTING.zh.md#good-first-issue-与贡献者路径)
74
+ 列出常见形态与领取方式。
75
+
76
+ ## 一份好的 bug 报告包含什么
77
+
78
+ 一条命令的路径:`pnpm run diagnose`(在插件的代码检出中运行,或
79
+ `bash scripts/diagnose.sh`)会收集下表的大部分内容——Windows 版本、WSL 状态、
80
+ 发行版、内核、包管理族、四个工具及其版本,以及 bwrap 功能探针——形成可直接
81
+ 粘贴的报告。先运行它,再补充它看不到的内容:
82
+
83
+ | 项目 | 获取方式 |
84
+ |---|---|
85
+ | 诊断报告 | `pnpm run diagnose <distro>`(只读;分享前审查并脱敏) |
86
+ | 插件版本 | `npm ls dsh-plugin-wsl-env`,或你构建所用的 git tag |
87
+ | DSH 版本 | 你运行的 harness 版本 |
88
+ | 合成配置 | 在 CLI 发行版上,`dsh --profile <name> --dump-config`(`dsh-plugin-wsl-env` 层及其修补的行)。桌面应用没有 `dsh` 命令;请改附 profile 的 `cordis.patch.yml` |
89
+ | 沙箱行为(深入) | 在发行版内运行(先 `wsl.exe -d <distro>`)`npm run probe:sandbox` 的输出——探针会调用 `bwrap` 并读取那里的 `lib/bwrap.js`,因此发行版内两者都需要 |
90
+ | 你期望什么、实际发生了什么 | 各写一段 |
91
+ | 复现 | 精确命令,或精确的点击顺序 |
92
+
93
+ 隐去你的用户名以及任何你不愿公开的路径。`--dump-config` 中有用的部分通常是
94
+ 层标题与被修补的行,而不是整个文件。
95
+
96
+ ## 响应时间
97
+
98
+ 这是一个利用业余时间维护的小项目。没有服务级别协议,也不保证响应时间。
99
+ 安全报告有自己的目标,列在 [SECURITY.md](SECURITY.zh.md)。