-
Notifications
You must be signed in to change notification settings - Fork 1.1k
refactor: Unify Sandbox Iframe Implementation Angular and Lit #981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,7 @@ A2UI utilizes a **double-iframe isolation pattern** to run untrusted third-party | |
|
|
||
| Testing for any changes in this directory requires bringing up the relevant clients and servers. | ||
|
|
||
| ### Contact Multi-Surface Sample (Lit & ADK Agent) | ||
| ### 1. Contact Multi-Surface Sample (Lit & ADK Agent) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mcp_apps_iframe |
||
|
|
||
| This test verifies the sandbox with a Lit-based client and an ADK-based A2A agent. | ||
|
|
||
|
|
@@ -26,3 +26,18 @@ This test verifies the sandbox with a Lit-based client and an ADK-based A2A agen | |
| - Path: `../../lit/contact/` | ||
| - Command: `npm run dev` (requires building the Lit renderer first) | ||
| - URL: `http://localhost:5173/` | ||
|
|
||
| ### 2. MCP Apps (Calculator) (Angular) | ||
|
|
||
| This test verifies the sandbox with an Angular-based client, an MCP Proxy Agent, and a remote MCP Server. | ||
|
|
||
| - **MCP Server (Calculator)**: | ||
| - Path: `../../../agent/mcp/mcp-apps-calculcator/` | ||
sugoi-yuzuru marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Command: `uv run .` (runs on port 8000) | ||
| - **MCP Apps Proxy Agent**: | ||
| - Path: `../../../agent/adk/mcp_app_proxy/` | ||
| - Command: `uv run .` (requires `GEMINI_API_KEY` in `.env`) | ||
| - **Angular Client App**: | ||
| - Path: `../../angular/` | ||
| - Command: `npm start -- mcp_calculator` (requires `npm run build:sandbox` and `npm install`) | ||
| - URL: [`http://localhost:4200/?disable_security_self_test=true`](http://localhost:4200/?disable_security_self_test=true) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,13 +43,19 @@ if (!document.referrer.match(ALLOWED_REFERRER_PATTERN)) { | |
| const EXPECTED_HOST_ORIGIN = new URL(document.referrer).origin; | ||
| const OWN_ORIGIN = new URL(window.location.href).origin; | ||
|
|
||
| // Security self-test: verify iframe isolation is working correctly. | ||
| try { | ||
| window.top!.alert("If you see this, the sandbox is not setup securely."); | ||
| throw "FAIL"; | ||
| } catch (e) { | ||
| if (e === "FAIL") { | ||
| throw new Error("The sandbox is not setup securely."); | ||
| // Check for query param to opt-out of security self-test (for testing) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mcp_apps_iframe.ts |
||
| const urlParams = new URLSearchParams(window.location.search); | ||
| const disableSelfTest = urlParams.get('disable_security_self_test') === 'true'; | ||
|
|
||
| if (!disableSelfTest) { | ||
| // Security self-test: verify iframe isolation is working correctly. | ||
| try { | ||
| window.top!.alert("If you see this, the sandbox is not setup securely."); | ||
| throw "FAIL"; | ||
| } catch (e) { | ||
| if (e === "FAIL") { | ||
| throw new Error("The sandbox is not setup securely."); | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.