mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
fix(mcp): require the panel key for panel requests
panel_request now requires a key that each MCP server generates and places in its panel page, which keeps the tool from clients that list it to the model without loading the panel. The key is not access control: any MCP client can read the panel page. Routes the panel never loads (provider settings, credential and model endpoints, the MCP endpoint and development server internals) are refused to every caller, regardless of letter case or encoding. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
b1a958242c
commit
3318390e3f
9 files changed
+209
-23
No files matched your search
@@ -9,7 +9,10 @@ import { panelRuntime } from '../app/globePanelRuntime.js';
|
||||
import { composeCatalog, coreTools } from './index.js';
|
||||
|
||||
test('the globe panel is an MCP Apps resource that loads the app through its server', () => {
|
||||
const resource = createGlobePanelResource({ runtime: panelRuntime });
|
||||
const resource = createGlobePanelResource({
|
||||
runtime: panelRuntime,
|
||||
panelKey: 'test-key',
|
||||
});
|
||||
assert.equal(resource.uri, GLOBE_PANEL_URI);
|
||||
assert.equal(resource.mimeType, MCP_APP_MIME_TYPE);
|
||||
assert.equal(MCP_APP_MIME_TYPE, 'text/html;profile=mcp-app');
|
||||
@@ -24,6 +27,9 @@ test('the globe panel is an MCP Apps resource that loads the app through its ser
|
||||
assert.equal(csp.frameDomains, undefined);
|
||||
assert.equal(csp.baseUriDomains, undefined);
|
||||
assert.match(resource.text, /"toolName":"panel_request"/);
|
||||
// The page carries the key its requests need, and sends it with each one.
|
||||
assert.match(resource.text, /"panelKey":"test-key"/);
|
||||
assert.match(resource.text, /key: config\.panelKey/);
|
||||
assert.match(resource.text, /"panelBase":"\/panel\/"/);
|
||||
assert.match(resource.text, /'ui\/initialize'/);
|
||||
assert.match(resource.text, /'ui\/notifications\/tool-result'/);
|
||||
@@ -39,6 +45,14 @@ test('the globe panel is an MCP Apps resource that loads the app through its ser
|
||||
assert.doesNotThrow(() => new Function(script));
|
||||
});
|
||||
|
||||
test('the globe panel needs a request key', () => {
|
||||
for (const panelKey of [undefined, '', 42])
|
||||
assert.throws(
|
||||
() => createGlobePanelResource({ runtime: panelRuntime, panelKey }),
|
||||
TypeError,
|
||||
);
|
||||
});
|
||||
|
||||
test('show_in_gods_eye_view names the panel and shows a view another answer returned', async () => {
|
||||
const catalog = composeCatalog({
|
||||
tools: coreTools,
|
||||
|
||||
Reference in new issue
Block a user