dsh-auth-remote 0.1.7 → 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,10 @@ 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
+
11
15
  ## 0.1.7 - 2026-10-10
12
16
 
13
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.
@@ -8,6 +8,10 @@
8
8
 
9
9
  暂无记录。
10
10
 
11
+ ## 0.1.8 - 2026-10-12
12
+
13
+ - 允许匿名 GET/HEAD 访问精确的 PWA manifest 与 favicon 路径,登录页引用 manifest 并补齐 CSP 权限;继续保留来源校验和业务鉴权。
14
+
11
15
  ## 0.1.7 - 2026-10-10
12
16
 
13
17
  - 自动将定稿的原生桥接 authority 登记到 Connection 的 trusted hosts,修复具体监听地址未显式登记时下游插件 POST 被拒绝的问题;使用实际绑定端口,并保留旧版回环桥接。
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.7
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.7`. 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
 
@@ -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.7
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.7`。这些命令使用 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
 
@@ -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/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);