dsh-agy-link 0.4.92 → 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 +28 -0
- package/dist/index.js +35 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
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
|
+
|
|
17
|
+
## 0.4.93 (2026-10-29)
|
|
18
|
+
|
|
19
|
+
### English
|
|
20
|
+
|
|
21
|
+
- **Fix(oneshot): don't split a UTF-8 character when truncating an inlined file.**
|
|
22
|
+
- `inlineFiles()` truncated a large text file with a raw byte slice (`buf.subarray(0, INLINE_MAX_BYTES)`), so if the 256 KiB boundary fell inside a multibyte character the prompt got a replacement char (`�`). Truncation now walks back to a UTF-8 code-point boundary (`truncateUtf8`). Adds a regression test that places a 3-byte char across the boundary.
|
|
23
|
+
|
|
24
|
+
### 中文
|
|
25
|
+
|
|
26
|
+
- **修复(oneshot):截断内联大文件时不再把一个 UTF-8 字符切断。**
|
|
27
|
+
- `inlineFiles()` 之前用裸字节切片(`buf.subarray(0, INLINE_MAX_BYTES)`),若 256 KiB 边界落在多字节字符中间,prompt 里会出现替换符 `�`。现截断回退到 UTF-8 码点边界(`truncateUtf8`)。补充把一个 3 字节字符跨边界放置的回归测试。
|
|
28
|
+
|
|
29
|
+
**Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.4.92...v0.4.93
|
|
30
|
+
|
|
3
31
|
## 0.4.92 (2026-10-29)
|
|
4
32
|
|
|
5
33
|
### 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";
|
|
@@ -31843,6 +31843,22 @@ function detectContinuation(messages) {
|
|
|
31843
31843
|
//#region src/host/oneshot.ts
|
|
31844
31844
|
/** Per-file inline cap; larger files are truncated. */
|
|
31845
31845
|
const INLINE_MAX_BYTES = 262144;
|
|
31846
|
+
/** Truncate a buffer to <= max bytes without splitting a UTF-8 code point. */
|
|
31847
|
+
function truncateUtf8(buf, max) {
|
|
31848
|
+
if (buf.length <= max) return buf;
|
|
31849
|
+
let end = max;
|
|
31850
|
+
let i = end - 1;
|
|
31851
|
+
let back = 0;
|
|
31852
|
+
while (i >= 0 && (buf[i] & 192) === 128 && back < 3) {
|
|
31853
|
+
i--;
|
|
31854
|
+
back++;
|
|
31855
|
+
}
|
|
31856
|
+
if (i >= 0) {
|
|
31857
|
+
const lead = buf[i];
|
|
31858
|
+
if (i + (lead >= 240 ? 4 : lead >= 224 ? 3 : lead >= 192 ? 2 : 1) > end) end = i;
|
|
31859
|
+
}
|
|
31860
|
+
return buf.subarray(0, end);
|
|
31861
|
+
}
|
|
31846
31862
|
/** Text-detection: anything that is very likely not binary. */
|
|
31847
31863
|
function looksTextual(head) {
|
|
31848
31864
|
if (head === "") return true;
|
|
@@ -31871,7 +31887,7 @@ async function inlineFiles(prompt, paths, cwd) {
|
|
|
31871
31887
|
if (!looksTextual(buf.subarray(0, Math.min(buf.length, 4096)).toString("utf8"))) note = "(skipped: binary file - reference it by path and let agy read it with its own tools)";
|
|
31872
31888
|
else if (buf.byteLength > INLINE_MAX_BYTES) {
|
|
31873
31889
|
note = "(truncated to the first 262144 bytes)";
|
|
31874
|
-
body = buf
|
|
31890
|
+
body = truncateUtf8(buf, INLINE_MAX_BYTES).toString("utf8");
|
|
31875
31891
|
} else body = buf.toString("utf8");
|
|
31876
31892
|
} catch {
|
|
31877
31893
|
note = "(skipped: unreadable - " + raw + ")";
|
|
@@ -35175,8 +35191,22 @@ function handleAssetRequest(req, res, assetDir) {
|
|
|
35175
35191
|
res.end("invalid url");
|
|
35176
35192
|
return;
|
|
35177
35193
|
}
|
|
35178
|
-
|
|
35179
|
-
|
|
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
|
+
}
|
|
35180
35210
|
if (!existsSync(filePath)) {
|
|
35181
35211
|
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
35182
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.
|
|
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",
|