dsh-agy-link 0.4.93 → 0.4.94

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,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.94 (2026-10-29)
4
+
5
+ ### English
6
+
7
+ - **Security(media): block symlink escape in the static-asset route.**
8
+ - `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.
9
+
10
+ ### 中文
11
+
12
+ - **安全(media):静态资源路由阻止符号链接逃逸。**
13
+ - `handleAssetRequest()` 之前用 `join(assetDir, 去掉'..'的 subPath)` + `existsSync` 判断;若资产目录内放入一个指向外部的符号链接,会被跟随并对外提供(任意类型文件,如含密钥的 `.txt`)。现用 `realpathSync` 规范化并要求目标仍在资产目录内(否则 `403`)。补充符号链接逃逸回归测试。
14
+
15
+ **Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.4.93...v0.4.94
16
+
3
17
  ## 0.4.93 (2026-10-29)
4
18
 
5
19
  ### 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";
@@ -35191,8 +35191,22 @@ function handleAssetRequest(req, res, assetDir) {
35191
35191
  res.end("invalid url");
35192
35192
  return;
35193
35193
  }
35194
- const safeName = subPath.replace(/\.\./g, "").replace(/^[/\\]+/, "");
35195
- const filePath = join(assetDir, safeName);
35194
+ let filePath;
35195
+ try {
35196
+ const root = realpathSync(assetDir);
35197
+ const candidate = resolve(root, subPath.replace(/^[/\\]+/, ""));
35198
+ const real = realpathSync(candidate);
35199
+ if (real !== root && !real.startsWith(root + sep)) {
35200
+ res.writeHead(403, { "Content-Type": "text/plain" });
35201
+ res.end("forbidden");
35202
+ return;
35203
+ }
35204
+ filePath = real;
35205
+ } catch {
35206
+ res.writeHead(404, { "Content-Type": "text/plain" });
35207
+ res.end("asset not found");
35208
+ return;
35209
+ }
35196
35210
  if (!existsSync(filePath)) {
35197
35211
  res.writeHead(404, { "Content-Type": "text/plain" });
35198
35212
  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.94",
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",