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

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
V
Visual Studio Blog
Last Week in AI
Last Week in AI
Stack Overflow Blog
Stack Overflow Blog
The GitHub Blog
The GitHub Blog
Recent Announcements
Recent Announcements
博客园 - Franky
D
DataBreaches.Net
B
Blog
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
人人都是产品经理
人人都是产品经理
WordPress大学
WordPress大学
P
Proofpoint News Feed
J
Java Code Geeks
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Martin Fowler
Martin Fowler
月光博客
月光博客
宝玉的分享
宝玉的分享
Engineering at Meta
Engineering at Meta
阮一峰的网络日志
阮一峰的网络日志
F
Fortinet All Blogs
博客园 - 【当耐特】

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
refactor: share plugin node auth test helpers · openclaw/...
vincentkoc · 2026-06-02 · via Recent Commits to openclaw:main

@@ -218,6 +218,49 @@ async function sendRawHttpRequest(params: {

218218

});

219219

}

220220221+

type CanvasGatewayListener = Awaited<ReturnType<typeof listen>>;

222+223+

function canvasUrl(listener: CanvasGatewayListener, path = CANVAS_HOST_PATH): string {

224+

return `http://127.0.0.1:${listener.port}${path}`;

225+

}

226+227+

async function fetchCanvasHost(

228+

listener: CanvasGatewayListener,

229+

init?: RequestInit,

230+

): Promise<Response> {

231+

return await fetchCanvas(canvasUrl(listener), init);

232+

}

233+234+

async function expectMalformedRequestTargetsRejected(params: {

235+

listener: CanvasGatewayListener;

236+

headers?: readonly string[];

237+

}): Promise<void> {

238+

for (const requestTarget of ["//", "///", "//${jndi:ldap://example}.action"]) {

239+

const response = await sendRawHttpRequest({

240+

host: "127.0.0.1",

241+

port: params.listener.port,

242+

requestTarget,

243+

...(params.headers ? { headers: params.headers } : {}),

244+

});

245+

expect(response).toMatch(/^HTTP\/1\.1 401 /);

246+

}

247+248+

const res = await fetchCanvasHost(params.listener);

249+

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

250+

}

251+252+

async function expectRepeatedCanvasAuthAttemptsRateLimited(

253+

listener: CanvasGatewayListener,

254+

headers: Record<string, string>,

255+

): Promise<Response> {

256+

const first = await fetchCanvasHost(listener, { headers });

257+

expect(first.status).toBe(401);

258+259+

const second = await fetchCanvasHost(listener, { headers });

260+

expect(second.status).toBe(429);

261+

return second;

262+

}

263+221264

function makeWsClient(params: {

222265

connId: string;

223266

clientIp: string;

@@ -463,17 +506,7 @@ describe("gateway plugin node capability auth", () => {

463506

resolvedAuth: tokenResolvedAuth,

464507

handleHttpRequest: allowCanvasHostHttp,

465508

run: async ({ listener }) => {

466-

for (const requestTarget of ["//", "///", "//${jndi:ldap://example}.action"]) {

467-

const response = await sendRawHttpRequest({

468-

host: "127.0.0.1",

469-

port: listener.port,

470-

requestTarget,

471-

});

472-

expect(response).toMatch(/^HTTP\/1\.1 401 /);

473-

}

474-475-

const res = await fetchCanvas(`http://127.0.0.1:${listener.port}${CANVAS_HOST_PATH}/`);

476-

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

509+

await expectMalformedRequestTargetsRejected({ listener });

477510

},

478511

});

479512

}, 60_000);

@@ -483,24 +516,16 @@ describe("gateway plugin node capability auth", () => {

483516

resolvedAuth: tokenResolvedAuth,

484517

handleHttpRequest: allowCanvasHostHttp,

485518

run: async ({ listener }) => {

486-

for (const requestTarget of ["//", "///", "//${jndi:ldap://example}.action"]) {

487-

const response = await sendRawHttpRequest({

488-

host: "127.0.0.1",

489-

port: listener.port,

490-

requestTarget,

491-

headers: [

492-

"Host: localhost",

493-

"Upgrade: websocket",

494-

"Connection: Upgrade",

495-

"Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==",

496-

"Sec-WebSocket-Version: 13",

497-

],

498-

});

499-

expect(response).toMatch(/^HTTP\/1\.1 401 /);

500-

}

501-502-

const res = await fetchCanvas(`http://127.0.0.1:${listener.port}${CANVAS_HOST_PATH}/`);

503-

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

519+

await expectMalformedRequestTargetsRejected({

520+

listener,

521+

headers: [

522+

"Host: localhost",

523+

"Upgrade: websocket",

524+

"Connection: Upgrade",

525+

"Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==",

526+

"Sec-WebSocket-Version: 13",

527+

],

528+

});

504529

},

505530

});

506531

}, 60_000);

@@ -638,18 +663,7 @@ describe("gateway plugin node capability auth", () => {

638663

authorization: "Bearer wrong",

639664

"x-forwarded-for": "203.0.113.99",

640665

};

641-

const first = await fetchCanvas(`http://127.0.0.1:${listener.port}${CANVAS_HOST_PATH}/`, {

642-

headers,

643-

});

644-

expect(first.status).toBe(401);

645-646-

const second = await fetchCanvas(

647-

`http://127.0.0.1:${listener.port}${CANVAS_HOST_PATH}/`,

648-

{

649-

headers,

650-

},

651-

);

652-

expect(second.status).toBe(429);

666+

const second = await expectRepeatedCanvasAuthAttemptsRateLimited(listener, headers);

653667

expect(second.headers.get("retry-after")).toMatch(/^\d+$/);

654668655669

await expectWsRejected(`ws://127.0.0.1:${listener.port}${CANVAS_WS_PATH}`, headers, 429);

@@ -683,21 +697,7 @@ describe("gateway plugin node capability auth", () => {

683697

host: "localhost",

684698

"x-forwarded-for": "127.0.0.1, 203.0.113.24",

685699

};

686-

const first = await fetchCanvas(

687-

`http://127.0.0.1:${listener.port}${CANVAS_HOST_PATH}/`,

688-

{

689-

headers,

690-

},

691-

);

692-

expect(first.status).toBe(401);

693-694-

const second = await fetchCanvas(

695-

`http://127.0.0.1:${listener.port}${CANVAS_HOST_PATH}/`,

696-

{

697-

headers,

698-

},

699-

);

700-

expect(second.status).toBe(429);

700+

await expectRepeatedCanvasAuthAttemptsRateLimited(listener, headers);

701701

},

702702

});

703703

},