Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

test(ui): constrain simulated host message origins

Rahman7fc6b16a3e97
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 72b47375..f46052de 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -15,6 +15,10 @@ this is the *what*, and it is what Settings → About shows as “What's new”.
- `ui` fill MCP Page height and apply MSO branding
- `flows` enforce canonical paths and bounded waits
+**Tests**
+
+- `ui` constrain simulated host message origins
+
## 2026-09-11
**Added**
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index abe88533..b894b315 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,3 +1,10 @@
+## 2026-09-12 — Exact-origin Page browser fixtures
+
+The hosted Semgrep gate flagged a wildcard postMessage target in the new browser
+host simulator. Fixture messages now use the exact reviewed test origin and check
+the sending frame identity. The Page regression and pinned strict Semgrep pass;
+production host-bridge behavior is unchanged.
+
## 2026-09-12 — Full-height MSO Page and shared brand
The embedded Integrations report reproduced the old 48% legacy height cap. Page v14 now
diff --git a/scripts/e2e/mcp-page.mjs b/scripts/e2e/mcp-page.mjs
index 260bf465..ff7fca1c 100644
--- a/scripts/e2e/mcp-page.mjs
+++ b/scripts/e2e/mcp-page.mjs
@@ -84,13 +84,13 @@ try {
window.hostContext={theme:"dark",displayMode:"inline",availableDisplayModes:["inline","fullscreen"],containerDimensions:{maxHeight:680}};
window.addEventListener("message",event=>{
const m=event.data;if(!m||m.jsonrpc!=="2.0")return;
- const frame=document.querySelector("iframe");let result;
+ const frame=document.querySelector("iframe");if(event.origin!=="https://mso-ui.example.com"||event.source!==frame.contentWindow)return;let result;
if(m.method==="ui/initialize")result={protocolVersion:"2026-01-26",hostContext:window.hostContext};
else if(m.method==="ui/notifications/size-changed"){window.lastSize=m.params;frame.style.height=m.params.height+"px";return}
else if(m.method==="ui/request-display-mode"){window.hostContext.displayMode=m.params.mode;frame.style.height=m.params.mode==="fullscreen"?"900px":"680px";result={mode:m.params.mode}}
else if(m.method==="tools/call")result={structuredContent:{result:${JSON.stringify(snapshot)}}};
else return;
- if(m.id!==undefined)event.source.postMessage({jsonrpc:"2.0",id:m.id,result},"*");
+ if(m.id!==undefined)event.source.postMessage({jsonrpc:"2.0",id:m.id,result},"https://mso-ui.example.com");
});
</script><iframe title="MSO Page" src="https://mso-ui.example.com/qa"></iframe></html>`}));
await page.goto("https://chatgpt.com/qa");
@@ -114,7 +114,7 @@ try {
await component.getByRole("button",{name:"Exit fullscreen",exact:true}).click();
await component.getByRole("button",{name:"Fullscreen",exact:true}).waitFor();
const setContext=async context=>{
- await page.evaluate(context=>{window.hostContext={...window.hostContext,...context};document.querySelector("iframe").contentWindow.postMessage({jsonrpc:"2.0",method:"ui/notifications/host-context-changed",params:context},"*")},context);
+ await page.evaluate(context=>{window.hostContext={...window.hostContext,...context};document.querySelector("iframe").contentWindow.postMessage({jsonrpc:"2.0",method:"ui/notifications/host-context-changed",params:context},"https://mso-ui.example.com")},context);
await page.waitForFunction(height=>window.lastSize?.height===height,context.containerDimensions.height??context.containerDimensions.maxHeight);
};
await setContext({theme:"light",containerDimensions:{height:720}});