Send the panel's app requests to the app's server without <base>

Claude refuses <base> in panels, so relative addresses reached the
host's site: styles, Cesium assets and API calls all failed. The panel
now points fetch, XHR, beacons, images, media, links, workers and added
style url()s at the app's server, and declares its policy under OpenAI's
widget key as well.
This commit is contained in:
Sameh Khamis committed 2026-10-02 15:21:37 -07:00
1 parent d9ecd126c8
commit 06460020d0
2 files changed
+137 -12

No files matched your search

+7 -1
View File
@@ -24,7 +24,13 @@ test('the globe panel is an MCP Apps resource that runs the app inside itself',
'ws://localhost:5173',
]);
assert.ok(csp.resourceDomains.includes('https://tile.googleapis.com'));
assert.deepEqual(csp.baseUriDomains, ['http://localhost:5173']);
// Hosts may refuse <base>; the panel sends the app's requests itself.
assert.equal(csp.baseUriDomains, undefined);
assert.deepEqual(resource._meta['openai/widgetCSP'], {
connect_domains: csp.connectDomains,
resource_domains: csp.resourceDomains,
});
assert.doesNotMatch(resource.text, /createElement\('base'\)/);
assert.match(resource.text, /window\.GEV_EMBED_INLINE = true/);
assert.match(resource.text, /fetch\(APP_ORIGIN \+ '\/\?embed=1'\)/);
assert.doesNotMatch(resource.text, /<iframe|createElement\('iframe'\)/);