dsh-auth-remote 0.1.6 → 0.1.8

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
@@ -8,6 +8,15 @@ This file records user-visible changes to the released package. Version numbers
8
8
 
9
9
  No changes recorded yet.
10
10
 
11
+ ## 0.1.8 - 2026-10-12
12
+
13
+ - Allow anonymous GET/HEAD access to the exact PWA manifest and favicon paths, and link the manifest from sign-in with the required CSP permission. Keep origin checks and business authentication in place.
14
+
15
+ ## 0.1.7 - 2026-10-10
16
+
17
+ - Automatically declare the finalized native bridge authority in Connection's trusted hosts, fixing downstream plugin POST rejection when a concrete listener address was not explicitly trusted. Use the actual bound port and retain the legacy loopback bridge.
18
+ - Merge and deduplicate explicit CLI trusted hosts and public authorities required by preserved paths, while retaining the outer public-origin and session checks.
19
+
11
20
  ## 0.1.6 - 2026-10-10
12
21
 
13
22
  - Use DSH 0.2.1-alpha.2 for development and default verification, repair native WebServer/Connection composition, and retain all six declared releases in the CLI, smoke and browser CI matrix.
@@ -8,6 +8,15 @@
8
8
 
9
9
  暂无记录。
10
10
 
11
+ ## 0.1.8 - 2026-10-12
12
+
13
+ - 允许匿名 GET/HEAD 访问精确的 PWA manifest 与 favicon 路径,登录页引用 manifest 并补齐 CSP 权限;继续保留来源校验和业务鉴权。
14
+
15
+ ## 0.1.7 - 2026-10-10
16
+
17
+ - 自动将定稿的原生桥接 authority 登记到 Connection 的 trusted hosts,修复具体监听地址未显式登记时下游插件 POST 被拒绝的问题;使用实际绑定端口,并保留旧版回环桥接。
18
+ - 合并去重显式 CLI trusted hosts 与保留路径所需的公开 authority,外层公开来源和会话校验继续生效。
19
+
11
20
  ## 0.1.6 - 2026-10-10
12
21
 
13
22
  - 开发与默认验证运行时升级为 DSH 0.2.1-alpha.2,修复原生 WebServer/Connection 组合,CLI、smoke 和浏览器 CI 矩阵保留六个声明版本。
package/README.md CHANGED
@@ -30,11 +30,11 @@ With DSH installed, verify its version and install the published plugin into the
30
30
 
31
31
  ```sh
32
32
  dsh --version
33
- dsh plugin --profile web add dsh-auth-remote@0.1.6
33
+ dsh plugin --profile web add dsh-auth-remote@0.1.8
34
34
  dsh plugin --profile web list
35
35
  ```
36
36
 
37
- Check that `dsh --version` prints `0.2.1-alpha.2` (or another compatible release above) and the plugin list includes `dsh-auth-remote@0.1.6`. These commands use DSH's default data directory. For source builds and an isolated development runtime, see the [development guide](docs/development.md).
37
+ Check that `dsh --version` prints `0.2.1-alpha.2` (or another compatible release above) and the plugin list includes `dsh-auth-remote@0.1.8`. These commands use DSH's default data directory. For source builds and an isolated development runtime, see the [development guide](docs/development.md).
38
38
 
39
39
  ## Configure the web profile
40
40
 
@@ -42,7 +42,7 @@ The minimal setup needs no profile patch. Start with `dsh web --no-open --port 1
42
42
 
43
43
  For a public HTTPS entry, use the [deployment guide](docs/deployment.md) and [profile example](examples/web-profile-auth-remote.patch.yml), with top-level `publicUrl: https://dsh.example.com/`, `host` and `port`. Alpha.2 also supports concrete IPv6 and paired top-level `tlsCert`/`tlsKey`. The URL must be an HTTP(S) root, with no credentials, child path, query or fragment. One public origin plus literal loopback is admitted. Setting a URL does not configure proxy routing or TLS.
