From 2bd7ca65d1b16b6d7a96ec7dc6aeca23f7030762 Mon Sep 17 00:00:00 2001 From: yaojin Date: Wed, 5 Aug 2026 19:13:29 +0800 Subject: [PATCH] fix(security): isolate HTML preview origin --- .../src/components/WorkspaceOperationPanel.tsx | 4 +++- .../tests/htmlPreviewSandboxContract.test.mjs | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 frontend/tests/htmlPreviewSandboxContract.test.mjs diff --git a/frontend/src/components/WorkspaceOperationPanel.tsx b/frontend/src/components/WorkspaceOperationPanel.tsx index 23f162656..a299a0897 100644 --- a/frontend/src/components/WorkspaceOperationPanel.tsx +++ b/frontend/src/components/WorkspaceOperationPanel.tsx @@ -368,11 +368,13 @@ function HtmlPreviewFrame({ if (fitRafRef.current != null) cancelAnimationFrame(fitRafRef.current); }, []); + // Keep untrusted agent HTML in an opaque origin: combining scripts and same-origin + // would let it access the application's storage and authenticated browser state. return (