dsh-version-manager 0.1.6 → 0.1.7

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/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ ## 0.1.7
4
+
5
+ - Apply DSH Host/Origin and authentication admission to every HTTP route before owner authorization, body parsing or profile service access. Refuse missing, throwing and invalid synchronous checks.
6
+ - Refuse asynchronous host verdicts and consume rejected promises so an incompatible host check cannot leave an unhandled rejection.
7
+ - Apply the same synchronous contract to owner admission: consume rejected promises/thenables, refuse invalid rejection statuses and catch unreadable service or principal fields before any route work.
8
+ - Keep owner authorization, HTTP method checks, explicit write confirmation and route disposal. Add regressions for rejected asynchronous checks and unavailable connection services across all 16 routes.
9
+ - Retain the 0.1.6 client presentation and existing Node.js/DSH version ranges. See the [bilingual release notes](docs/release-notes-0.1.7.md).
10
+
11
+ ## 0.1.6
12
+
13
+ - Keep long names and source paths from squeezing version and action columns; contain table scrolling on narrow windows. See the [bilingual release notes](docs/release-notes-0.1.6.md).
package/README.md CHANGED
@@ -21,7 +21,7 @@
21
21
  Desktop: install the release `.tgz` through Extensions → Plugin Management → Add Plugin. For a Web profile you explicitly control:
22
22
 
23
23
  ```sh
24
- dsh plugin --profile web add dsh-version-manager@0.1.6
24
+ dsh plugin --profile web add dsh-version-manager@0.1.7
25
25
  ```
26
26
 
27
27
  Install into an existing Desktop/Web profile and open Version manager. Review inventory and the exact from → to update first; a new empty profile also needs the Web app bundle.
@@ -30,7 +30,7 @@ Install into an existing Desktop/Web profile and open Version manager. Review in
30
30
 
31
31
  | Item | Current source of truth |
32
32
  | --- | --- |
