dsh-agy-link 0.4.93 → 0.4.95

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,35 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.95 (2026-10-30)
4
+
5
+ ### English
6
+
7
+ - **Fix(runner): stop Linux pool accounts from reading the desktop Secret Service (primary token) — isolate D-Bus per account.** (thanks @superwiboy, #62)
8
+ - On Linux with a desktop session, agy's credential reader queries the OS Secret Service (gnome-keyring/secret-tool) before the isolated token file, so pooled sub-accounts silently used the primary account's token (primary quota drained, sub-accounts at 0 usage). `isolatedHomeEnv()` now sets `DBUS_SESSION_BUS_ADDRESS` to a nonexistent, **per-account private** path (`<home>/.no-dbus-session`), forcing agy to read only its slot token.
9
+ - Hardening over the original patch: the dummy bus path is private to each isolated home instead of a shared world-writable `/tmp` path (which a local user could hijack by binding a fake bus socket). Adds `linuxDbusDisabledEnv()` + tests.
10
+
11
+ ### 中文
12
+
13
+ - **修复(runner):Linux 池账号不再穿透到桌面 Secret Service(读到主账号 token)——按账号隔离 D-Bus。**(感谢 @superwiboy,#62)
14
+ - Linux 桌面会话下,agy 读取凭据时会先查系统 Secret Service(gnome-keyring/secret-tool),导致池内子账号静默使用主账号 token(主账号额度被耗、子账号 0 用量)。`isolatedHomeEnv()` 现在把 `DBUS_SESSION_BUS_ADDRESS` 指向一个不存在、且**每账号私有**的路径(`<home>/.no-dbus-session`),强制 agy 只读自己 slot 的 token。
15
+ - 相较原补丁的加固:临时 bus 路径使用各账号私有 home,而非共享可写的 `/tmp` 路径(后者可能被本机其他用户伪造 bus socket 劫持)。新增 `linuxDbusDisabledEnv()` 及测试。
16
+
17
+ **Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.4.94...v0.4.95
18
+
19
+ ## 0.4.94 (2026-10-29)
20
+
21
+ ### English
22
+
23
+ - **Security(media): block symlink escape in the static-asset route.**
24
+ - `handleAssetRequest()` built the path with `join(assetDir, subPath.replace('\.\.',''))` and only checked `existsSync`. A symlink placed inside the asset dir that pointed outside it would be followed and served (any file type, e.g. a `.txt` with secrets). The route now canonicalizes with `realpathSync` and requires the target to stay inside the canonical asset dir (`403` otherwise). Adds a symlink-escape regression test.
25
+
26
+ ### 中文
27
+
28
+ - **安全(media):静态资源路由阻止符号链接逃逸。**
29
+ - `handleAssetRequest()` 之前用 `join(assetDir, 去掉'..'的 subPath)` + `existsSync` 判断;若资产目录内放入一个指向外部的符号链接,会被跟随并对外提供(任意类型文件,如含密钥的 `.txt`)。现用 `realpathSync` 规范化并要求目标仍在资产目录内(否则 `403`)。补充符号链接逃逸回归测试。
30
+
31
+ **Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.4.93...v0.4.94
32
+
3
33
  ## 0.4.93 (2026-10-29)
4
34
 
5
35
  ### English
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { execFile, execFileSync, spawn } from "node:child_process";
3
- import path, { basename, delimiter, dirname, extname, isAbsolute, join, relative, resolve } from "node:path";
4
- import { accessSync, chmodSync, constants, copyFileSync, createReadStream, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, unlinkSync, utimesSync, writeFileSync } from "node:fs";
3
+ import path, { basename, delimiter, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
4
+ import { accessSync, chmodSync, constants, copyFileSync, createReadStream, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, utimesSync, writeFileSync } from "node:fs";
5
5
  import { homedir, tmpdir } from "node:os";
6
6
  import { mkdir, mkdtemp, readFile, readdir, rm, stat, unlink, writeFile } from "node:fs/promises";
7
7
  import * as dshLlm from "@deepseek-ai/dsh-llm";
@@ -3113,6 +3113,16 @@ function windowsQuote(arg) {
3113
3113
  * the real user profile). GEMINI_CLI_HOME is honored by the agy CLI on all
3114
3114
  * platforms for its .gemini dir.
3115
3115
  */
3116
+ /**
3117
+ * Linux/Unix: env that points D-Bus at a nonexistent, per-account PRIVATE path
3118
+ * so agy cannot fall through to the desktop Secret Service (gnome-keyring) and
3119
+ * read the primary account's token. The path lives INSIDE the isolated home:
3120
+ * a shared world-writable path (e.g. /tmp/…) could be hijacked by another local
3121
+ * user binding a fake bus socket there and MITM-ing the Secret Service lookup.
3122
+ */
3123
+ function linuxDbusDisabledEnv(dir) {
3124
+ return { DBUS_SESSION_BUS_ADDRESS: "unix:path=" + join(dir, ".no-dbus-session") };
3125
+ }
3116
3126
  function isolatedHomeEnv(dir) {
3117
3127
  const geminiDir = join(dir, ".gemini");
3118
3128
  const env = {
@@ -3128,7 +3138,7 @@ function isolatedHomeEnv(dir) {
3128
3138
  env.HOMEDRIVE = m[1];
3129
3139
  env.HOMEPATH = m[2];
3130
3140
  }
3131
- }
3141
+ } else if (process.platform === "linux") Object.assign(env, linuxDbusDisabledEnv(dir));
3132
3142
  return env;
3133
3143
  }
3134
3144
  /**
@@ -35191,8 +35201,22 @@ function handleAssetRequest(req, res, assetDir) {
35191
35201
  res.end("invalid url");
35192
35202
  return;
35193
35203
  }
35194
- const safeName = subPath.replace(/\.\./g, "").replace(/^[/\\]+/, "");
35195
- const filePath = join(assetDir, safeName);
35204
+ let filePath;
35205
+ try {
35206
+ const root = realpathSync(assetDir);
35207
+ const candidate = resolve(root, subPath.replace(/^[/\\]+/, ""));
35208
+ const real = realpathSync(candidate);
35209
+ if (real !== root && !real.startsWith(root + sep)) {
35210
+ res.writeHead(403, { "Content-Type": "text/plain" });
35211
+ res.end("forbidden");
35212
+ return;
35213
+ }
35214
+ filePath = real;
35215
+ } catch {
35216
+ res.writeHead(404, { "Content-Type": "text/plain" });
35217
+ res.end("asset not found");
35218
+ return;
35219
+ }
35196
35220
  if (!existsSync(filePath)) {
35197
35221
  res.writeHead(404, { "Content-Type": "text/plain" });
35198
35222
  res.end("asset not found");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agy-link",
3
- "version": "0.4.93",
3
+ "version": "0.4.95",
4
4
  "description": "Google Antigravity (agy CLI) models for DeepSeek Harness — stream Gemini/Claude/GPT-OSS subscriptions into DSH with thinking, tool activity, token usage and in-GUI Google OAuth login.",
5
5
  "type": "module",
6
6
  "license": "MIT",