惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

M
MIT News - Artificial intelligence
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
Last Week in AI
Last Week in AI
S
SegmentFault 最新的问题
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
人人都是产品经理
人人都是产品经理
WordPress大学
WordPress大学
The Cloudflare Blog
IT之家
IT之家
雷峰网
雷峰网
小众软件
小众软件
博客园 - 叶小钗
博客园 - 聂微东
爱范儿
爱范儿
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
博客园 - 【当耐特】
V
V2EX
博客园_首页
T
Tailwind CSS Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
Restrict plain text media sends to txt · openclaw/opencla...
2026-06-01 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -610,6 +610,21 @@ describe("loadWebMedia", () => {

610610

expect(result.contentType).toBe("text/plain");

611611

});

612612
613+

it("rejects host-read LOG files even though they map to text/plain", async () => {

614+

const logFile = path.join(fixtureRoot, "debug.log");

615+

await fs.writeFile(logFile, "plain text\n", "utf8");

616+

await expect(

617+

loadWebMedia(logFile, {

618+

maxBytes: 1024 * 1024,

619+

localRoots: "any",

620+

readFile: async (filePath) => await fs.readFile(filePath),

621+

hostReadCapability: true,

622+

}),

623+

).rejects.toMatchObject({

624+

code: "path-not-allowed",

625+

});

626+

});

627+
613628

it("rejects renamed host-read text files even when the extension looks allowed", async () => {

614629

const disguisedPdf = path.join(fixtureRoot, "secret.pdf");

615630

await fs.writeFile(disguisedPdf, "secret", "utf8");

Original file line numberDiff line numberDiff line change

@@ -172,6 +172,9 @@ const HOST_READ_DECLARED_TEXT_MIMES = new Set([...HOST_READ_TEXT_PLAIN_ALIASES,

172172

const HOST_READ_DECLARED_TEXT_ERROR =

173173

"hostReadCapability permits only validated plain-text documents " +

174174

"and trusted generated HTML reports for local reads";

175+

const HOST_READ_TEXT_PLAIN_EXTENSION_BY_MIME: Record<string, readonly string[]> = {

176+

"text/plain": [".txt"],

177+

};

175178

const MB = 1024 * 1024;

176179
177180

function stripLegacyMediaDirectivePrefix(mediaUrl: string): string {

@@ -315,6 +318,18 @@ function isTrustedGeneratedHostReadHtml(params: {

315318

return text !== undefined && hasHtmlDocumentShape(text);

316319

}

317320
321+

function isAllowedHostReadTextAlias(mime: string | undefined, filePath?: string): boolean {

322+

if (!mime || !HOST_READ_TEXT_PLAIN_ALIASES.has(mime)) {

323+

return false;

324+

}

325+

const allowedExtensions = HOST_READ_TEXT_PLAIN_EXTENSION_BY_MIME[mime];

326+

if (!allowedExtensions) {

327+

return true;

328+

}

329+

const ext = getFileExtension(filePath);

330+

return !!ext && allowedExtensions.includes(ext);

331+

}

332+
318333

function formatMb(bytes: number, digits = 2): string {

319334

return (bytes / MB).toFixed(digits);

320335

}

@@ -364,7 +379,7 @@ function assertHostReadMediaAllowed(params: {

364379

return;

365380

}

366381

if (

367-

HOST_READ_TEXT_PLAIN_ALIASES.has(declaredMime) &&

382+

isAllowedHostReadTextAlias(declaredMime, params.filePath) &&

368383

!params.sniffedContentType &&

369384

params.buffer &&

370385

isValidatedHostReadText(params.buffer)

@@ -399,7 +414,7 @@ function assertHostReadMediaAllowed(params: {

399414

if (

400415

!sniffedMime &&

401416

normalizedMime &&

402-

HOST_READ_TEXT_PLAIN_ALIASES.has(normalizedMime) &&

417+

isAllowedHostReadTextAlias(normalizedMime, params.filePath) &&

403418

params.buffer &&

404419

isValidatedHostReadText(params.buffer)

405420

) {