33
- | Source version | `0.1.6` · 以 [package.json](package.json) 为准 |
33
+ | Source version | `0.1.7` · see [package.json](package.json) |
34
34
  | Distribution | `npm` · [Releases](https://github.com/tangyixiao/dsh-version-manager/releases) |
35
35
  | DSH | `>=0.2.2-rc.1` |
36
36
  | Node.js | `>=22` |
@@ -40,6 +40,8 @@ Restore is not a full backup: restoring a plugin version does not roll back conf
40
40
 
41
41
  [Detailed usage, configuration and troubleshooting](docs/guide.en.md)
42
42
 
43
+ HTTP routes require the host's synchronous `connection.requestRejection(request)` check before owner authorization, request bodies or profile services. Missing, throwing or asynchronous checks refuse access. See the [0.1.7 release notes](docs/release-notes-0.1.7.md) and [changelog](CHANGELOG.md).
44
+
43
45
  ## Development and participation
44
46
 
45
47
  ```sh
package/README.zh-CN.md CHANGED
@@ -21,7 +21,7 @@
21
21
  Desktop:从发行页下载 `.tgz`,在“扩展 → 插件管理 → 添加插件”中安装。命令行示例用于你明确控制的 Web profile:
22
22
 
23
23
  ```sh
24
- dsh plugin --profile web add dsh-version-manager@0.1.6
24
+ dsh plugin --profile web add dsh-version-manager@0.1.7
25
25
  ```
26
26
 
27
27
  在原有 Desktop/Web profile 中安装并打开“版本管理”。先查看清单与更新预览,再确认具体 from → to;新建空 profile 还需要 Web 应用 bundle。
@@ -30,7 +30,7 @@ dsh plugin --profile web add dsh-version-manager@0.1.6
30
30
 
31
31
  | 项目 | 当前依据 |
32
32
  | --- | --- |
33
- | 源码版本 | `0.1.6` · 以 [package.json](package.json) 为准 |
33
+ | 源码版本 | `0.1.7` · 以 [package.json](package.json) 为准 |
34
34
  | 分发方式 | `npm` · [Releases](https://github.com/tangyixiao/dsh-version-manager/releases) |
35
35
  | DSH | `>=0.2.2-rc.1` |
36
36
  | Node.js | `>=22` |
@@ -40,6 +40,8 @@ dsh plugin --profile web add dsh-version-manager@0.1.6
40
40
 
41
41
  [Detailed guide](docs/guide.en.md)
42
42
 
43
+ HTTP 路由先调用宿主同步的 `connection.requestRejection(request)` 检查,再验证 owner 权限、读取请求体和访问 profile 服务。宿主检查缺失、抛错或返回异步结果时拒绝访问。参见 [0.1.7 发行说明](docs/release-notes-0.1.7.md)与[更新记录](CHANGELOG.md)。
44
+
43
45
  ## 开发与参与
44
46
 
45
47
  ```sh
@@ -0,0 +1,21 @@
1
+ # dsh-version-manager 0.1.7
2
+
3
+ ## 简体中文
4
+
5
+ - 将主分支已有的 HTTP 路由准入修复纳入发行包:全部 16 条路由先调用宿主 `connection.requestRejection(request)`,执行 Host/Origin 与身份检查,再验证 owner 权限、读取请求体和访问 profile 服务。
6
+ - 宿主检查缺失、抛错或返回非法值时拒绝访问。该接口必须同步返回 `undefined`、`401` 或 `403`;异步结果也拒绝,并消费其 Promise 拒绝,避免出现未处理拒绝。
7
+ - owner 准入同样要求同步结果;异步结果及不可读取的服务、拒绝状态或身份字段会安全拒绝,Promise/thenable 的拒绝被消费。
8
+ - 保留只允许 owner、HTTP 方法限制、写操作显式确认和路由卸载清理;新增异步拒绝及 connection 服务不可读的全路由回归测试。
9
+ - 已核对的官方 rc.3 宿主中,`requestRejection` 委托 `admit`,而 `admit` 本身已检查 Host/Origin;本次明确调用宿主公开检查接口并加强失败时拒绝访问的处理,不据此宣称该宿主已有准入绕过。
10
+ - 保留 0.1.6 的客户端布局和现有 Node.js `>=22`、DSH `>=0.2.2-rc.1` 声明。宿主必须提供上述同步准入接口;无法验证该接口时 HTTP 功能不可用。
11
+ - 更新既有 profile 中的插件后,确认宿主已重新加载新版,再打开版本管理。版本恢复仍不回滚配置、依赖树或 agent presets。
12
+
13
+ ## English
14
+
15
+ - Include the HTTP route admission fix already on main in the distribution: all 16 routes call the host's `connection.requestRejection(request)` for Host/Origin and authentication checks before owner authorization, body parsing or profile service access.
16
+ - Refuse access if the host check is missing, throws or returns an invalid value. The contract is synchronous and accepts only `undefined`, `401` or `403`. Asynchronous results are refused and their promise rejections are consumed to avoid unhandled rejections.
17
+ - Owner admission also requires a synchronous result. Asynchronous results and unreadable service, rejection or principal fields fail closed, and rejected promises/thenables are consumed.
18
+ - Preserve owner-only access, HTTP method checks, explicit write confirmation and route disposal. Add regressions across every route for rejected asynchronous verdicts and unavailable connection services.
19
+ - In the verified official rc.3 host, `requestRejection` delegates to `admit`, which already checks Host/Origin. This release explicitly uses the host's public check and strengthens fail-closed handling; it does not establish an admission bypass in that host.
20
+ - Retain the 0.1.6 client layout and declared Node.js `>=22` / DSH `>=0.2.2-rc.1` ranges. The host must provide the synchronous admission API above; HTTP features remain unavailable when that check cannot be verified.
21
+ - After updating the plugin in the existing profile, confirm that the host has reloaded the new version before opening Version manager. Version restore still does not roll back configuration, dependency trees or agent presets.
@@ -7,10 +7,10 @@
7
7
  * no work starts on its own: a refresh is a request, and a change is a request,
8
8
  * which keeps the plugin's cost equal to what the user asked for.
9
9
  *
10
- * Admission comes from `connection.admit(req)`, the same check the host applies
11
- * to its own browser traffic. When that service is absent the route refuses
12
- * rather than falling back to "it is localhost so it is fine" — a local port is
13
- * shared by every process on the machine.
10
+ * Every registered handler first calls `connection.requestRejection(req)` for
11
+ * the host's Host/Origin and authentication checks, then `connection.admit(req)`
12
+ * requires an owner principal. Missing or unverifiable admission refuses the
13
+ * request before its body or any profile service is read.
14
14
  *
15
15
  * @module dsh-version-manager/lib/host/routes
16
16
  */
@@ -107,23 +107,26 @@ export async function readJsonBody(request) {
107
107
  * @returns {{ ok: true, principal: string } | { ok: false, status: number }}
108
108
  */
109
109
  export function admit(ctx, request) {
110
- const connection = ctx?.get?.('connection')
111
- if (connection === undefined || connection === null || typeof connection.admit !== 'function') {
112
- // No admission service means no way to tell the browser from any other local
113
- // process. Refusing is the only answer that does not invent a security model.
114
- return { ok: false, status: 401 }
115
- }
116
- let admission
117
110
  try {
118
- admission = connection.admit(request)
111
+ const connection = ctx?.get?.('connection')
112
+ if (connection === undefined || connection === null || typeof connection.admit !== 'function') {
113
+ // No admission service means no way to tell the browser from any other local
114
+ // process. Refusing is the only answer that does not invent a security model.
115
+ return { ok: false, status: 401 }
116
+ }
117
+ const admission = connection.admit(request)
118
+ if (admission === null || typeof admission !== 'object') return { ok: false, status: 401 }
119
+ if (typeof admission.then === 'function') {
120
+ Promise.resolve(admission).catch(() => {})
121
+ return { ok: false, status: 401 }
122
+ }
123
+ if ('rejection' in admission) return { ok: false, status: admission.rejection === 403 ? 403 : 401 }
124
+ const kind = admission.peer?.principal?.kind
125
+ if (kind !== 'owner') return { ok: false, status: 403 }
126
+ return { ok: true, principal: kind }
119
127
  } catch {
120
128
  return { ok: false, status: 401 }
121
129
  }
122
- if (admission === null || typeof admission !== 'object') return { ok: false, status: 401 }
123
- if ('rejection' in admission) return { ok: false, status: admission.rejection }
124
- const kind = admission.peer?.principal?.kind
125
- if (kind !== 'owner') return { ok: false, status: 403 }
126
- return { ok: true, principal: kind }
127
130
  }
128
131
 
129
132
  /**
@@ -1209,7 +1212,35 @@ export function registerRoutes(ctx, scope) {
1209
1212
  const { webServer } = scope
1210
1213
  const disposers = []
1211
1214
  const publish = (path, handler) => {
1212
- const dispose = webServer.register({ kind: 'exact', path: `${ROUTE_BASE}${path}`, handler })
1215
+ const dispose = webServer.register({
1216
+ kind: 'exact',
1217
+ path: `${ROUTE_BASE}${path}`,
1218
+ handler: async (request, response) => {
1219
+ // webServer.register is a physical route registry, so it does not apply
1220
+ // Connection's trust fence for us. Only undefined is a verified pass
1221
+ // under the synchronous requestRejection contract (401 | 403 | undefined).
1222
+ let rejection = 401
1223
+ try {
1224
+ const connection = ctx?.get?.('connection')
1225
+ if (typeof connection?.requestRejection === 'function') {
1226
+ const verdict = connection.requestRejection(request)
1227
+ if (verdict === undefined || verdict === 401 || verdict === 403) rejection = verdict
1228
+ else if (typeof verdict?.then === 'function') {
1229
+ // An asynchronous verdict cannot authorize this synchronous fence.
1230
+ // Consume its rejection without letting it crash the host later.
1231
+ Promise.resolve(verdict).catch(() => {})
1232
+ }
1233
+ }
1234
+ } catch {
1235
+ // The host could not establish trust; no route work may start.
1236
+ }
1237
+ if (rejection !== undefined) {
1238
+ sendJson(response, rejection, { error: rejection === 403 ? 'forbidden' : 'unauthorized' })
1239
+ return
1240
+ }
1241
+ return handler(request, response)
1242
+ },
1243
+ })
1213
1244
  disposers.push(dispose)
1214
1245
  }
1215
1246
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-version-manager",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Version management for DSH plugins and skills: an honest inventory of what is installed, a preview of what an update would change, a verifiable snapshot taken before the change, and a recovery path that is only offered when it can actually work.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -24,7 +24,9 @@
24
24
  "docs/assets",
25
25
  "docs/git-write-safety.md",
26
26
  "docs/guide.en.md",
27
- "docs/release-notes-0.1.6.md"
27
+ "docs/release-notes-0.1.6.md",
28
+ "docs/release-notes-0.1.7.md",
29
+ "CHANGELOG.md"
28
30
  ],
29
31
  "keywords": [
30
32
  "deepseek",