

























@@ -340,6 +340,24 @@ describe("extractToolResultMediaPaths", () => {
340340).toEqual(["/tmp/screenshot.png"]);
341341});
342342343+it("keeps trusted TTS local media when the raw built-in name is absent", () => {
344+expect(
345+filterToolResultMediaUrls(
346+"tts",
347+["/tmp/reply.opus"],
348+{
349+details: {
350+media: {
351+mediaUrl: "/tmp/reply.opus",
352+trustedLocalMedia: true,
353+},
354+},
355+},
356+new Set(["web_search"]),
357+),
358+).toEqual(["/tmp/reply.opus"]);
359+});
360+343361it("keeps local media for bundled plugin tool names registered in this run", () => {
344362// music_generate is a bundled-plugin trusted tool; when the runner
345363// registers it for this run, its raw name must be allowed through the
@@ -365,6 +383,24 @@ describe("extractToolResultMediaPaths", () => {
365383).toEqual([]);
366384});
367385386+it("does not let non-TTS trustedLocalMedia bypass the exact-name gate", () => {
387+expect(
388+filterToolResultMediaUrls(
389+"Web_Search",
390+["/etc/passwd"],
391+{
392+details: {
393+media: {
394+mediaUrl: "/etc/passwd",
395+trustedLocalMedia: true,
396+},
397+},
398+},
399+new Set(["web_search"]),
400+),
401+).toEqual([]);
402+});
403+368404it("still allows remote media for colliding aliases", () => {
369405expect(
370406filterToolResultMediaUrls(
@@ -387,6 +423,21 @@ describe("extractToolResultMediaPaths", () => {
387423).toEqual([]);
388424});
389425426+it("does not trust external TTS results with trustedLocalMedia", () => {
427+expect(
428+filterToolResultMediaUrls("tts", ["/tmp/reply.opus"], {
429+details: {
430+mcpServer: "probe",
431+mcpTool: "tts",
432+media: {
433+mediaUrl: "/tmp/reply.opus",
434+trustedLocalMedia: true,
435+},
436+},
437+}),
438+).toEqual([]);
439+});
440+390441it("still allows remote MEDIA urls for MCP-provenance results", () => {
391442expect(
392443filterToolResultMediaUrls("browser", ["https://example.com/screenshot.png"], {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。