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

推荐订阅源

C
Check Point Blog
美团技术团队
Jina AI
Jina AI
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
V
Visual Studio Blog
Google DeepMind News
Google DeepMind News
Hugging Face - Blog
Hugging Face - Blog
云风的 BLOG
云风的 BLOG
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
WordPress大学
WordPress大学
月光博客
月光博客
宝玉的分享
宝玉的分享
小众软件
小众软件
MongoDB | Blog
MongoDB | Blog
Apple Machine Learning Research
Apple Machine Learning Research
A
About on SuperTechFans
J
Java Code Geeks
博客园_首页
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
Netflix TechBlog - Medium
Vercel News
Vercel News
博客园 - 聂微东

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
fix: scope Control UI assistant media tickets · openclaw/...
steipete · 2026-05-04 · via Recent Commits to openclaw:main

@@ -368,7 +368,14 @@ describe("handleControlUiHttpRequest", () => {

368368

});

369369

expect(handled).toBe(true);

370370

expect(res.statusCode).toBe(200);

371-

expect(JSON.parse(String(end.mock.calls[0]?.[0] ?? ""))).toEqual({ available: true });

371+

const payload = JSON.parse(String(end.mock.calls[0]?.[0] ?? "")) as {

372+

available?: boolean;

373+

mediaTicket?: string;

374+

mediaTicketExpiresAt?: string;

375+

};

376+

expect(payload).toMatchObject({ available: true });

377+

expect(payload.mediaTicket).toMatch(/^v1\./);

378+

expect(Date.parse(payload.mediaTicketExpiresAt ?? "")).not.toBeNaN();

372379

} finally {

373380

await fs.rm(filePath, { force: true });

374381

}

@@ -403,7 +410,94 @@ describe("handleControlUiHttpRequest", () => {

403410

});

404411

expect(handled).toBe(true);

405412

expect(res.statusCode).toBe(200);

406-

expect(JSON.parse(String(end.mock.calls[0]?.[0] ?? ""))).toEqual({ available: true });

413+

const payload = JSON.parse(String(end.mock.calls[0]?.[0] ?? "")) as {

414+

available?: boolean;

415+

mediaTicket?: string;

416+

mediaTicketExpiresAt?: string;

417+

};

418+

expect(payload).toMatchObject({ available: true });

419+

expect(payload.mediaTicket).toMatch(/^v1\./);

420+

expect(Date.parse(payload.mediaTicketExpiresAt ?? "")).not.toBeNaN();

421+

},

422+

});

423+

});

424+425+

it("serves assistant local media with a scoped media ticket after metadata auth", async () => {

426+

await withAllowedAssistantMediaRoot({

427+

prefix: "ui-media-ticket-",

428+

fn: async (tmpRoot) => {

429+

const filePath = path.join(tmpRoot, "photo.png");

430+

await fs.writeFile(filePath, Buffer.from("not-a-real-png"));

431+

const meta = await runAssistantMediaRequest({

432+

url: `/__openclaw__/assistant-media?meta=1&source=${encodeURIComponent(filePath)}`,

433+

method: "GET",

434+

auth: { mode: "token", token: "test-token", allowTailscale: false },

435+

headers: {

436+

authorization: "Bearer test-token",

437+

},

438+

});

439+

const payload = JSON.parse(String(meta.end.mock.calls[0]?.[0] ?? "")) as {

440+

mediaTicket?: string;

441+

};

442+

expect(meta.handled).toBe(true);

443+

expect(meta.res.statusCode).toBe(200);

444+

expect(payload.mediaTicket).toMatch(/^v1\./);

445+446+

const media = await runAssistantMediaRequest({

447+

url: `/__openclaw__/assistant-media?source=${encodeURIComponent(filePath)}&mediaTicket=${encodeURIComponent(payload.mediaTicket ?? "")}`,

448+

method: "GET",

449+

auth: { mode: "token", token: "test-token", allowTailscale: false },

450+

});

451+

expect(media.handled).toBe(true);

452+

expect(media.res.statusCode).toBe(200);

453+

},

454+

});

455+

});

456+457+

it("does not refresh assistant media tickets without operator auth", async () => {

458+

await withAllowedAssistantMediaRoot({

459+

prefix: "ui-media-ticket-refresh-",

460+

fn: async (tmpRoot) => {

461+

const filePath = path.join(tmpRoot, "photo.png");

462+

await fs.writeFile(filePath, Buffer.from("not-a-real-png"));

463+

const meta = await runAssistantMediaRequest({

464+

url: `/__openclaw__/assistant-media?meta=1&source=${encodeURIComponent(filePath)}`,

465+

method: "GET",

466+

auth: { mode: "token", token: "test-token", allowTailscale: false },

467+

headers: {

468+

authorization: "Bearer test-token",

469+

},

470+

});

471+

const payload = JSON.parse(String(meta.end.mock.calls[0]?.[0] ?? "")) as {

472+

mediaTicket?: string;

473+

};

474+475+

const refresh = await runAssistantMediaRequest({

476+

url: `/__openclaw__/assistant-media?meta=1&source=${encodeURIComponent(filePath)}&mediaTicket=${encodeURIComponent(payload.mediaTicket ?? "")}`,

477+

method: "GET",

478+

auth: { mode: "token", token: "test-token", allowTailscale: false },

479+

});

480+

expect(refresh.handled).toBe(true);

481+

expect(refresh.res.statusCode).toBe(401);

482+

expect(String(refresh.end.mock.calls[0]?.[0] ?? "")).toContain("Unauthorized");

483+

},

484+

});

485+

});

486+487+

it("rejects assistant local media with an invalid scoped media ticket", async () => {

488+

await withAllowedAssistantMediaRoot({

489+

prefix: "ui-media-ticket-invalid-",

490+

fn: async (tmpRoot) => {

491+

const filePath = path.join(tmpRoot, "photo.png");

492+

await fs.writeFile(filePath, Buffer.from("not-a-real-png"));

493+

const { res, handled, end } = await runAssistantMediaRequest({

494+

url: `/__openclaw__/assistant-media?source=${encodeURIComponent(filePath)}&mediaTicket=v1.invalid.invalid`,

495+

method: "GET",

496+

auth: { mode: "token", token: "test-token", allowTailscale: false },

497+

});

498+

expect(handled).toBe(true);

499+

expect(res.statusCode).toBe(401);

500+

expect(String(end.mock.calls[0]?.[0] ?? "")).toContain("Unauthorized");

407501

},

408502

});

409503

});