44
44
 
45
- If a downstream route needs the original public Host, add its path to `preserveOriginPaths`. Native Connection trust follows the final public origin; no extra `--trusted-host` or Connection row is needed. CLI host/port and public URL override file values; TLS overrides as one complete pair. See the [migration and path rules](docs/deployment.md#configuration-priority-and-path-bases) before upgrading `allowedOrigins`: zero or one item is migrated in memory with a warning, multiple items and any explicit coexistence with `publicUrl` fail.
45
+ The plugin automatically declares its finalized native bridge authority in Connection's `trustedHosts`, so downstream plugins can recognize a concrete listener without an extra `--trusted-host`. If a downstream route needs the original public Host, add its path to `preserveOriginPaths`; the final public authority is then declared as well. Explicit CLI trusted hosts are retained, while the outer public-origin and sign-in checks still apply. CLI host/port and public URL override file values; TLS overrides as one complete pair. See the [migration and path rules](docs/deployment.md#configuration-priority-and-path-bases) before upgrading `allowedOrigins`: zero or one item is migrated in memory with a warning, multiple items and any explicit coexistence with `publicUrl` fail.
46
46
 
47
47
  ## Initialize the account
48
48
 
@@ -58,6 +58,8 @@ Enter one username and a password of 12–256 Unicode characters. The password i
58
58
 
59
59
  Open the direct loopback URL for the minimal installation. After configuring a public origin, open `https://dsh.example.com/auth-remote/login`. Security settings inside DSH can change the password, bind or disable TOTP when policy permits, and revoke sessions. Password or factor changes revoke existing sessions. Sessions have a fixed default lifetime of 168 hours and survive service restarts.
60
60
 
61
+ The sign-in page references DSH's PWA manifest. The manifest and favicons are readable before sign-in; business pages and APIs still require authentication. See the [public resource rules](docs/deployment.md#source-and-bridge-contract).
62
+
61
63
  ```sh
62
64
  dsh plugin --profile web exec dsh-auth-remote status --json
63
65
  dsh plugin --profile web exec dsh-auth-remote reset-password --lang en
package/README.zh-CN.md CHANGED
@@ -30,11 +30,11 @@ DeepSeek Harness(DSH)的单用户远程登录插件,提供密码、TOTP、
30
30
 
31
31
  ```sh
32
32
  dsh --version
33
- dsh plugin --profile web add dsh-auth-remote@0.1.6
33
+ dsh plugin --profile web add dsh-auth-remote@0.1.8
34
34
  dsh plugin --profile web list
35
35
  ```
36
36
 
37
- 确认 `dsh --version` 输出 `0.2.1-alpha.2`(或上文其他兼容版本),且插件列表中有 `dsh-auth-remote@0.1.6`。这些命令使用 DSH 默认数据目录。源码构建及隔离开发运行时参见[开发指南](docs/development.zh-CN.md)。
37
+ 确认 `dsh --version` 输出 `0.2.1-alpha.2`(或上文其他兼容版本),且插件列表中有 `dsh-auth-remote@0.1.8`。这些命令使用 DSH 默认数据目录。源码构建及隔离开发运行时参见[开发指南](docs/development.zh-CN.md)。
38
38
 
39
39
  ## 配置 web profile
40
40
 
@@ -42,7 +42,7 @@ dsh plugin --profile web list
42
42
 
43
43
  公网 HTTPS 入口请使用[部署指南](docs/deployment.zh-CN.md)和 [profile 示例](examples/web-profile-auth-remote.patch.yml),设置顶层 `publicUrl: https://dsh.example.com/`、`host`、`port`。alpha.2 还支持具体 IPv6 和成对的顶层 `tlsCert`/`tlsKey`。URL 必须是 HTTP(S) 根地址,不能带凭据、子路径、查询或片段。准入范围是唯一公开来源加字面回环。配置 URL 不会配置代理路由或 TLS。
44
44
 
45
- 下游路由若需要原始公网 Host,可把路径加入 `preserveOriginPaths`。原生 Connection 信任来自最终公开来源,无需额外 `--trusted-host` 或 Connection 条目。CLI 的 host/port 和公开 URL 覆盖文件值;TLS 按完整一对覆盖。升级 `allowedOrigins` 前阅读[迁移和路径规则](docs/deployment.zh-CN.md#配置优先级与路径基准):零项或单项在内存迁移并告警,多项及任意显式新旧字段共存报错。
45
+ 插件自动将定稿的原生桥接 authority 登记到 Connection 的 `trustedHosts`,下游插件无需额外 `--trusted-host` 即可识别具体监听地址。下游路由若需要原始公网 Host,可把路径加入 `preserveOriginPaths`,此时也自动登记最终公开 authority。显式 CLI trusted hosts 继续保留,外层公开来源与登录校验仍然生效。CLI 的 host/port 和公开 URL 覆盖文件值;TLS 按完整一对覆盖。升级 `allowedOrigins` 前阅读[迁移和路径规则](docs/deployment.zh-CN.md#配置优先级与路径基准):零项或单项在内存迁移并告警,多项及任意显式新旧字段共存报错。
46
46
 
47
47
  ## 初始化账号
48
48
 
@@ -58,6 +58,8 @@ dsh plugin --profile web exec dsh-auth-remote init --lang zh
58
58
 
59
59
  最小化安装时访问本机回环地址;配置公网入口后访问 `https://dsh.example.com/auth-remote/login`。DSH 内的安全设置可以修改密码、绑定 TOTP、在策略允许时关闭 TOTP,以及撤销会话。密码或第二因素变更会撤销已有会话。会话默认固定有效 168 小时,服务重启后仍保留。
60
60
 
61
+ 登录页引用 DSH 的 PWA manifest,manifest 与 favicon 在登录前即可读取;业务页面和 API 仍需认证。具体范围见[公开资源规则](docs/deployment.zh-CN.md#来源与桥接契约)。
62
+
61
63
  ```sh
62
64
  dsh plugin --profile web exec dsh-auth-remote status --json
63
65
  dsh plugin --profile web exec dsh-auth-remote reset-password --lang zh
package/cordis.patch.yml CHANGED
@@ -24,12 +24,12 @@
24
24
  sessionHours: 168
25
25
  preserveOriginPaths: []
26
26
 
27
- # Connection starts after the authenticated listener and receives public
28
- # authorities only when a preserved path needs the original browser Host.
27
+ # Connection starts after the authenticated listener and receives its finalized
28
+ # bridge authority, plus public authorities needed by preserved paths and CLI trust.
29
29
  - id: connection
30
30
  inject: [webStartup, webServer]
31
31
  config:
32
- trustedHosts: !!js '[...ctx.webStartup.trustedHosts, ...ctx.webServer.connectionTrustedHosts]'
32
+ trustedHosts: !!js '[...new Set([...ctx.webStartup.trustedHosts, ...ctx.webServer.connectionTrustedHosts])]'
33
33
 
34
34
  # Reuse the official browser directory picker.
35
35
  - id: directory-picker
package/dist/index.js CHANGED
@@ -227,6 +227,12 @@ import semver2 from "semver";
227
227
  // src/adapters/dsh/public-url.ts
228
228
  import { isIP } from "node:net";
229
229
 
230
+ // src/http/public-assets.ts
231
+ var publicPwaPaths = /* @__PURE__ */ new Set(["/manifest.webmanifest", "/favicon.svg", "/favicon-dark.svg"]);
232
+ function isPublicPwaAsset(method, pathname) {
233
+ return (method === "GET" || method === "HEAD") && publicPwaPaths.has(pathname);
234
+ }
235
+
230
236
  // src/http/origin-policy.ts
231
237
  function defaultPort(protocol) {
232
238
  return protocol === "https:" ? 443 : 80;
@@ -375,7 +381,7 @@ function evaluateRequestOrigin(policy, request) {
375
381
  const target = request.target ? parseTarget(request.target) : null;
376
382
  const method = request.method;
377
383
  if (!authority || !target || !method || !/^[A-Z!#$%&'*+.^_`|~-]+$/u.test(method)) return null;
378
- const needsOrigin = request.upgrade === true || method !== "GET";
384
+ const needsOrigin = request.upgrade === true || method !== "GET" && !isPublicPwaAsset(method, target.pathname);
379
385
  if (needsOrigin && origins.length !== 1) return null;
380
386
  const site = fetchSites[0]?.toLowerCase();
381
387
  if (site !== void 0 && (needsOrigin ? site !== "same-origin" : !["same-origin", "none"].includes(site)))
@@ -2197,12 +2203,12 @@ var AuthRoutes = class {
2197
2203
  res.writeHead(200, {
2198
2204
  "cache-control": "no-store",
2199
2205
  "content-type": "text/html; charset=utf-8",
2200
- "content-security-policy": "default-src 'none'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self' data:; base-uri 'none'; frame-ancestors 'none'",
2206
+ "content-security-policy": "default-src 'none'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self' data:; manifest-src 'self'; base-uri 'none'; frame-ancestors 'none'",
2201
2207
  "x-content-type-options": "nosniff",
2202
2208
  "referrer-policy": "no-referrer"
2203
2209
  });
2204
2210
  res.end(
2205
- '<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Sign in to DSH</title><link rel="stylesheet" href="/auth-remote/login.css"><script defer src="/auth-remote/login.js"></script></head><body><main id="login-root" aria-live="polite">Checking sign-in status\u2026</main></body></html>'
2211
+ '<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Sign in to DSH</title><link rel="manifest" href="/manifest.webmanifest"><link rel="stylesheet" href="/auth-remote/login.css"><script defer src="/auth-remote/login.js"></script></head><body><main id="login-root" aria-live="polite">Checking sign-in status\u2026</main></body></html>'
2206
2212
  );
2207
2213
  return;
2208
2214
  }
@@ -2432,6 +2438,7 @@ var AuthGate = class {
2432
2438
  if (!raw) return rejectHttp(res, 403, "invalid_origin");
2433
2439
  if (!this.ready()) return rejectHttp(res, 503, "service_unavailable");
2434
2440
  setRequestContext(req, raw);
2441
+ if (isPublicPwaAsset(req.method, raw.pathname)) return next();
2435
2442
  const permission = routePermission(req.method, raw.pathname);
2436
2443
  if (permission === "public" || permission === "logout") return next();
2437
2444
  const token = currentSessionToken(req);
@@ -2635,10 +2642,12 @@ var AuthRemoteWebServer = class extends GuardedWebServer {
2635
2642
  if (!this.authService) throw new Error("dsh-auth-remote: authentication is not initialized");
2636
2643
  return this.authService;
2637
2644
  }
2638
- /** Public authorities needed by native Connection for preserved routes. */
2645
+ /** Declare the finalized bridge and any public authorities used by preserved routes. */
2639
2646
  get connectionTrustedHosts() {
2640
- if (this.resolved.preserveOriginPaths.length === 0) return [];
2641
- return this.resolved.originPolicy.registeredOrigins.map((entry) => entry.host);
2647
+ const hosts = [this.resolved.nativeAuthority];
2648
+ if (this.resolved.preserveOriginPaths.length > 0)
2649
+ hosts.push(...this.resolved.originPolicy.registeredOrigins.map((entry) => entry.host));
2650
+ return [...new Set(hosts)];
2642
2651
  }
2643
2652
  };
2644
2653
  var src_default = AuthRemoteWebServer;