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

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
M
MIT News - Artificial intelligence
罗磊的独立博客
博客园 - 【当耐特】
A
About on SuperTechFans
Last Week in AI
Last Week in AI
雷峰网
雷峰网
IT之家
IT之家
aimingoo的专栏
aimingoo的专栏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园_首页
博客园 - 叶小钗
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - Franky
J
Java Code Geeks
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
Docker
Engineering at Meta
Engineering at Meta
B
Blog RSS Feed
The Cloudflare Blog
大猫的无限游戏
大猫的无限游戏
阮一峰的网络日志
阮一峰的网络日志
S
SegmentFault 最新的问题
Recent Announcements
Recent Announcements

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(gateway): dedupe MCP loopback auth gate · opencl...
vincentkoc · 2026-06-23 · via Recent Commits to openclaw:main

@@ -156,7 +156,7 @@ export function validateMcpLoopbackRequest(params: {

156156

return null;

157157

}

158158159-

if (params.req.method === "GET") {

159+

if (params.req.method === "GET" || params.req.method === "DELETE") {

160160

// Origin validation first (matches the POST path): a browser loopback request is

161161

// rejected before bearer auth, so the local-loopback Origin boundary holds even for

162162

// unauthenticated browser requests.

@@ -171,39 +171,27 @@ export function validateMcpLoopbackRequest(params: {

171171

params.res.end(JSON.stringify({ error: "unauthorized" }));

172172

return null;

173173

}

174-

logMcpLoopbackHttp("sse-open", { method: "GET", path: url.pathname });

175-

params.res.writeHead(200, {

176-

"Content-Type": "text/event-stream",

177-

"Cache-Control": "no-cache",

178-

Connection: "keep-alive",

179-

});

180-

params.res.flushHeaders();

181-

params.res.write(":\n\n");

182-

params.onSseResponse?.(params.res);

183-

params.req.on("close", () => {

184-

if (!params.res.writableEnded) {

185-

params.res.end();

186-

}

187-

});

188-

return null;

189-

}

174+

if (params.req.method === "GET") {

175+

logMcpLoopbackHttp("sse-open", { method: "GET", path: url.pathname });

176+

params.res.writeHead(200, {

177+

"Content-Type": "text/event-stream",

178+

"Cache-Control": "no-cache",

179+

Connection: "keep-alive",

180+

});

181+

params.res.flushHeaders();

182+

params.res.write(":\n\n");

183+

params.onSseResponse?.(params.res);

184+

params.req.on("close", () => {

185+

if (!params.res.writableEnded) {

186+

params.res.end();

187+

}

188+

});

189+

return null;

190+

}

190191191-

if (params.req.method === "DELETE") {

192192

// Streamable HTTP session teardown. The loopback server is stateless — it owns no

193193

// session lifecycle — so this is an auth-gated no-op acknowledgement: clients that

194194

// send DELETE when closing the transport get a clean 200 rather than a 405.

195-

// Origin validation first (matches the POST/GET paths), before bearer auth.

196-

if (rejectsBrowserLoopbackRequest(params.req)) {

197-

params.res.writeHead(403, { "Content-Type": "application/json" });

198-

params.res.end(JSON.stringify({ error: "forbidden" }));

199-

return null;

200-

}

201-

const sender = resolveMcpSender(params);

202-

if (!sender) {

203-

params.res.writeHead(401, { "Content-Type": "application/json" });

204-

params.res.end(JSON.stringify({ error: "unauthorized" }));

205-

return null;

206-

}

207195

logMcpLoopbackHttp("session-delete", { method: "DELETE", path: url.pathname });

208196

params.res.writeHead(200, { "Content-Type": "application/json" });

209197

params.res.end(JSON.stringify({ ok: true }));