mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-26 15:21:13 +00:00
fix(gateway): reject malformed MCP sandbox policy (#110264)
Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
This commit is contained in:
committed by
GitHub
parent
6f0f6af62e
commit
1ca26c508d
@@ -30,9 +30,13 @@ function handleMcpAppSandboxHttpRequest(req: IncomingMessage, res: ServerRespons
|
||||
return;
|
||||
}
|
||||
|
||||
const encodedCsp = url.searchParams.get("csp");
|
||||
let csp;
|
||||
try {
|
||||
csp = decodeMcpAppSandboxCsp(url.searchParams.get("csp"));
|
||||
csp = decodeMcpAppSandboxCsp(encodedCsp);
|
||||
if (encodedCsp !== null && !csp) {
|
||||
throw new Error("invalid MCP App sandbox policy");
|
||||
}
|
||||
} catch {
|
||||
res.statusCode = 400;
|
||||
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
||||
|
||||
Reference in New Issue
Block a user