Skip to content

Commit cb452d8

Browse files
committed
Fail closed on MCP app guest storage errors
Remove the srcdoc fallback from the ACP MCP app proxy so failed guest HTML storage cannot collapse the double-iframe isolation boundary. The proxy now renders a safe error message without executing guest HTML. Signed-off-by: Andrew Harvard <aharvard@squareup.com>
1 parent 79efe17 commit cb452d8

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

crates/goose/src/acp/templates/mcp_app_proxy.html

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,20 @@
9999
return prelude + cleanedHtml;
100100
}
101101

102+
function renderSandboxError(message) {
103+
if (guestIframe) {
104+
guestIframe.remove();
105+
guestIframe = null;
106+
}
107+
108+
document.body.textContent = '';
109+
var errorElement = document.createElement('div');
110+
errorElement.setAttribute('role', 'alert');
111+
errorElement.style.cssText = 'box-sizing:border-box; width:100%; height:100%; padding:16px; color:CanvasText; background:transparent; font:13px system-ui, sans-serif;';
112+
errorElement.textContent = message;
113+
document.body.appendChild(errorElement);
114+
}
115+
102116
async function storeGuestHtml(html) {
103117
var proxyParams = getProxyParams();
104118
var cspMeta = document.querySelector('meta[http-equiv="Content-Security-Policy"]');
@@ -149,8 +163,9 @@
149163
try {
150164
guestIframe.src = await storeGuestHtml(guestHtml);
151165
} catch (e) {
152-
console.warn('Failed to use /mcp-app-guest endpoint, falling back to srcdoc:', e);
153-
guestIframe.srcdoc = guestHtml;
166+
console.error('Failed to store MCP app guest HTML:', e);
167+
renderSandboxError('Unable to load MCP app sandbox.');
168+
return;
154169
}
155170

156171
document.body.appendChild(guestIframe);

0 commit comments

Comments
 (0)