dsh-browser-cdp 1.15.4 → 1.15.5-rc.1

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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.15.5-rc.1 (2026-11-27)
4
+
5
+ **观察窗信任栅栏改为询问宿主 `connection.requestRejection`(issue #21)。**
6
+
7
+ - `src/cast-server.ts` 新增私有窄接口 `ConnectionTrust`:`/api/bcdp/*` 的路由放行判定不再自建 cookie 嗅探规则,改为向宿主 `connection` 服务询问本次请求的裁决(`hostTrust()` 懒解析,避免 init 快照冻结 load order;不新增 peer 依赖,`connection` 为可选消费)。
8
+ - 裁决映射:宿主回 `401`/`403` → 原样回给客户端;宿主明确放行(`undefined`)→ 放行;宿主无 `connection` 服务(老宿主)→ 回落 `legacyTrusted()` 的 cookie 兜底,行为与 1.15.4 一致。
9
+ - 关键收益:`@iasiv5/dsh-skip-browser-auth` 这类**在宿主 `browserAuth` 策略点**返回恒真的插件,现在能真正穿透到本插件的观察窗路由——此前插件自己嗅 cookie 等于绕过宿主策略点,于是「装了 skip-auth 仍 401」。
10
+ - 契约测试 `tests/cast-server-trust-fence.test.ts`(6 例):真实 cookie 200 / 伪造 `dsh-auth-fake=1` 401 / Host 与 Origin 伪造 403 / 无 `connection` 时回落 cookie 兜底。
11
+ - 兼容性:不改变 `bin/cdp-cast-worker.mjs` 与 remote 拓扑;老宿主无 `connection` 服务时退化为旧行为。适用版本 `>= 1.15.5`;`compat/*`、`beta*`、`unified/15rc` 五条历史线**不含**本次修改。
12
+
3
13
  ## 1.15.2 (2026-11-26)
4
14
 
5
15
  **设置卡底栏 Star 快车道:★ 直接打开仓库页(不再只静默收起),隐藏独立成 ×。**
package/dsh-plugin.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://dsh.community/schemas/dsh-plugin-0.15.json",
3
3
  "id": "dsh-browser-cdp",
4
4
  "name": "dsh-browser-cdp",
5
- "version": "1.15.4",
5
+ "version": "1.15.5-rc.1",
6
6
  "manifestVersion": "0.15",
7
7
  "facets": {
8
8
  "host": {
package/lib/client.js CHANGED
@@ -765,7 +765,7 @@ function pickLang() {
765
765
  for (const cand of STAR_LANGS) if (low.startsWith(cand)) return STAR_COPY[cand];
766
766
  return STAR_COPY.en;
767
767
  }
768
- const STAR_VERSION = "1.15.4";
768
+ const STAR_VERSION = "1.15.5-rc.1";
769
769
  const STAR_FOOT_COPY = {
770
770
  zh: {
771
771
  ask: "觉得好用?",
@@ -966,7 +966,7 @@ function mountStarRow(doc) {
966
966
  *
967
967
  * Keep in sync with package.json — `node scripts/bump.mjs <version>` writes both.
968
968
  */
969
- const CLIENT_BUILD = "1.15.1";
969
+ const CLIENT_BUILD = "1.15.5-rc.1";
970
970
 
971
971
  //#endregion
972
972
  //#region src/client/locales.ts
package/lib/index.js CHANGED
@@ -2264,7 +2264,7 @@ function focusIdFrom(value) {
2264
2264
  *
2265
2265
  * Keep in sync with package.json — `node scripts/bump.mjs <version>` writes both.
2266
2266
  */
2267
- const CLIENT_BUILD = "1.15.1";
2267
+ const CLIENT_BUILD = "1.15.5-rc.1";
2268
2268
 
2269
2269
  //#endregion
2270
2270
  //#region src/cast-server.ts
@@ -3108,13 +3108,31 @@ function initCastServer(ctx, cfg, bridge, ffmpegManager, openAgentWindow$1 = asy
3108
3108
  };
3109
3109
  const rawServer = ctx.get?.("webServer");
3110
3110
  if (!rawServer || typeof rawServer.register !== "function") return;
3111
- const isTrustedRequest = (req) => /(?:^|;\s*)dsh-auth-[^=]+=/.test(String(req.headers.cookie ?? ""));
3111
+ const legacyTrusted = (req) => /(?:^|;\s*)dsh-auth-[^=]+=/.test(String(req.headers.cookie ?? ""));
3112
+ let trustOf;
3113
+ const hostTrust = () => {
3114
+ if (trustOf === void 0 || typeof trustOf.requestRejection !== "function") try {
3115
+ trustOf = ctx.get?.("connection");
3116
+ } catch {
3117
+ trustOf = void 0;
3118
+ }
3119
+ return trustOf;
3120
+ };
3121
+ /** 401/403 when the request may not reach this plugin's routes, else undefined. */
3122
+ const rejectionOf = (req) => {
3123
+ const trust = hostTrust();
3124
+ if (trust !== void 0) try {
3125
+ return trust.requestRejection({ headers: req.headers });
3126
+ } catch {}
3127
+ return legacyTrusted(req) ? void 0 : 401;
3128
+ };
3112
3129
  const guardHandler = (handler) => async (req, resRaw) => {
3113
3130
  const res = resRaw;
3114
- if (!isTrustedRequest(req)) {
3115
- res.statusCode = 401;
3131
+ const rejection = rejectionOf(req);
3132
+ if (rejection !== void 0) {
3133
+ res.statusCode = rejection;
3116
3134
  res.setHeader("Content-Type", "application/json; charset=utf-8");
3117
- res.end("{\"ok\":false,\"error\":\"unauthorized\"}");
3135
+ res.end(rejection === 403 ? "{\"ok\":false,\"error\":\"forbidden\"}" : "{\"ok\":false,\"error\":\"unauthorized\"}");
3118
3136
  return;
3119
3137
  }
3120
3138
  return handler(req, res);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-browser-cdp",
3
- "version": "1.15.4",
3
+ "version": "1.15.5-rc.1",
4
4
  "description": "dsh-browser-cdp: visible agent browser for DSH — drives the vendored ego-compatible Chromium over CDP, and can also attach to a running Chrome/Edge/Brave or route through egolite, Tabbit and Lightpanda backends. 35 structured bcdp_* tools; only bcdp_status stays resident by default (lazy injection, −91.9% schema per turn for non-browser sessions). Realtime watch panel with direct click/scroll/IME input, element picks quoted into the composer, human-verification notices; non-CDP channels sync frames by 3s polling. Web shell: floating watch ball without dsh-better-sidebar, sidebar tab with it. Headless/TUI hosts: tools-only. [DSH 0.1.0-rc.2 ~ 0.2.2-rc.1: declarative settings via Config .volatile() fields on 0.1.7+; imperative installSection / module-level registration + describe/mutate bridge on 0.1.0 ~ 0.1.5 (experimental, pending farm). Client peers stay optional so gen-1 hosts without dsh-client-store still load; for a production install on the current line use the 0.17.x line]",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",