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.

fix(portability): derive instance MCP context

Rahman73291282f9a5
diff --git a/.env.example b/.env.example
index 568b9af7..a72406cc 100644
--- a/.env.example
+++ b/.env.example
@@ -130,6 +130,14 @@ OS_SESSION_SECRET=
# usable the policy emits `frame-ancestors 'none'` and the window stays blank —
# closed, on purpose, rather than naming a guessed origin as a permitted framer.
# OS_PUBLIC_ORIGIN=https://mso.example.com
+# Optional dedicated origin assigned to ChatGPT MCP Apps. When unset, MSO derives
+# mso-ui.<rest-of-host> from a leading mso.<rest-of-host>; otherwise it reuses the
+# sanitized public origin. This is instance configuration, never source-owned.
+# OS_MCP_UI_ORIGIN=https://mso-ui.example.com
+# Optional reviewed Page/Surface app catalog. Default is empty (no external frame
+# domains). JSON must be a bounded array of safe HTTPS origins and absolute paths.
+# Example:
+# MSO_SURFACE_APPS_JSON=[{"id":"demo","title":"Demo","description":"Reviewed instance app","origin":"https://demo.example.com","startPath":"/embed","renderer":"iframe","presentation":"inline","environment":"production","sandbox":"allow-scripts allow-same-origin allow-forms"}]
# Authenticated inbound A2A also requires this exact HTTPS origin. It is never
# inferred from Host/X-Forwarded-Host for the public Agent Card/protocol endpoint.
# The CLI can set/clear the stable value safely with:
diff --git a/.github/workflows/dast.yml b/.github/workflows/dast.yml
index 6ffbb083..22667599 100644
--- a/.github/workflows/dast.yml
+++ b/.github/workflows/dast.yml
@@ -23,10 +23,11 @@ jobs:
with:
persist-credentials: false
- - name: Run passive ZAP baseline against maintained live instance
+ - name: Run passive ZAP baseline against configured live instance
+ if: ${{ vars.MSO_DAST_URL != '' }}
uses: zaproxy/action-baseline@de8ad967d3548d44ef623df22cf95c3b0baf8b25 # v0.15.0
with:
- target: https://mso.rahmanef.com
+ target: ${{ vars.MSO_DAST_URL }}
docker_name: ghcr.io/zaproxy/zaproxy@sha256:781a2bdaea47324e7bab583e2263f21d257b0aee61ed51521a5be45f5f5081ef
rules_file_name: security/zap-baseline.conf
cmd_options: -m 2
diff --git a/AGENTS.md b/AGENTS.md
index a0ba50e6..3303df3e 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -36,8 +36,8 @@ Before adding another adapter/facade/barrel, read [`docs/ARCHITECTURE.md`](./doc
## Repository and worktree policy
-- `/home/rahman/projects/mso` on `main` is the **only canonical MSO checkout and release SSOT**.
- Do not create task-specific `mso-*` sibling directories under `~/projects`.
+- The repository root resolved by `git rev-parse --show-toplevel` on `main` is the **canonical MSO checkout and release SSOT for this installation**.
+ Do not infer another operator's home/project path or create task-specific sibling checkouts under the projects root.
- Parallel coding/review tasks may use isolated Git worktrees only under
`~/.cache/mso-worktrees/mso-<task>`. Never let two sessions share one worktree, HEAD, or index.
- Keep development worktrees out of `~/.mso`: that tree is private runtime/credential state and is
diff --git a/CLAUDE.md b/CLAUDE.md
index ba45c6e6..0497c49f 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -174,7 +174,7 @@ to `resources/` (rr) and drive any project from one manifest:
## Routing — the OS is addressable (keep windowing!)
- ONE catch-all route `app/[[...slug]]/page.tsx` (no per-app pages). Windowing is
untouched; only the **focused** app + its launch path is mirrored to the URL
- (`/files/home/rahman`, `/code`). `appshell` `UrlSync` does it.
+ (`/files/home/user`, `/code`). `appshell` `UrlSync` does it.
- **URL writes use the History API, NOT `router.push`.** Opening a window is pure
client state — `router.push` triggers a full RSC transition + remount (slow, flashy
+ breaks the sync). Use `window.history.push/replaceState`; Next 16 syncs
@@ -191,102 +191,36 @@ to `resources/` (rr) and drive any project from one manifest:
host in `next.config` `images.remotePatterns`). Host-fs images + the live Playwright
screenshot stream stay raw `<img>` on purpose (dynamic/auth'd bytes).
-## Deploy / ops (prod :4005 + demo :4006 are systemd, not Dokploy)
-- `mso.service` (:4005, WorkingDir `/home/rahman/projects/mso`) serves
- mso.rahmanef.com via `next start`.
-- `mso-demo.service` (:4006, WorkingDir `/home/rahman/.mso/worktrees/mso-demo-runtime`,
- `NEXT_PUBLIC_OS_DEMO=1` → no auth, mock data). It had been deleted at some point and
- was **re-created 2026-08-03** to make UI/UX verification possible without logging in.
- It binds **127.0.0.1 only, deliberately**: demo mode disables login, so a `0.0.0.0`
- bind would publish an unauthenticated shell. It is mock-data-only so the blast radius
- is small, but exposing it is the owner's decision — put it behind the reverse proxy
- explicitly if you want it public. The checkout is a shallow clone of this repo with
- `node_modules` copied in; rebuild it with the flag (`NEXT_PUBLIC_OS_DEMO=1` is inlined
- at BUILD time) whenever you re-deploy it.
-- **Deploy prod:** use `bun run ship "<conventional commit>"`. It regenerates the
- derived changelog, runs the committed pre-push gates/out-of-tree build, pushes the exact
- SHA, then finalizes the in-place build/service replacement/chunk verification. Through
- MSO/MCP, finalization runs in `mso-self-update.service`; completion is proven only when
- the log ends `UPDATE OK`. Operator update/recovery is Settings → About or
- `mso update run [--rebuild]`. Do not use a bare in-place build merely to verify code.
-- **Service worker** is served from `app/api/sw/route.ts` with a **`beforeFiles`
- rewrite `/sw.js`→`/api/sw`** (in `next.config`): a literal `app/sw.js/route.ts`
- gets shadowed by the optional catch-all, and routes under `/api` are never caught.
- The SW bakes `BUILD_ID` into its cache name so its bytes change every deploy →
- the browser detects a new SW → the "Versi baru" reload toast fires (a static
- `public/sw.js` is byte-identical across deploys, so the toast never fired). It
- caches ONLY icons+manifest, never chunks/HTML.
-- **New routes need a clean build.** Adding a new `app/**/route.ts` or page folder
- may not register under incremental Turbopack. On the live production checkout use
- `mso deploy`; for verification use `mso build`. Never remove/replace live `.next`.
-- **`git add` aborts on a bad pathspec** and stages NOTHING new — after a
- `git rm`, don't re-list the removed file in `git add`; prefer `git add -A` and
- check `git status --short` before committing (a broken commit shipped once this way).
-- **Deploy demo** (it IS running — `active`+`enabled`, 200 on 127.0.0.1:4006): from
- `/home/rahman/.mso/worktrees/mso-demo-runtime`: `git fetch origin -q && git reset --hard
- origin/main -q && bun run build && sudo systemctl restart mso-demo.service`.
- Mind the cwd — running the sync from the prod dir is a classic slip.
-- **`bun run build` is now fail-closed on a live checkout.** The package script
- acquires the checkout runtime-exclusion lock and refuses before touching `.next`
- when a Next/MSO runtime is serving that same checkout. Use `mso build` for the
- out-of-tree compile proof and `mso deploy` for a production rebuild. The reason is
- fundamental: Next loads manifests at process start while `next build` replaces
- `.next`; mixing those generations makes already-served HTML point at missing chunks.
- Raw `next build` is an internal deploy primitive only after the supported lifecycle
- has quiesced the runtime.
-- **The Browser app powers a systemd USER unit**, `camoufox-vnc.service` in
- `~/.config/systemd/user/`, whose `ExecStart` points at **`scripts/camoufox-vnc-service`
- in THIS repo** (it used to live untracked under `~/.openclaw/workspace/`, so a fresh
- clone could not start the Browser at all and the `-nopw` → `-rfbauth` hardening had no
- version control). The script refuses to start without a VNC password file. Two further
- host-side facts that the installer flow (`scripts/install.sh` → verified `scripts/install-core.sh`) NOW CARRIES, and that the feature dies
- quietly without: (1) `loginctl enable-linger <user>`, or the unit stops at
- logout and never starts at boot; (2) `Environment=XDG_RUNTIME_DIR=/run/user/<uid>` in
- mso.service — a system unit running as `User=` gets NO user-bus address, so without it
- every `systemctl --user` call fails with "Failed to connect to bus: No medium found".
- `lib/camoufox/service.ts` reports that as an error rather than as "not installed", so the
- panel tells you which one it is.
- Treating these as un-carryable host lore was itself the bug: a host set up by
- the installer flow had neither, so the Browser app looked uninstalled and every
- managed-app install died at the step that registers its user service. The installer sets
- both now, and `lib/managed-apps/user-bus.ts` re-derives the bus address at call time so a
- cockpit installed BEFORE this change is not left broken until someone re-runs the
- installer. An existing host still needs the linger (`sudo loginctl enable-linger <user>`);
- re-running `scripts/install.sh` applies the rest.
- (3) The unit is deliberately left **`disabled`** with `Restart=no` + `RuntimeMaxSec=2h`:
- the UI toggle is plain `start`/`stop` and must NEVER go back to `enable --now`, or every
- click re-arms boot autostart — that is how it once ran 26 h with zero viewers. Ship
- `Restart=no` and the lease together; a lease under `Restart=always` is a 2-hourly reboot
- loop. (4) `CAMOUFOX_PROFILE` points at `~/.local/share/camoufox/profiles/linkedin`, NOT
- `~/.cache` — it holds the live logins, and a wrong path makes `mkdir -p` create an empty
- profile with no error. This unit has no copy or installer in the repo, so (1)–(4) exist
- nowhere else. (5) That profile holds a **live Google session** (`SID`,
- `__Secure-1PSID`, `SAPISID`) as well as LinkedIn's `li_at` — cookie theft there is
- account takeover with no password and no 2FA prompt. So: the profile dir is `chmod 700`
- on every start (Firefox writes `cookies.sqlite` 0644 by default), the VNC password goes
- in the viewer URL's **fragment** and never its query string, and every start snapshots
- `cookies.sqlite*` + `key4.db` + `cert9.db` into `~/.local/state/camoufox/session-backup/`
- (3 generations, 0700). Restore after an accidental wipe: stop the unit,
- `cp -p ~/.local/state/camoufox/session-backup/1/* <profile>/`, start. Roll back to `2`
- or `3` if generation `1` already captured the logged-out state.
-- **Two committed browser checks**: `bun run e2e` (shell) and `bun run e2e:preview
- [width]` (Preview app + Settings → About update panel). Both install the session
- cookie rather than drive the login form, and both take a viewport — run them at
- 1280 AND 390. `e2e:preview` provisions its own fixtures under
- `~/.cache/mso-e2e-preview` and asserts bytes ARRIVED (`naturalWidth`, `readyState`,
- text inside the sandboxed frame), not that elements exist.
-- Verify shell behaviour with **Playwright directly** — `os-browser/node_modules/playwright`
- (CommonJS) is the repo's only install — at 1280 for desktop and 390 for mobile. The
- `os-browser` SERVICE is gone (its source was deleted 2026-08-10; only the vendored
- Playwright install remains). Point Playwright at the **demo on 127.0.0.1:4006** — it
- runs, and demo mode skips login entirely — or at :4005 and log in. Drive Spotlight with Meta+k; click the dock by
- the BOTTOM-most `a[href="/<slug>"]` (the centre ones are the hidden Launchpad).
- `X-Content-Type-Options: nosniff` is set on all routes, so wrong MIME is fatal — keep
- static Content-Types correct.
+## Deploy / ops (instance-derived, not source-hardcoded)
+- `mso.service` normally serves the current installed checkout on :4005. Resolve its actual
+ `WorkingDirectory` from the service unit and its browser origin from `OS_PUBLIC_ORIGIN`; never
+ copy a maintainer home path, hostname, or sibling app domain into portable source.
+- Optional demo/review runtimes are installation-owned and must remain mock-only, loopback-bound
+ unless explicitly published, and outside the canonical checkout. Discover their actual service
+ unit/worktree instead of assuming a user or path.
+- **Deploy prod:** use `bun run ship "<conventional commit>"`. It regenerates the derived
+ changelog, runs committed pre-push gates/out-of-tree build, pushes the exact SHA, then finalizes
+ the supported service replacement/chunk verification. Through MSO/MCP, finalization runs in
+ `mso-self-update.service`; completion is proven only when the log ends `UPDATE OK`. Operator
+ update/recovery is Settings → About or `mso update [--rebuild]`. Do not use a bare in-place
+ build merely to verify code.
+- **Service worker** is served from `app/api/sw/route.ts` with a `beforeFiles` rewrite
+ `/sw.js`→`/api/sw`. It caches only icons+manifest, never chunks/HTML, and bakes `BUILD_ID` into
+ its cache name so browser clients detect a new deployment.
+- **New routes need a clean build.** On a live production checkout use `mso deploy`; for
+ verification use `mso build`. Never remove/replace a live `.next`.
+- **`bun run build` is fail-closed on a live checkout.** Use `mso build` for the out-of-tree
+ compile proof and `mso deploy` for a production rebuild. Raw `next build` is an internal deploy
+ primitive only after the supported lifecycle has quiesced the runtime.
+- **The Browser app powers a systemd USER unit** whose `ExecStart` points at
+ `scripts/camoufox-vnc-service` in this repo. The script discovers the current user-local
+ Camoufox executable unless `CAMOUFOX_BROWSER` explicitly overrides it.
+- For browser verification, discover an available authenticated/local or mock-only endpoint from
+ the current installation; do not encode an operator hostname or home path into tests.
## Rules in force
- **One canonical checkout; parallel work only through isolated hidden worktrees.**
- `/home/rahman/projects/mso` on `main` is the only canonical checkout and release SSOT.
+ the current `git rev-parse --show-toplevel` checkout on `main` is the canonical release SSOT.
Never create task-specific `mso-*` siblings under `~/projects` and never let two
sessions share one worktree, `HEAD`, or index. If parallel work is necessary, use one
Git worktree per task under `~/.cache/mso-worktrees/mso-<task>`. Never put a development
diff --git a/app/api/auth/session-cookie.test.ts b/app/api/auth/session-cookie.test.ts
index 9675d77c..fa19a30d 100644
--- a/app/api/auth/session-cookie.test.ts
+++ b/app/api/auth/session-cookie.test.ts
@@ -27,14 +27,14 @@ const loginReq = (host: string) =>
body: JSON.stringify({ password: PASSWORD, deviceId: DEVICE, deviceLabel: "test" }),
});
-async function login(host = "mso.rahmanef.com"): Promise<string[]> {
+async function login(host = "mso.example.com"): Promise<string[]> {
const { POST } = await import("./login/route");
const res = await POST(loginReq(host) as never);
expect(res.status).toBe(200);
return res.headers.getSetCookie();
}
-async function logout(host = "mso.rahmanef.com"): Promise<string[]> {
+async function logout(host = "mso.example.com"): Promise<string[]> {
const { POST } = await import("./logout/route");
const res = await POST(new Request("http://internal/api/auth/logout", { method: "POST", headers: { host } }));
return res.headers.getSetCookie();
@@ -77,12 +77,12 @@ describe("session cookie on the wire — host-only (default)", () => {
describe("session cookie on the wire — OS_SESSION_COOKIE_DOMAIN set", () => {
beforeEach(() => {
- process.env.OS_SESSION_COOKIE_DOMAIN = "mso.rahmanef.com";
+ process.env.OS_SESSION_COOKIE_DOMAIN = "mso.example.com";
});
it("login widens to the domain, keeping every other attribute", async () => {
const [cookie] = await login();
- expect(cookie).toContain("Domain=mso.rahmanef.com");
+ expect(cookie).toContain("Domain=mso.example.com");
expect(cookie).toContain("HttpOnly");
expect(cookie).toContain("Secure");
expect(cookie.toLowerCase()).toContain("samesite=strict");
@@ -91,7 +91,7 @@ describe("session cookie on the wire — OS_SESSION_COOKIE_DOMAIN set", () => {
it("logout clears BOTH the domain cookie and the pre-widening host-only one", async () => {
const cookies = await logout();
expect(cookies).toHaveLength(2);
- const withDomain = cookies.find((c) => c.includes("Domain=mso.rahmanef.com"));
+ const withDomain = cookies.find((c) => c.includes("Domain=mso.example.com"));
const hostOnly = cookies.find((c) => !c.toLowerCase().includes("domain="));
expect(withDomain).toContain("Max-Age=0");
expect(hostOnly).toContain("Max-Age=0");
diff --git a/app/api/integrations/setup/route.test.ts b/app/api/integrations/setup/route.test.ts
index 19ae0150..8bb26cfb 100644
--- a/app/api/integrations/setup/route.test.ts
+++ b/app/api/integrations/setup/route.test.ts
@@ -6,18 +6,18 @@ import path from "node:path";
vi.mock("server-only", () => ({}));
vi.mock("@/lib/host/audit-api", () => ({ audit: vi.fn() }));
let root: string;
-beforeEach(async () => { root = await fs.mkdtemp(path.join(os.tmpdir(), "mso-setup-route-")); process.env.OS_INFRA_STORE = path.join(root, "infra.json"); vi.resetModules(); });
-afterEach(async () => { delete process.env.OS_INFRA_STORE; await fs.rm(root, { recursive: true, force: true }); vi.resetModules(); });
-const endpoint = "https://mso.rahmanef.com/api/integrations/setup";
-function req(token: string, origin = "https://mso-ui.rahmanef.com", body: unknown = { action: "schema" }) {
+beforeEach(async () => { root = await fs.mkdtemp(path.join(os.tmpdir(), "mso-setup-route-")); process.env.OS_INFRA_STORE = path.join(root, "infra.json"); process.env.OS_PUBLIC_ORIGIN = "https://mso.example.test"; process.env.OS_MCP_UI_ORIGIN = "https://mso-ui.example.test"; vi.resetModules(); });
+afterEach(async () => { delete process.env.OS_INFRA_STORE; delete process.env.OS_PUBLIC_ORIGIN; delete process.env.OS_MCP_UI_ORIGIN; await fs.rm(root, { recursive: true, force: true }); vi.resetModules(); });
+const endpoint = "https://mso.example.test/api/integrations/setup";
+function req(token: string, origin = "https://mso-ui.example.test", body: unknown = { action: "schema" }) {
return new NextRequest(endpoint, { method: "POST", headers: { origin, authorization: `Bearer ${token}`, "content-type": "application/json" }, body: JSON.stringify(body) });
}
it("allows only exact trusted Origins and never grants credentialed CORS", async () => {
const { OPTIONS, POST } = await import("./route");
- const good = OPTIONS(new NextRequest(endpoint, { method: "OPTIONS", headers: { origin: "https://mso-ui.rahmanef.com" } }));
- expect(good.status).toBe(204); expect(good.headers.get("access-control-allow-origin")).toBe("https://mso-ui.rahmanef.com");
+ const good = OPTIONS(new NextRequest(endpoint, { method: "OPTIONS", headers: { origin: "https://mso-ui.example.test" } }));
+ expect(good.status).toBe(204); expect(good.headers.get("access-control-allow-origin")).toBe("https://mso-ui.example.test");
expect(good.headers.has("access-control-allow-credentials")).toBe(false);
- for (const origin of ["https://evil.invalid", "https://mso-ui.rahmanef.com.evil.invalid", "null"]) expect((await POST(req("x".repeat(43), origin))).status).toBe(403);
+ for (const origin of ["https://evil.invalid", "https://mso-ui.example.test.evil.invalid", "null"]) expect((await POST(req("x".repeat(43), origin))).status).toBe(403);
expect((await POST(req("x".repeat(43)))).status).toBe(401);
});
it("safe schema is capability protected and secret fields have no prefill", async () => {
diff --git a/app/api/v1/integrations/route.test.ts b/app/api/v1/integrations/route.test.ts
index 7ba25e0b..c8fe3a8b 100644
--- a/app/api/v1/integrations/route.test.ts
+++ b/app/api/v1/integrations/route.test.ts
@@ -10,14 +10,14 @@ vi.mock("@/lib/host/audit-api",()=>({audit:vi.fn()}));
let root:string;
beforeEach(async()=>{auth.role="owner";root=await fs.mkdtemp(path.join(os.tmpdir(),"mso-integration-api-"));process.env.OS_INFRA_STORE=path.join(root,"infra.json");vi.resetModules();});
afterEach(async()=>{delete process.env.OS_INFRA_STORE;await fs.rm(root,{recursive:true,force:true});vi.resetModules();});
-const req=(body:unknown)=>new NextRequest("https://mso.rahmanef.com/api/v1/integrations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(body)});
+const req=(body:unknown)=>new NextRequest("https://mso.example.com/api/v1/integrations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(body)});
it("enforces Owner on profile metadata and mutations regardless of selected credential user",async()=>{
- const {GET,POST}=await import("./route");for(const role of [null,"viewer","operator"]){auth.role=role;expect((await GET(new NextRequest("https://mso.rahmanef.com/api/v1/integrations"))).status).toBe(403);expect((await POST(req({mode:"manage",action:"user.create",confirm:true,user:"owner"}))).status).toBe(403);}
+ const {GET,POST}=await import("./route");for(const role of [null,"viewer","operator"]){auth.role=role;expect((await GET(new NextRequest("https://mso.example.com/api/v1/integrations"))).status).toBe(403);expect((await POST(req({mode:"manage",action:"user.create",confirm:true,user:"owner"}))).status).toBe(403);}
});
it("shares confirmed actions with the CLI/MCP core and rejects secret-shaped metadata",async()=>{
const {GET,POST}=await import("./route");
expect((await POST(req({mode:"manage",action:"user.create",user:"alice"}))).status).toBe(403);
expect((await POST(req({mode:"manage",action:"user.create",confirm:true,user:"alice",token:"synthetic"}))).status).toBe(400);
expect((await POST(req({mode:"manage",action:"user.create",confirm:true,user:"alice"}))).status).toBe(200);
- const response=await GET(new NextRequest("https://mso.rahmanef.com/api/v1/integrations?view=users"));expect(await response.json()).toMatchObject({users:[{id:"alice"}],user:"alice"});
+ const response=await GET(new NextRequest("https://mso.example.com/api/v1/integrations?view=users"));expect(await response.json()).toMatchObject({users:[{id:"alice"}],user:"alice"});
});
diff --git a/app/api/v1/integrations/transfer/route.test.ts b/app/api/v1/integrations/transfer/route.test.ts
index 62dd2aa5..8fdd957f 100644
--- a/app/api/v1/integrations/transfer/route.test.ts
+++ b/app/api/v1/integrations/transfer/route.test.ts
@@ -4,11 +4,11 @@ import sample from '@/schemas/integration-bundle-example.json';
vi.mock('server-only',()=>({}));vi.mock('@/lib/host/audit-api',()=>({audit:vi.fn()}));
const auth=vi.hoisted(()=>({role:'owner' as string}));vi.mock('@/lib/auth/require-session',()=>({getSessionContext:async()=>({role:auth.role,session:{device_id:'test-device'}})}));
let root:string;
-beforeEach(async()=>{root=await fs.mkdtemp(path.join(os.tmpdir(),'mso-transfer-route-'));process.env.OS_INFRA_STORE=path.join(root,'infra.json');auth.role='owner';vi.resetModules()});
-afterEach(async()=>{delete process.env.OS_INFRA_STORE;await fs.rm(root,{recursive:true,force:true});vi.resetModules()});
-const req=(body:unknown)=>new NextRequest('https://mso.rahmanef.com/api/v1/integrations/transfer',{method:'POST',headers:{'content-type':'application/json',origin:'https://mso.rahmanef.com'},body:JSON.stringify(body)});
+beforeEach(async()=>{root=await fs.mkdtemp(path.join(os.tmpdir(),'mso-transfer-route-'));process.env.OS_INFRA_STORE=path.join(root,'infra.json');process.env.OS_PUBLIC_ORIGIN='https://mso.example.test';auth.role='owner';vi.resetModules()});
+afterEach(async()=>{delete process.env.OS_INFRA_STORE;delete process.env.OS_PUBLIC_ORIGIN;await fs.rm(root,{recursive:true,force:true});vi.resetModules()});
+const req=(body:unknown)=>new NextRequest('https://mso.example.test/api/v1/integrations/transfer',{method:'POST',headers:{'content-type':'application/json',origin:'https://mso.example.test'},body:JSON.stringify(body)});
it('refuses non-owner export and import',async()=>{const {POST}=await import('./route');auth.role='viewer';expect((await POST(req({action:'export'}))).status).toBe(403);expect((await POST(req({action:'import',document:sample}))).status).toBe(403)});
it('supports preview then confirmed application and returns only safe summaries',async()=>{const {POST}=await import('./route');const r=await POST(req({action:'import',document:sample}));expect(r.status).toBe(200);const p=await r.json();expect(p.applied).toBeUndefined();const applied=await POST(req({action:'import',document:sample,apply:true,confirm:p.planId}));expect(applied.status).toBe(200);const exportResult=await POST(req({action:'export'}));expect((await exportResult.json()).bundle.mode).toBe('metadata');expect(exportResult.headers.get('cache-control')).toContain('no-store')});
it('rejects giant, malformed, or non-JSON bodies',async()=>{const {POST}=await import('./route');expect((await POST(req({action:'import',document:'x'.repeat(3*1024*1024)}))).status).toBe(413);const request=req({action:'export'});request.headers.set('content-type','text/plain');expect((await POST(request)).status).toBe(415);expect((await POST(req({action:'export',includeSecrets:'true'}))).status).toBe(400)});
-it("returns the configured public entrypoint instead of a VPS loopback URL",async()=>{const {GET}=await import("./route");const r=await GET();expect(r.status).toBe(200);expect((await r.json()).url).toBe("https://mso.rahmanef.com/integrations?transfer=1");auth.role="viewer";expect((await GET()).status).toBe(403)});
+it("returns the configured public entrypoint instead of a VPS loopback URL",async()=>{const {GET}=await import("./route");const r=await GET();expect(r.status).toBe(200);expect((await r.json()).url).toBe("https://mso.example.test/integrations?transfer=1");auth.role="viewer";expect((await GET()).status).toBe(403)});
diff --git a/app/api/v1/managed-apps/[id]/update/route.ts b/app/api/v1/managed-apps/[id]/update/route.ts
index bbe4e194..903fb03d 100644
--- a/app/api/v1/managed-apps/[id]/update/route.ts
+++ b/app/api/v1/managed-apps/[id]/update/route.ts
@@ -39,8 +39,8 @@ function statusFor(reason: string): number {
}
// READ-ONLY, and that is load-bearing: the CSRF gate in proxy.ts only covers
-// POST/PUT/PATCH/DELETE, and the session cookie is Domain=mso.rahmanef.com with
-// SameSite=Strict, so every sibling origin under rahmanef.com (~100 on this
+// POST/PUT/PATCH/DELETE, and the session cookie is Domain=mso.example.com with
+// SameSite=Strict, so every sibling origin under the configured site (~100 on this
// box) can make the browser send this GET. If it probed, that would be a blind
// cross-origin trigger for `hermes update --check` — two git fetches inside the
// operator's own checkout — from any of them. So it serves the cache and
diff --git a/app/api/v1/managed-apps/proxy-split-origin.test.ts b/app/api/v1/managed-apps/proxy-split-origin.test.ts
index 3adffb0c..c8a76073 100644
--- a/app/api/v1/managed-apps/proxy-split-origin.test.ts
+++ b/app/api/v1/managed-apps/proxy-split-origin.test.ts
@@ -1,5 +1,5 @@
// The proxy route in SPLIT-ORIGIN mode: the dashboard is root-mounted on its own
-// host (hermes.mso.rahmanef.com), which is what finally closes the window.top reach
+// host (hermes.mso.example.com), which is what finally closes the window.top reach
// — the frame is cross-origin now, so `allow-same-origin` no longer grants the
// upstream a handle on the cockpit. Two claims are load-bearing here:
// 1. the OLD same-origin URL must stop answering, or the hole survives at it;
@@ -28,11 +28,11 @@ vi.mock("@/lib/managed-apps/catalog", async () => {
const fetchMock = vi.fn();
vi.stubGlobal("fetch", fetchMock);
-const TEMPLATE = "{id}.mso.rahmanef.com";
-const APP_HOST = "hermes.mso.rahmanef.com";
+const TEMPLATE = "{id}.mso.example.com";
+const APP_HOST = "hermes.mso.example.com";
const APP_ORIGIN = `https://${APP_HOST}/`;
const APP_SOCKET = APP_ORIGIN.replace("https:", "wss:");
-const COCKPIT = "https://mso.rahmanef.com";
+const COCKPIT = "https://mso.example.com";
const PREFIX = "/api/v1/managed-apps/hermes/proxy";
// Verbatim head of ~/.hermes/hermes-agent/hermes_cli/web_dist/index.html.
@@ -79,9 +79,9 @@ beforeEach(() => {
describe("the cockpit-origin URL stops answering", () => {
it("404s the proxy route without the middleware's app-host stamp", async () => {
const { GET } = await route();
- // Same URL as before the split, on mso.rahmanef.com: same-origin with the
+ // Same URL as before the split, on mso.example.com: same-origin with the
// cockpit, allow-same-origin frame — the hole. It must not serve.
- const res = await GET(new Request(`${COCKPIT}${PREFIX}/chat`, { headers: { host: "mso.rahmanef.com" } }), ctx(["chat"]));
+ const res = await GET(new Request(`${COCKPIT}${PREFIX}/chat`, { headers: { host: "mso.example.com" } }), ctx(["chat"]));
expect(res.status).toBe(404);
expect(fetchMock).not.toHaveBeenCalled();
});
@@ -241,7 +241,7 @@ describe("root-mounted policy", () => {
it.each([
["unset", ""],
- ["missing a scheme", "mso.rahmanef.com"],
+ ["missing a scheme", "mso.example.com"],
])("falls back to the host template's parent when OS_PUBLIC_ORIGIN is %s", async (_label, value) => {
fetchMock.mockResolvedValueOnce(new Response("ok", { status: 200 }));
const { GET } = await route(TEMPLATE, value);
diff --git a/app/api/v1/managed-apps/proxy.test.ts b/app/api/v1/managed-apps/proxy.test.ts
index 115fe572..973648ec 100644
--- a/app/api/v1/managed-apps/proxy.test.ts
+++ b/app/api/v1/managed-apps/proxy.test.ts
@@ -28,7 +28,7 @@ vi.stubGlobal("fetch", fetchMock);
const PREFIX = "/api/v1/managed-apps/hermes/proxy";
const HOST_HEADER = "x-os-managed-app-host";
// Dashboards are only served from an app host, so every test runs in that shape.
-const APP_HOSTS = "{id}.mso.rahmanef.com";
+const APP_HOSTS = "{id}.mso.example.com";
const ctx = (path: string[]) => ({ params: Promise.resolve({ id: "hermes", path }) });
// Middleware stamps the app host it matched; the route 404s without it, because that
@@ -63,7 +63,7 @@ describe("managed-app proxy cookie isolation", () => {
headers: {
cookie: "session=mso-secret; mso-device=deadbeef; mapp_hermes_session=upstream-sid",
origin: "http://localhost",
- referer: "https://hermes.mso.rahmanef.com/login?next=%2Fchat",
+ referer: "https://hermes.mso.example.com/login?next=%2Fchat",
},
}),
ctx(["chat"]),
@@ -190,15 +190,15 @@ describe("managed-app proxy cookie isolation", () => {
}),
);
const { GET } = await import("./[id]/proxy/[[...path]]/route");
- const res = await GET(req("chat", { headers: { host: "mso.rahmanef.com", "x-forwarded-proto": "https" } }), ctx(["chat"]));
+ const res = await GET(req("chat", { headers: { host: "mso.example.com", "x-forwarded-proto": "https" } }), ctx(["chat"]));
const csp = res.headers.get("content-security-policy")!;
- const appUrl = "https://hermes.mso.rahmanef.com/";
+ const appUrl = "https://hermes.mso.example.com/";
expect(res.headers.get("x-frame-options")).toBeNull();
// The upstream's hash pin survives; its frame-ancestors 'none' does not, or the
// cockpit could not display the dashboard it is proxying.
expect(csp).toContain(`script-src ${appUrl} 'sha256-abc='`);
- expect(csp).toContain("frame-ancestors 'self' https://mso.rahmanef.com");
- expect(csp).toContain(`connect-src ${appUrl} wss://hermes.mso.rahmanef.com/ https://api.openai.com`);
+ expect(csp).toContain("frame-ancestors 'self' https://mso.example.com");
+ expect(csp).toContain(`connect-src ${appUrl} wss://hermes.mso.example.com/ https://api.openai.com`);
expect(csp).not.toContain("'unsafe-inline'");
});
});
diff --git a/app/api/v1/managed-apps/update-route.test.ts b/app/api/v1/managed-apps/update-route.test.ts
index 921dd310..10332fa7 100644
--- a/app/api/v1/managed-apps/update-route.test.ts
+++ b/app/api/v1/managed-apps/update-route.test.ts
@@ -113,7 +113,7 @@ describe("the gates, in order", () => {
describe("what each action answers with", () => {
// The GET sits OUTSIDE the CSRF gate (proxy.ts covers mutating verbs only)
- // and the session cookie is Domain=mso.rahmanef.com, so any sibling origin can
+ // and the session cookie is Domain=mso.example.com, so any sibling origin can
// make a browser send it. If it probed, that would be a blind cross-origin
// trigger for `hermes update --check` — two git fetches in the operator's
// checkout. It reads the cache; the probe is a POST, behind the gate.
diff --git a/app/integrations/route.test.ts b/app/integrations/route.test.ts
index c1a03319..6d6927df 100644
--- a/app/integrations/route.test.ts
+++ b/app/integrations/route.test.ts
@@ -13,9 +13,9 @@ describe("friendly native Integrations page", () => {
expect(() => new Function(html.match(/<script nonce="[^"]+">([\s\S]*)<\/script>/)![1])).not.toThrow();
});
it("lets the trusted HTML endpoint own its nonce while retaining owner mutation CSRF checks", async () => {
- const read = await proxy(new NextRequest("https://mso.rahmanef.com/integrations", { headers: { host: "mso.rahmanef.com" } }));
+ const read = await proxy(new NextRequest("https://mso.example.com/integrations", { headers: { host: "mso.example.com" } }));
expect(read.headers.get("content-security-policy")).toBeNull();
- const write = await proxy(new NextRequest("https://mso.rahmanef.com/api/v1/infra/setup", { method: "POST", headers: { host: "mso.rahmanef.com", origin: "https://evil.invalid", "sec-fetch-site": "cross-site" }, body: "{}" }));
+ const write = await proxy(new NextRequest("https://mso.example.com/api/v1/infra/setup", { method: "POST", headers: { host: "mso.example.com", origin: "https://evil.invalid", "sec-fetch-site": "cross-site" }, body: "{}" }));
expect(write.status).toBe(403);
});
});
diff --git a/app/layout.tsx b/app/layout.tsx
index 5ba9dc1e..af311ba2 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -5,31 +5,41 @@ import { GeistMono } from "geist/font/mono";
import { RegisterSW } from "./register-sw";
import { InstallPrompt } from "./install-prompt";
import "./globals.css";
+import { publicMsoOrigin } from "@/lib/mcp/ui-config";
-export const metadata: Metadata = {
- metadataBase: new URL("https://mso.rahmanef.com"),
- applicationName: "Manef Shell OS",
- title: "Manef Shell OS — browser-based server control plane",
- description: "A browser-based graphical shell for a Linux server you own — terminal, files, metrics, and AI in one mobile-first pane.",
- manifest: "/manifest.webmanifest",
- appleWebApp: { capable: true, title: "MSO", statusBarStyle: "black-translucent" },
- // Favicon + apple-touch + OG come from the file conventions (app/icon.svg,
- // app/apple-icon.tsx, app/opengraph-image.tsx) — no manual `icons` field.
- openGraph: {
+export function generateMetadata(): Metadata {
+ return {
+ metadataBase: new URL(publicMsoOrigin()),
+ applicationName: "Manef Shell OS",
title: "Manef Shell OS — browser-based server control plane",
- description: "A browser-based graphical shell for a Linux server you own — terminal, files, metrics, and AI in one mobile-first pane.",
- siteName: "Manef Shell OS",
- type: "website",
- },
- twitter: {
- card: "summary_large_image",
- title: "Manef Shell OS — browser-based server control plane",
- description: "A browser-based graphical shell for a Linux server you own — terminal, files, metrics, and AI in one mobile-first pane.",
- },
- // Owner-only tool behind client auth — keep it out of search indexes (every
- // catch-all slug returns 200 HTML). The GitHub repo is the discoverable surface.
- robots: { index: false, follow: false },
-};
+ description:
+ "A browser-based graphical shell for a Linux server you own — terminal, files, metrics, and AI in one mobile-first pane.",
+ manifest: "/manifest.webmanifest",
+ appleWebApp: {
+ capable: true,
+ title: "MSO",
+ statusBarStyle: "black-translucent",
+ },
+ // Favicon + apple-touch + OG come from the file conventions (app/icon.svg,
+ // app/apple-icon.tsx, app/opengraph-image.tsx) — no manual `icons` field.
+ openGraph: {
+ title: "Manef Shell OS — browser-based server control plane",
+ description:
+ "A browser-based graphical shell for a Linux server you own — terminal, files, metrics, and AI in one mobile-first pane.",
+ siteName: "Manef Shell OS",
+ type: "website",
+ },
+ twitter: {
+ card: "summary_large_image",
+ title: "Manef Shell OS — browser-based server control plane",
+ description:
+ "A browser-based graphical shell for a Linux server you own — terminal, files, metrics, and AI in one mobile-first pane.",
+ },
+ // Owner-only tool behind client auth — keep it out of search indexes (every
+ // catch-all slug returns 200 HTML). The GitHub repo is the discoverable surface.
+ robots: { index: false, follow: false },
+ };
+}
export const viewport: Viewport = {
width: "device-width",
@@ -53,7 +63,12 @@ export default async function RootLayout({
// <body>, the :root custom property is invalid at computed-value time and
// silently collapses to the Tailwind preflight stack (fonts never apply).
return (
- <html lang="en" data-theme="light" suppressHydrationWarning className={`${GeistSans.variable} ${GeistMono.variable}`}>
+ <html
+ lang="en"
+ data-theme="light"
+ suppressHydrationWarning
+ className={`${GeistSans.variable} ${GeistMono.variable}`}
+ >
<body className="antialiased overflow-hidden select-none">
{/* Pre-hydration theme: set data-theme from localStorage before the body
paints (dark users otherwise get a light flash). A raw nonced <script>
diff --git a/bin/mso b/bin/mso
index 3cdade62..11bd5d08 100755
--- a/bin/mso
+++ b/bin/mso
@@ -3,7 +3,7 @@
#
# Usage: mso [options] <command> [args]
#
-# mso.rahmanef.com is only ONE frontend. Everything it can do is a call to the
+# The configured MSO public origin is only ONE frontend. Everything it can do is a call to the
# same /api surface, so this CLI reaches every feature without a browser.
# Auth = signed session cookie (password + approved device role), cached in a jar.
#
diff --git a/claude-skills/mso-image-editor/image-editor.sh b/claude-skills/mso-image-editor/image-editor.sh
index 3c6b481a..d8136eb3 100755
--- a/claude-skills/mso-image-editor/image-editor.sh
+++ b/claude-skills/mso-image-editor/image-editor.sh
@@ -147,7 +147,7 @@ case "$cmd" in
echo "saved doc → $out (render: $0 view $out)" ;;
view)
p="${1:?path}"; shift || true
- base="${OS_PUBLIC_BASE:-https://mso.rahmanef.com}"
+ base="${OS_PUBLIC_BASE:-${OS_PUBLIC_ORIGIN:-http://127.0.0.1:4005}}"
case "$p" in /*) ;; *) p="/$p" ;; esac
url="$base/studio$p"; echo "$url"
if [ "${1:-}" = "--shot" ]; then
diff --git a/claude-skills/mso-repo-work/SKILL.md b/claude-skills/mso-repo-work/SKILL.md
index 76a23451..9a9cb80d 100644
--- a/claude-skills/mso-repo-work/SKILL.md
+++ b/claude-skills/mso-repo-work/SKILL.md
@@ -13,7 +13,7 @@ For multi-step work, call `workflow_start` directly. It already searches skills
## Canonical checkout and isolation
-- `/home/rahman/projects/mso` on `main` is the canonical MSO checkout and the only release SSOT.
+- `~/projects/mso` on `main` is the canonical MSO checkout and the only release SSOT.
- Never create task-specific `mso-*` siblings in `~/projects`. When isolation is genuinely needed,
create/use one Git worktree per task under `~/.cache/mso-worktrees/mso-<task>`.
Do not use `~/.mso` for source worktrees; it is MSO private state and host-file guards deny it.
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index 2b32099a..6e23bf4a 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -133,12 +133,13 @@ lookup, collision detection, tracing, evidence, and learning, but no longer bind
widgets; prior Block/Page URIs plus the previous workflow/surface resource URIs remain readable aliases but are not advertised. Page tools use the standard MCP Apps `ui.resourceUri` binding only; the legacy ChatGPT `openai/outputTemplate` alias is intentionally absent so one tool result maps to one Page mount.
Reviewed Page apps may use a nested iframe only when their exact HTTPS origin exists in the
-code-owned Page catalog and the MCP resource CSP `frameDomains`; anti-frame apps stay on the
-remote-browser seam. This trust catalog is deliberately separate from Store/runtime `AppManifest`
-data. A locally installed `runtime:"html"` app or HTML widget is user-controlled presentation data
+validated per-installation `MSO_SURFACE_APPS_JSON` catalog and the MCP resource CSP `frameDomains`;
+portable source defaults to no external Page apps. Anti-frame apps stay on the remote-browser seam.
+This trust catalog is deliberately separate from Store/runtime `AppManifest` data. A locally installed `runtime:"html"` app or HTML widget is user-controlled presentation data
and cannot grant itself a ChatGPT nested-frame origin. `srcDoc` HTML remains opaque-origin
-sandboxed, the MCP widget stays on `mso-ui.rahmanef.com`, and the authenticated
-`mso.rahmanef.com` cockpit retains its deny-framing headers. The split prevents convenient
+sandboxed. The MCP widget origin comes from `OS_MCP_UI_ORIGIN`, or is derived from
+`OS_PUBLIC_ORIGIN` using the `mso.` → `mso-ui.` sibling when possible; the authenticated cockpit
+origin remains deployment-owned and retains its deny-framing headers. The split prevents convenient
HTML/runtime extensibility from becoming a CSP privilege-escalation path.
## 5. Host API and filesystem model
@@ -282,4 +283,4 @@ future archaeology task.
### ChatGPT MSO Page trust boundary
-Each MSO connector/server scope owns its own Page app catalog. Core MSO Page code must not import project identities or trusted frame origins from another server scope. The current Fresh 3/VPSKU app target is Play Together (`game.rahmanef.com`). Only its dedicated `/embed` namespace opts into framing by `mso-ui.rahmanef.com`; the normal Play Together shell remains anti-frame. MSO allowlists the exact game origin and enforces the `/embed` prefix in the browser-side Page renderer. Any future iframe origin requires an explicit review and resource-URI/toolset bump. The Block resource has no frame domains.
+Each MSO connector/server scope owns its own Page app catalog. Core MSO Page code must not import project identities or trusted frame origins from another server scope. Portable source ships with an empty external-app catalog. An installation may opt into reviewed apps through bounded `MSO_SURFACE_APPS_JSON`; MSO validates each exact HTTPS origin, approved start-path prefix, renderer, sandbox, and presentation before it can enter Page CSP. The dedicated widget origin is installation-derived from `OS_MCP_UI_ORIGIN` / `OS_PUBLIC_ORIGIN`. The Block resource has no frame domains.
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index bf7d907f..fbbbb193 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -12,6 +12,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.
**Fixed**
+- `portability` derive instance MCP context
- `integrations` verify self-hosted Convex admin keys
## 2026-09-07
diff --git a/docs/CLI.md b/docs/CLI.md
index 1ec4581b..6b87d6ba 100644
--- a/docs/CLI.md
+++ b/docs/CLI.md
@@ -43,7 +43,7 @@ Manef Shell OS — drive the whole cockpit from the shell.
Usage: mso [options] <command> [args]
-mso.rahmanef.com is only ONE frontend. Everything it can do is a call to the
+The configured MSO public origin is only ONE frontend. Everything it can do is a call to the
same /api surface, so this CLI reaches every feature without a browser.
Auth = signed session cookie (password + approved device role), cached in a jar.
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index 0d820a17..74eea5f2 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,3 +1,7 @@
+## 2026-09-09 — Instance portability and MCP privacy boundary
+
+MSO source no longer owns an operator hostname, home path, project root, MCP widget origin, or external Page app. Browser origin comes from `OS_PUBLIC_ORIGIN`; the MCP Apps sibling origin is derived per installation or overridden with `OS_MCP_UI_ORIGIN`; reviewed external Page apps are an empty-by-default, bounded `MSO_SURFACE_APPS_JSON` catalog. Current repository/worktree instructions resolve the active checkout rather than assuming a maintainer home. A repository-wide instance-literal gate now rejects known operator-instance domains/paths across runtime code, tests, docs, workflows, and official skills. Maintainer deployments keep their own public values only in ignored/local runtime configuration.
+
## 2026-09-08 — Native desktop Files and Settings
Files now presents Finder and File Explorer names and distinct toolbars, navigation, search, folder colors, selection and status treatments while retaining the shared host API. Windows Settings replaces horizontal tabs with a searchable Fluent sidebar; macOS System Settings gains grouped search and colored categories. App names follow the current shell without changing routes or custom file titles. Running Windows taskbar pins now minimize/restore the front existing window instead of duplicating a multi-window app; New window remains explicit.
@@ -205,10 +209,10 @@ both standard MCP and legacy ChatGPT host paths. Toolset: `2026.09.05.1`.
- **Headless workflows + two-surface MCP UI contract (2026-09-04):** MCP server `1.10.0` / toolset `2026.09.04.6` removes the automatic UI binding from `workflow_start`: orchestration, collision checks, tracing, evidence, and learning continue in the background without consuming the answer with a progress card. ChatGPT now has exactly two canonical MCP App resources: `ui://mso/block-v1.html` through `render_mso_block` for compact validation/action/CRUD input-output, and `ui://mso/page-v1.html` through `render_mso_page` for native operator views plus reviewed development/preview/production embeds. Block buttons send a user-approved follow-up and never execute mutations inside the widget, preserving normal scope, approval, audit, and workflow boundaries. The prior workflow/surface URIs remain non-advertised read aliases, while `workflow_status` and `render_mso_surface` remain app-only compatibility shims for cached clients. The ChatGPT transport profile is 66 tools: 64 model-visible actions (35 read / 17 write / 12 exec) plus two app-only shims; the full catalog is 90. Only Block and Page advertise a resource URI.
- **Local release audit timeout hardening (2026-09-04):** the tolerant pre-push dependency audit now caps `bun audit --json` at 15 seconds. A registry timeout is reported and skipped only in the local gate, matching its existing network-tolerant policy; CI remains the fail-closed dependency-audit authority. This prevents a slow registry request from holding GitHub's pre-push SSH session open for minutes and failing the otherwise-green release with a transport/SIGPIPE-style exit.
- **MCP Apps CSP metadata dedup / Surface v5 (2026-09-04):** MCP server `1.9.4` / toolset `2026.09.04.5` moves all standard widget CSP fields to the preferred `_meta.ui.csp` surface and leaves legacy `openai/widgetCSP` with only `redirect_domains` for `Open in MSO`. Workflow/Surface resources are cache-busted to `workflow-progress-v3` and `surface-v5`; the reviewed Play Together iframe remains exact-origin under `/embed`, so one external-iframe review advisory is expected from `ui.csp.frameDomains`. Scanner-facing Surface metadata explicitly names `/apps/play-together` and has a regression guard against cross-scope app examples.
-- **MCP Apps presentation unification / Surface v4 (2026-09-04):** MCP server `1.9.3` / toolset `2026.09.04.4` retires the specialized `project-status-v2`, `project-diff-v2`, and `vps-status-v2` resources. `project_get`, `project_diff`, and `vps_status` are pure data tools again; `ui://mso/surface-v4.html` is the only general-purpose UI and uses the portable MCP Apps `tools/call` bridge for native monitor/project/diff views. `workflow-progress-v2` remains intentionally separate for live workflow polling. Play Together keeps the exact `game.rahmanef.com/embed` frame boundary, so the external-iframe review advisory remains expected only for the universal Surface.
+- **MCP Apps presentation unification / Surface v4 (2026-09-04):** MCP server `1.9.3` / toolset `2026.09.04.4` retires the specialized `project-status-v2`, `project-diff-v2`, and `vps-status-v2` resources. `project_get`, `project_diff`, and `vps_status` are pure data tools again; `ui://mso/surface-v4.html` is the only general-purpose UI and uses the portable MCP Apps `tools/call` bridge for native monitor/project/diff views. `workflow-progress-v2` remains intentionally separate for live workflow polling. Play Together keeps the exact `game.example.com/embed` frame boundary, so the external-iframe review advisory remains expected only for the universal Surface.
- **Cognitive Runtime claim audit / public evidence boundary (2026-09-04):** revalidated source/main/origin and loopback/public production on the latest concurrent baseline, then reran the deterministic Cognitive Runtime/memory gates: routing recall 100%, active-schema reduction 96.6%, typed memory 8/8, P9 6/6 at 200 corrections, P10 lifecycle 8/8, lexical/local-semantic 4/6 vs 3/6, and bounded graph fixture 3/3. Raw P6/P7/P8 artifacts were independently re-hashed and their aggregate arithmetic recomputed; the canonical P7 two-run artifact is `mso-p7-repeat-full-2x9.json` (`a0c12961...`), not the similarly named older `mso-p7-repeat-full-2runs.json`. Canonical P7+P8 yields 5/5 perfect full runs for both MSO and Hermes and the documented 74.7% token / 12.8% average-latency / 34.1% p50 observed deltas on that exact nine-scenario matched corpus. P4/P5 exact tables are downgraded to historical release-reported metrics because this audit could not independently recover raw artifacts matching those exact values. README now removes the stale 29-tool ChatGPT count, removes the unsupported "most complete" positioning superlative, and states explicit no-universal-superiority/no-cost/no-cache/no-OpenClaw boundaries. Tool Forge executable evaluation is documented as fail-closed until its explicit local Docker sandbox image is provisioned; that image was absent during this audit.
-- **Play Together secure iframe / Surface v3 (2026-09-04):** MCP server `1.9.2` / toolset `2026.09.04.3` upgrades `ui://mso/surface-v3.html` so Play Together can render live inside ChatGPT without relaxing the whole app. The Surface allowlists only `https://game.rahmanef.com`, starts it at `/embed`, revalidates the exact origin plus `/embed` path prefix in-browser, and retains a sandbox without popups/top-navigation. The Play Together deployment reciprocally keeps normal routes anti-frame and gives only `/embed` + `/embed/*` the exact `mso-ui.rahmanef.com` ancestor permission. Auth remains normal; no demo bypass or raw HTML/arbitrary URL input is added.
-- **MSO Surface v1 scope correction / v2 resource (2026-09-04):** MCP server `1.9.1` / toolset `2026.09.04.2` removes accidental cross-project catalog entries from Fresh 3. `ui://mso/surface-v2.html` keeps the generic secure Surface architecture but its current VPSKU app catalog contains only **Play Together** (`https://game.rahmanef.com`) as a `remote` target because that app currently sends `frame-ancestors 'self'`. The Surface CSP therefore has **no third-party `frameDomains` at all**. Raw HTML/arbitrary URLs remain rejected, project anti-framing headers are never stripped, and app identities from other MSO server scopes are not copied into this connector.
+- **Play Together secure iframe / Surface v3 (2026-09-04):** MCP server `1.9.2` / toolset `2026.09.04.3` upgrades `ui://mso/surface-v3.html` so Play Together can render live inside ChatGPT without relaxing the whole app. The Surface allowlists only `https://game.example.com`, starts it at `/embed`, revalidates the exact origin plus `/embed` path prefix in-browser, and retains a sandbox without popups/top-navigation. The Play Together deployment reciprocally keeps normal routes anti-frame and gives only `/embed` + `/embed/*` the exact `mso-ui.example.com` ancestor permission. Auth remains normal; no demo bypass or raw HTML/arbitrary URL input is added.
+- **MSO Surface v1 scope correction / v2 resource (2026-09-04):** MCP server `1.9.1` / toolset `2026.09.04.2` removes accidental cross-project catalog entries from Fresh 3. `ui://mso/surface-v2.html` keeps the generic secure Surface architecture but its current VPSKU app catalog contains only **Play Together** (`https://game.example.com`) as a `remote` target because that app currently sends `frame-ancestors 'self'`. The Surface CSP therefore has **no third-party `frameDomains` at all**. Raw HTML/arbitrary URLs remain rejected, project anti-framing headers are never stripped, and app identities from other MSO server scopes are not copied into this connector.
- **MCP App contextual landing hardening (2026-09-03):** `Open in MSO` no longer lands on an idle desktop. Workflow/VPS/project/diff cards target `/assistant/mcp`, `/monitor`, `/files`, and `/code`; the shell also recognizes ChatGPT's root `redirectUrl=https://chatgpt.com/c/...` handoff and redirects it to Alfa → MCP Activity so an already-cached v2 widget still produces a visible result. Assistant deep-link payloads now select their requested tab even when reusing an existing singleton window. MCP tool count, scopes, output schemas, and v2 resource URIs are unchanged.
- **Live-build chunk corruption eliminated (2026-09-03):** a production browser repro proved the shell/Settings crash was not a Settings logic regression: an in-place `next build` in the active service checkout replaced `.next` while the old Next process still served its boot-time manifest, making all 19 root-referenced chunks disappear and one observed JS request return `500 text/plain`. Production was recovered through `mso deploy`; shell + Settings then passed real authenticated Playwright on desktop/mobile with zero failed requests/console errors. `bun run build` is now a fail-closed wrapper that holds the checkout exclusion and refuses a same-checkout live runtime; `mso build` remains the out-of-tree proof and guarded deploy/update lifecycles invoke raw Next only after quiescence. Post-replacement validation now checks every root-referenced JS/CSS asset status+MIME, not one CSS/chunk. The Fresh 3 smoke scratch path moved out of protected `~/.mso`, and recursive `fs_mkdir` now securely supports missing parents while rejecting symlink escapes.
@@ -236,7 +240,7 @@ Selected project context is persisted as an `alfa.*` preference and sent per tur
- **Bounded context under correction depth:** the final 200-correction stress run from source `d249da4` passed **6/6 deterministic scenarios**. The ledger reached **200 records / 135,180 bytes**, but the compatibility snapshot stayed **1 resolved record / 58 bytes (99.96% smaller)** and explicit history retrieval remained capped at 100 rows. Existing `bench:memory` stayed 100% and the full Cognitive Runtime memory gates stayed 100%.
- **Graph memory remains deferred by evidence:** P9 found no authority/conflict/temporal/repeated-correction task that needs a graph. Future graph or vector complexity must first solve a reproduced retrieval failure; next memory work should focus on real correction telemetry and retention/archival before the 2,000-record / 2 MiB ledger caps.
-- **Fresh 3 completion / scanner-clean contract (2026-09-03):** server `1.8.1` / toolset `2026.09.03.6` keeps the 62-action Fresh 3 surface unchanged while closing the post-refresh metadata gaps. Every ChatGPT action now advertises `outputSchema`; dynamic actions share one DRY bounded `{ result }` envelope instead of 57 duplicated hand schemas, keeping the profile at 64,180 bytes (~16.0k rough tokens). Four MCP Apps now declare the dedicated sibling widget origin `https://mso-ui.rahmanef.com` (Traefik config in `ops/traefik/mso-ui.yml`), and the OpenAI/MCP skills extension publishes five official, digest-verified `claude-skills/` snapshots through `skills/list`, `skills/get`, and `resources/read`. Generic MCP clients retain the prior text-only result behavior unless a tool already had explicit structured output.
+- **Fresh 3 completion / scanner-clean contract (2026-09-03):** server `1.8.1` / toolset `2026.09.03.6` keeps the 62-action Fresh 3 surface unchanged while closing the post-refresh metadata gaps. Every ChatGPT action now advertises `outputSchema`; dynamic actions share one DRY bounded `{ result }` envelope instead of 57 duplicated hand schemas, keeping the profile at 64,180 bytes (~16.0k rough tokens). Four MCP Apps now declare the dedicated sibling widget origin `https://mso-ui.example.com` (Traefik config in `ops/traefik/mso-ui.yml`), and the OpenAI/MCP skills extension publishes five official, digest-verified `claude-skills/` snapshots through `skills/list`, `skills/get`, and `resources/read`. Generic MCP clients retain the prior text-only result behavior unless a tool already had explicit structured output.
- **Fresh 3 capability-max release (2026-09-03):** server `1.8.0` / toolset `2026.09.03.5` restores Original MSO bounded VPS/system/filesystem/app/browser/infra operations to the ChatGPT profile while preserving Fresh 3 workflow/session/Local Agent/read-pipeline/project-MCP orchestration. The ChatGPT transport profile is now 62 tools (61 model actions + app-only `workflow_status`) at 57,853 descriptor bytes (~14.5k rough tokens), while the full model/operator catalog grows to 85 tools. New Lovable-inspired surfaces add `project_get`, Git history/diff, `.mso/KNOWLEDGE.md`, safe connection inventory, private `project_agent_run`/`project_agent_status`, and MCP Apps project/diff/VPS cards. Convex is first-class through the project-installed official Convex MCP CLI with projectDir override stripping, cross-project selector refusal, dynamic schemas, and no automatic dangerous production flags.
- **MCP protocol-era correctness (2026-09-03):** server `1.7.3` stops claiming the stateless `2026-07-28` protocol while serving the legacy initialize/session wire shape. The supported ceiling is deliberately `2025-06-18` (matching the known-good CareerPack ChatGPT connector); a modern HTTP probe receives a 400 and can fall back to initialize. `server/discover` is no longer aliased to the legacy initialize payload. Browser CORS also permits `Mcp-Method`/`Mcp-Name` so a standards-aware probe can reach the server and receive the fallback signal. Toolset stays `2026.09.03.4`.
@@ -846,7 +850,7 @@ skill and repository policy.
The first public-IP fallback pass made the fallback the preference: because every managed
9Router container publishes port 20128, `publicDashboardUrl` was always present and the UI
selected it before the already-configured split-origin host. On deployments such as this one
-with `{id}.mso.rahmanef.com`, that replaced the real in-shell dashboard with a card that only
+with `{id}.mso.example.com`, that replaced the real in-shell dashboard with a card that only
opened a new tab. Source precedence is now explicit: configured split-origin domain first,
public IP only when no embeddable domain exists. UI therefore renders the 9Router dashboard
inside the same managed-feature iframe shell as Hermes/OpenClaw.
@@ -895,7 +899,7 @@ read as unhealthy forever) and `commandProvesInstall: false` (the wrapper exists
checkout, so its presence must not make an uninstalled 9Router read as "package" and lock
the Install button out). Everything else — install/update/rollback/uninstall jobs, backups,
the split-origin dashboard proxy, the Details panel — is the existing generic machinery;
-`9router.mso.rahmanef.com` was added to the Traefik managed-apps file and the wildcard DNS
+`9router.mso.example.com` was added to the Traefik managed-apps file and the wildcard DNS
already covered it. The container itself was updated 0.5.50 → 0.5.55 the same day.
@@ -2131,7 +2135,7 @@ What was actually wrong:
Rewritten, and its `description` now explicitly routes those trigger phrases to
`/mso-camoufox`. `browser-check.js` printed the same dead architecture line; fixed.
- **`CLAUDE.md` documented a demo that does not exist** — no `mso-demo.service`, no
- `/home/rahman/projects/mso-demo`. The `NEXT_PUBLIC_OS_DEMO=1` flag is still real; the
+ `/home/operator/projects/mso-demo`. The `NEXT_PUBLIC_OS_DEMO=1` flag is still real; the
second checkout and :4006 unit are not. Its verification recipe also said to drive the
demo "via os-browser", which is doubly gone — now points at Playwright directly.
- **`docs/SLICE-CATALOG.md` listed 20 slices; there are 21** (`docs` was missing).
@@ -2493,7 +2497,7 @@ including a bottom sheet on mobile, where Alfa did not exist at all because `rig
rendered only by the macOS and Windows shells. Every turn is tagged with the app it came from, so
a task carried Files → Terminal → Browser reads as one story. `@agent` and `/skill` completion
landed in ONE composer every AI input shares; `/` fires only as the first character, because this
-is a VPS cockpit and `ls /home/rahman` must not open a menu.
+is a VPS cockpit and `ls /home/operator` must not open a menu.
**The AI subsystem stopped lying** (`52949ec`, `badef71`, `3287f61`, `79938be`, `87ac78a`,
`c30e6e6`). There were two tool catalogs: 45 hand-written descriptors beside 18 executable tools,
@@ -2599,7 +2603,7 @@ is commented out and answers 403 until a real check can run in the nodejs middle
on the cockpit origin that made upstream JS same-origin *with the cockpit*: `window.top.fetch`
→ `/api/v1/exec/run` with the user's session, which no CSP can stop (a policy binds a realm, not
a reference across realms). Each dashboard now has its **own host on this same process**
- (`{id}.mso.rahmanef.com`, DNS + `/etc/dokploy/traefik/dynamic/mso-managed-apps.yml`), so
+ (`{id}.mso.example.com`, DNS + `/etc/dokploy/traefik/dynamic/mso-managed-apps.yml`), so
`window.top` is opaque — measured in Chromium 148, with a same-origin control that still breaks
through. `proxy.ts` rewrites every path on an app host into that app's proxy and 404s the rest
(matcher widened to `/(.*)`, CSRF check moved ahead of the rewrite, `Host` authoritative over
@@ -2610,7 +2614,7 @@ is commented out and answers 403 until a real check can run in the nodejs middle
wildcard (the widened cookie would make `new Image().src` an existence oracle). The session
cookie gained an optional `Domain` and is cleared with **and** without it; `SameSite=Strict` is
unchanged and still correct because the app hosts share the registrable domain.
-- **Verified live**, not just unit-tested: `https://hermes.mso.rahmanef.com/` and
+- **Verified live**, not just unit-tested: `https://hermes.mso.example.com/` and
`openclaw.…` answer over TLS with a valid cert; `/api/v1/exec/run` and `/api/v1/sys/stats` on an
app host come back as the proxy's own 401 with `x-middleware-rewrite:
/api/v1/managed-apps/<id>/proxy/…` (the cockpit route is not reachable there); `staging.os.…`
diff --git a/docs/TESTING-HANDOFF.md b/docs/TESTING-HANDOFF.md
index 8cc3d637..082cd2c5 100644
--- a/docs/TESTING-HANDOFF.md
+++ b/docs/TESTING-HANDOFF.md
@@ -9,8 +9,8 @@ The current release target is **MSO CLI 1.12.1**, MCP server `1.10.0`, toolset `
Current verified behavior:
- **2026-09-04 Cognitive Runtime public-claim audit:** source/main/origin + loopback/public production were revalidated on the latest concurrent baseline. Fresh reruns pass `bench:cognitive`, `bench:memory`, P9 200-correction calibration, P10 lifecycle, and P10 retrieval calibration. Current deterministic evidence: 100% required-tool recall, 96.6% active-schema reduction, memory 8/8, P9 6/6, P10 lifecycle 8/8, lexical/local-semantic 4/6 vs 3/6, graph fixture 3/3. Canonical raw comparison artifacts were re-hashed: P6 `e0b5e1e30a9f1e5b34624e42d4bb5195792e50129b74de7d4006906a99716ba5`, P7 two-run `a0c12961d142420f6ac334ff021bde7ab82faa89f9294107d3bd46823606a530`, P8 three-run `f70e2f5e8132f0808976ed69e2cb6769d2cec861d58612a8cca2ef5d80a7d838`, P8 cache `b4a2b1be5dc6edfb2ce8282eae64e3a4fc206cd043ecb825a1eae6a617c9f871`. The canonical P7 file is `mso-p7-repeat-full-2x9.json`; the similarly named `mso-p7-repeat-full-2runs.json` is a different, non-canonical run. Recomputed P7+P8 evidence is 5/5 perfect for both MSO and Hermes with 74.7% fewer normalized tokens/attempt, 12.8% lower mean average latency, and 34.1% lower mean per-run p50 for MSO on that exact matched nine-scenario corpus. P4/P5 exact numeric tables are historical-only because their exact raw artifacts were not independently revalidated in this audit. Cost/cache/OpenClaw remain unranked. Tool Forge source/non-Docker tests pass, but the local Forge Docker image was absent, so three Docker-only tests were correctly skipped and executable evaluation fails closed until explicitly provisioned.
-- Fresh 3 current MCP contract: server `1.10.0` / toolset `2026.09.05.1`; ChatGPT receives **66 transport tools = 64 model-visible actions (35 read / 17 write / 12 exec) + app-only `workflow_status` and `render_mso_surface` compatibility shims**, while the full transport catalog is 90 tools. Every ChatGPT action advertises `outputSchema`, and the dedicated MCP Apps origin remains `https://mso-ui.rahmanef.com`. Exactly two canonical resources are published: `ui://mso/block-v2.html` for validation/action/CRUD input-output and `ui://mso/page-v3.html` for native views plus reviewed dev/preview/prod embeds. `workflow_start` is headless and has no UI template. Only `render_mso_block` and `render_mso_page` bind resources. Block/Page v1 and previous workflow/surface URIs remain readable but unlisted; the two app-only actions keep cached clients functional. Page framing remains exact-origin under `https://game.rahmanef.com/embed`, while Block has no frame domains and cannot execute a mutation directly.
-- MCP App acceptance: starting a workflow must produce structured workflow identity without opening an App. A Block must render bounded validation/CRUD data and return a user-approved follow-up when its action is pressed; it must not call a mutation itself. A Page must render native `/monitor`/`/project`/`/diff` views through `tools/call` and frame Play Together only from `https://game.rahmanef.com/embed`. The old Block/Page v1 and workflow/surface URIs must resolve only as non-advertised compatibility aliases. Block v2 and Page v2 are cache-busting visual-resource changes, so ChatGPT must re-scan Fresh 3 after deployment.
+- Fresh 3 MCP presentation remains two canonical resources (Block + Page). The Page widget origin is now deployment-derived from `OS_MCP_UI_ORIGIN` / `OS_PUBLIC_ORIGIN`; portable source carries no operator domain. External Page apps default to none and are opt-in through validated per-installation `MSO_SURFACE_APPS_JSON`. `workflow_start` remains headless; Block has no frame domains and cannot execute a mutation directly.
+- MCP App acceptance: starting a workflow must produce structured workflow identity without opening an App. A Block must render bounded validation/CRUD data and return a user-approved follow-up when its action is pressed; it must not call a mutation itself. A Page must render native `/monitor`/`/project`/`/diff` views through `tools/call`; any external app must come only from the current installation's validated catalog. Compatibility URIs remain non-advertised aliases.
- Alfa Cockpit acceptance: Assistant → Chat shows a compact project/model/activity bar; Cockpit opens as a desktop panel and mobile drawer; project search can select a project outside the first bounded page; selected project metadata reaches the next Alfa system prompt but raw `KNOWLEDGE.md`/repo-memory bodies do not; private typed-memory keys/values render as `Private memory`; Host Skills lazy-load from `/api/skills`; model switch stays within the configured provider; Activity & Runs shows local Alfa tool state alongside MCP workflow activity without treating the browser run as MCP `workflow_finish`.
- Alfa Automation acceptance: a saved recipe's Run action switches to its configured persona and submits the ordered recipe through normal Alfa execution. Read steps may execute directly; write/exec steps must still park on the existing approval card. Playbook starter prompts appear as bounded empty-chat quick actions.
@@ -38,7 +38,7 @@ Current verified behavior:
## Copy prompt for Agent Alpha
```text
-You are taking over MSO testing work in /home/rahman/projects/mso.
+You are taking over MSO testing work in the current repository root (`git rev-parse --show-toplevel`).
Read docs/TESTING-HANDOFF.md first. Current verified source baseline: CLI 1.12.0, MCP server 1.7.3, toolset 2026.09.03.4; resolve the exact live Git build from `mso --version`/`/api/health`. Preserve existing work and do not re-open resolved v1.10-v1.12 findings unless you can reproduce them against the current build.
@@ -50,7 +50,7 @@ For a new issue: record the exact reproduction, distinguish durable state from l
The prompt below is retained because it records the acceptance criteria that produced 1.11/1.12. It is **not current open work**.
```text
-You are taking over MSO testing work in /home/rahman/projects/mso.
+You are taking over MSO testing work in the current repository root (`git rev-parse --show-toplevel`).
Read docs/TESTING-HANDOFF.md first. Preserve existing uncommitted changes unless they directly conflict with the requested fix.
diff --git a/docs/integrations/CHATGPT-UI.md b/docs/integrations/CHATGPT-UI.md
index 0b8ae15b..c8232bfa 100644
--- a/docs/integrations/CHATGPT-UI.md
+++ b/docs/integrations/CHATGPT-UI.md
@@ -52,9 +52,7 @@ The Block resource is self-contained, has no network/frame allowlist, constructs
- `/browser` — remote-browser handoff;
- `/apps/<reviewed-app-id>` — reviewed app target.
-The model cannot pass raw HTML or an external URL. App identity, origin, start path, renderer, environment (`development`, `preview`, `production`, or `other`), sandbox, and presentation mode come from the code-owned `SURFACE_APPS` registry. An iframe target is valid only when its exact HTTPS origin is also present in the Page resource's `_meta.ui.csp.frameDomains`, and the browser runtime revalidates origin plus the approved path prefix before assigning `iframe.src`.
-
-Fresh 3 currently exposes one reviewed Page app: Play Together at `https://game.rahmanef.com/embed`, classified as `production`. The normal Play Together shell remains anti-frame; only `/embed` and `/embed/*` permit `https://mso-ui.rahmanef.com` as an ancestor. The Page sandbox omits popup and top-navigation privileges, authentication is not bypassed, and other MSO server scopes are not copied into this catalog.
+The model cannot pass raw HTML or an external URL. App identity, origin, start path, renderer, environment (`development`, `preview`, `production`, or `other`), sandbox, and presentation mode come from bounded per-installation `MSO_SURFACE_APPS_JSON`. Portable source defaults to an empty external-app catalog. An iframe target is valid only when its exact HTTPS origin is also present in the Page resource's `_meta.ui.csp.frameDomains`, and the browser runtime revalidates origin plus the approved path prefix before assigning `iframe.src`.
Apps that keep restrictive `X-Frame-Options` or `frame-ancestors` remain `remote`. MSO preserves those protections and offers the Camoufox seam instead of stripping headers. User-installed runtime HTML apps and arbitrary HTML snippets cannot add themselves to the ChatGPT frame allowlist; they remain opaque-origin `srcDoc` content inside the authenticated MSO shell.
@@ -75,7 +73,7 @@ The canonical `resources/list` response advertises only Block and Page. Four pre
2. Only `render_mso_block` and `render_mso_page` advertise `_meta.ui.resourceUri` plus the OpenAI `outputTemplate` compatibility alias.
3. Every ChatGPT transport action declares an `outputSchema`. Stable UI-critical tools use typed schemas; other actions use the bounded `{ result }` envelope. Generic MCP clients retain their existing text fallback where applicable.
4. Sandboxed Pages use the standard `tools/call` bridge for native data refreshes. ChatGPT-only helpers such as display mode, private widget state, follow-up messages, and `openExternal` are feature-detected.
-5. The dedicated UI origin is `https://mso-ui.rahmanef.com`. Standard CSP fields live only in `_meta.ui.csp`; the legacy `openai/widgetCSP` object retains only `redirect_domains` for `Open in MSO`.
+5. The dedicated UI origin is deployment-derived: explicit `OS_MCP_UI_ORIGIN` wins; otherwise an `mso.<domain>` public origin derives `mso-ui.<domain>`, and other safe public origins are reused. Standard CSP fields live only in `_meta.ui.csp`; the legacy `openai/widgetCSP` object retains only `redirect_domains` for `Open in MSO`.
Current ChatGPT transport profile: **66 tools** — 64 model-visible actions (35 read / 17 write / 12 exec) plus app-only `workflow_status` and `render_mso_surface`. The full transport catalog has 90 tools. Exactly two tools bind UI resources: `render_mso_block` and `render_mso_page`.
@@ -124,7 +122,7 @@ ChatGPT model
| Validation Block | Render deployment checks with Approve/Revise actions | compact Block renders; click creates a follow-up; no mutation happens inside the widget |
| CRUD Block | Render editable sample fields and a Save action | values remain editable, required validation works, and submitted values return through the follow-up message |
| Native Page | Render `/monitor`, then `/project` | Page opens and refreshes bounded data through `tools/call` |
-| Production Page | Render `/apps/play-together` | iframe starts only at `https://game.rahmanef.com/embed`; fullscreen stays user-initiated |
+| Configured Page app | Render `/apps/<configured-app-id>` after setting a reviewed local catalog | iframe stays on the configured exact HTTPS origin/start prefix; fullscreen stays user-initiated |
| Anti-frame fallback | Open a Page target classified `remote` | no header stripping or unreviewed frame occurs; the remote-browser handoff is shown |
| Filesystem CRUD | Create/read/copy/move/delete a disposable file through ordinary tools | Block/Page presentation never changes the filesystem permission boundary |
diff --git a/docs/reference/WORKSPACE-GUIDE.md b/docs/reference/WORKSPACE-GUIDE.md
index 396be8e0..c93c2f36 100644
--- a/docs/reference/WORKSPACE-GUIDE.md
+++ b/docs/reference/WORKSPACE-GUIDE.md
@@ -355,7 +355,7 @@ curl -fsSL https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/install
curl -fsSL https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/install.sh | bash -s -- --dir "$HOME/mso" --port 4005
```
-There is also a no-login install guide at **<https://mso.rahmanef.com/install>**. **Browser
+After installation, the no-login install guide is available at **`${OS_PUBLIC_ORIGIN}/install`** (or the loopback origin when no public origin is configured). **Browser
sign-in requires HTTPS**, except when you access MSO through a loopback URL such as
`http://localhost:4005`. Do not pair/approve a browser on plain `http://<server-ip>:4005`:
the session cookie is `Secure`, so the browser cannot keep the login there. Full production setup,
@@ -551,8 +551,7 @@ Not currently supported:
| Contribute or review security | [Contributing](../../CONTRIBUTING.md) · [Development](../DEVELOPMENT.md) · [Security](../../SECURITY.md) |
| Browse everything | [Documentation map](../README.md) · [Changelog](../CHANGELOG.md) |
-The [maintainer's instance](https://mso.rahmanef.com) requires authentication; it is **not a public demo**.
-The [recorded demo](../media/demo.gif) is available without access to a real server.
+Owner deployments require authentication and are **not public demos**. The [recorded demo](../media/demo.gif) is available without access to a real server.
A separate mock-only demo must keep `NEXT_PUBLIC_OS_DEMO=1` at build time and bind to loopback
unless its owner explicitly publishes it; never enable demo mode on an owner deployment.
diff --git a/frontend/slices/appshell/features/desktop-icons/desktop-icons.tsx b/frontend/slices/appshell/features/desktop-icons/desktop-icons.tsx
index 53852fb7..39cd4726 100644
--- a/frontend/slices/appshell/features/desktop-icons/desktop-icons.tsx
+++ b/frontend/slices/appshell/features/desktop-icons/desktop-icons.tsx
@@ -165,7 +165,7 @@ function AddIconDialog() {
value={val}
onChange={(e) => setVal(e.target.value)}
onKeyDown={(e) => e.key === "Enter" && submit()}
- placeholder={kind === "link" ? "https://example.com" : "/home/rahman/projects"}
+ placeholder={kind === "link" ? "https://example.com" : "~/projects"}
/>
<Input
value={label}
diff --git a/frontend/slices/appshell/lib/mentions.test.ts b/frontend/slices/appshell/lib/mentions.test.ts
index 6851f8c9..8b535417 100644
--- a/frontend/slices/appshell/lib/mentions.test.ts
+++ b/frontend/slices/appshell/lib/mentions.test.ts
@@ -10,10 +10,10 @@ describe("/ never fires on a filesystem path", () => {
// are typed constantly, and a menu opening mid-sentence would make the composer
// unusable. Every one of these must stay closed.
it.each([
- "ls /home/rahman",
+ "ls /home/operator",
"read /etc/hosts",
"copy /var/log/syslog to /tmp",
- "what is in /home/rahman/projects/mso",
+ "what is in /home/operator/projects/mso",
"cd ~/projects && ls /usr/share",
"the ratio is 3/4",
])("stays closed for %j", (text) => {
diff --git a/frontend/slices/appshell/lib/mentions.ts b/frontend/slices/appshell/lib/mentions.ts
index 4f8f98a9..50eef318 100644
--- a/frontend/slices/appshell/lib/mentions.ts
+++ b/frontend/slices/appshell/lib/mentions.ts
@@ -2,7 +2,7 @@
// DOM — because the rules are the whole feature and they deserve a real test.
//
// THE / PROBLEM. This is a VPS cockpit: the user types absolute paths constantly
-// ("ls /home/rahman", "read /etc/hosts"). A slash trigger that fires after any
+// ("ls /home/user", "read /etc/hosts"). A slash trigger that fires after any
// whitespace would open a menu on almost every message. So `/` opens ONLY when it
// is the first character of the composer — the Slack/Discord convention — which
// makes a command an explicit act and leaves every path alone. `@` is safe after
@@ -46,7 +46,7 @@ export function mentionAt(text: string, caret: number): MentionQuery | null {
if (ch === "/") {
// First character of the whole composer, nothing else. This is what keeps
- // "/home/rahman" — and every other path — from opening the menu.
+ // "/home/user" — and every other path — from opening the menu.
if (i !== 0) return null;
} else if (before !== "" && !/\s/.test(before)) {
// Mid-word @ is an email or a handle inside a token, not a mention.
diff --git a/frontend/slices/appshell/lib/store-persist.test.ts b/frontend/slices/appshell/lib/store-persist.test.ts
index c76fa7ee..2e30ff46 100644
--- a/frontend/slices/appshell/lib/store-persist.test.ts
+++ b/frontend/slices/appshell/lib/store-persist.test.ts
@@ -37,14 +37,14 @@ describe("store persistence", () => {
});
it("hydrateBoot keeps a deep-link window: open + focused + payload, layout behind", () => {
- // UrlSync opened /files/home/rahman BEFORE the layout hydrated (mount order).
- const live = openWindow("files", "Files", undefined, { path: "/home/rahman" }, { multi: true });
+ // UrlSync opened /files/home/operator BEFORE the layout hydrated (mount order).
+ const live = openWindow("files", "Files", undefined, { path: "/home/operator" }, { multi: true });
hydrateBoot([pw("w50", "settings"), pw("w51", "monitor")]);
const order = shellStore.getOrder();
expect(order).toEqual(["w50", "w51", live]);
expect(shellStore.getFocused()).toBe(live);
- expect(shellStore.getWindow(live)?.payload).toEqual({ path: "/home/rahman" });
+ expect(shellStore.getWindow(live)?.payload).toEqual({ path: "/home/operator" });
// live window stacks on top of every restored one
const zs = order.map((id) => shellStore.getWindow(id)!.z);
expect(Math.max(...zs)).toBe(shellStore.getWindow(live)!.z);
@@ -87,17 +87,17 @@ describe("store persistence", () => {
});
it("hydrateBoot dedupes a MULTI-app window when persisted + live share the same payload", () => {
- // Live window opened from the URL with payload {path:/home/rahman}.
- const live = openWindow("files", "Files", undefined, { path: "/home/rahman" }, { multi: true });
+ // Live window opened from the URL with payload {path:/home/operator}.
+ const live = openWindow("files", "Files", undefined, { path: "/home/operator" }, { multi: true });
// localStorage has a window for the SAME app + SAME payload — must collapse.
hydrateBoot(
- [pw("w99", "files", { payload: { path: "/home/rahman" } })],
+ [pw("w99", "files", { payload: { path: "/home/operator" } })],
new Set(["files"]),
);
const ids = shellStore.getOrder();
const files = ids.filter((id) => shellStore.getWindow(id)?.app === "files");
expect(files).toEqual([live]); // dedupe — one Files window survives
- expect(shellStore.getWindow(live)?.payload).toEqual({ path: "/home/rahman" });
+ expect(shellStore.getWindow(live)?.payload).toEqual({ path: "/home/operator" });
});
it("hydrateBoot keeps both MULTI-app windows when payloads differ", () => {
diff --git a/frontend/slices/appshell/lib/url-sync.test.ts b/frontend/slices/appshell/lib/url-sync.test.ts
index 660e197d..33e29e8f 100644
--- a/frontend/slices/appshell/lib/url-sync.test.ts
+++ b/frontend/slices/appshell/lib/url-sync.test.ts
@@ -35,22 +35,22 @@ describe("URL→state boot dedup (hydrateBoot multi-app contract)", () => {
beforeEach(() => closeAll());
it("URL + persisted layout point at the SAME multi-app path → 1 window", () => {
- // UrlSync ran first: opened the deep-linked files window at /home/rahman.
+ // UrlSync ran first: opened the deep-linked files window at /home/operator.
const live = openWindow(
"files",
"Files",
undefined,
- { path: "/home/rahman" },
+ { path: "/home/operator" },
{ multi: true },
);
// Then the persisted layout (also remembers a files window at the same path)
// hydrates underneath.
- hydrateBoot([pw("wA", "files", { payload: { path: "/home/rahman" } })], MULTI);
+ hydrateBoot([pw("wA", "files", { payload: { path: "/home/operator" } })], MULTI);
const ids = shellStore.getOrder();
expect(ids).toEqual([live]); // exactly one window, the live one
expect(shellStore.getFocused()).toBe(live);
- expect(shellStore.getWindow(live)?.payload).toEqual({ path: "/home/rahman" });
+ expect(shellStore.getWindow(live)?.payload).toEqual({ path: "/home/operator" });
});
it("URL + persisted layout point at DIFFERENT multi-app paths → 2 windows", () => {
@@ -58,7 +58,7 @@ describe("URL→state boot dedup (hydrateBoot multi-app contract)", () => {
"files",
"Files",
undefined,
- { path: "/home/rahman" },
+ { path: "/home/operator" },
{ multi: true },
);
hydrateBoot([pw("wA", "files", { payload: { path: "/tmp" } })], MULTI);
@@ -70,7 +70,7 @@ describe("URL→state boot dedup (hydrateBoot multi-app contract)", () => {
const apps = ids.map((id) => shellStore.getWindow(id)!.app).sort();
expect(apps).toEqual(["files", "files"]);
const paths = ids.map((id) => (shellStore.getWindow(id)!.payload as { path: string }).path).sort();
- expect(paths).toEqual(["/home/rahman", "/tmp"]);
+ expect(paths).toEqual(["/home/operator", "/tmp"]);
});
it("re-opening a multi-app's existing window UPDATES payload (no new window)", () => {
diff --git a/frontend/slices/assistant/lib/agent-request.test.ts b/frontend/slices/assistant/lib/agent-request.test.ts
index 48176752..62679777 100644
--- a/frontend/slices/assistant/lib/agent-request.test.ts
+++ b/frontend/slices/assistant/lib/agent-request.test.ts
@@ -39,7 +39,7 @@ describe("composeSystem", () => {
it("adds bounded selected-project context without turning it into permission", () => {
const out = composeSystem(agent(), " MODE", {
- id: "root/mso", name: "mso", path: "/home/rahman/projects/mso", branch: "main",
+ id: "root/mso", name: "mso", path: "/home/operator/projects/mso", branch: "main",
clean: false, head: "abcdef123456", knowledge: true, recentMemoryTitles: ["Fix updater race", "Verify memory retention"],
});
expect(out).toContain("Selected MSO project: mso");
diff --git a/frontend/slices/code-editor/lib/util.test.ts b/frontend/slices/code-editor/lib/util.test.ts
index 38411d21..b7e664d0 100644
--- a/frontend/slices/code-editor/lib/util.test.ts
+++ b/frontend/slices/code-editor/lib/util.test.ts
@@ -12,7 +12,7 @@ describe("baseName", () => {
});
it("returns last segment for a normal path", () => {
- expect(baseName("/home/rahman/projects/util.ts")).toBe("util.ts");
+ expect(baseName("/home/operator/projects/util.ts")).toBe("util.ts");
});
it("returns the name for a single-segment path (no leading slash)", () => {
@@ -22,7 +22,7 @@ describe("baseName", () => {
describe("extOf", () => {
it("returns '' for a path with no extension", () => {
- expect(extOf("/home/rahman/Makefile")).toBe("");
+ expect(extOf("/home/operator/Makefile")).toBe("");
});
it("returns 'ts' for a .ts file", () => {
@@ -38,7 +38,7 @@ describe("extOf", () => {
// split('.') → ['', 'bashrc'], pop() → 'bashrc'
// NOTE: this is the actual behaviour of the implementation; a dotfile
// is treated as having extension 'bashrc'. Tested here to document it.
- expect(extOf("/home/rahman/.bashrc")).toBe("bashrc");
+ expect(extOf("/home/operator/.bashrc")).toBe("bashrc");
});
it("returns '' for root '/'", () => {
@@ -53,11 +53,11 @@ describe("joinPath", () => {
});
it("joins a normal dir and name", () => {
- expect(joinPath("/home/rahman", "file.ts")).toBe("/home/rahman/file.ts");
+ expect(joinPath("/home/operator", "file.ts")).toBe("/home/operator/file.ts");
});
it("strips trailing slash from dir before joining", () => {
- expect(joinPath("/home/rahman/", "notes.md")).toBe("/home/rahman/notes.md");
+ expect(joinPath("/home/operator/", "notes.md")).toBe("/home/operator/notes.md");
});
it("handles nested dir correctly", () => {
@@ -115,7 +115,7 @@ describe("langOf", () => {
});
it("falls back to 'txt' for no extension", () => {
- expect(langOf("/home/rahman/Makefile")).toBe("txt");
+ expect(langOf("/home/operator/Makefile")).toBe("txt");
});
});
diff --git a/frontend/slices/files-manager/lib/format.test.ts b/frontend/slices/files-manager/lib/format.test.ts
index b1eb55f2..5006b5ba 100644
--- a/frontend/slices/files-manager/lib/format.test.ts
+++ b/frontend/slices/files-manager/lib/format.test.ts
@@ -63,7 +63,7 @@ describe("joinPath", () => {
});
it("normal base → 'base/name'", () => {
- expect(joinPath("/home/rahman", "projects")).toBe("/home/rahman/projects");
+ expect(joinPath("/home/operator", "projects")).toBe("/home/operator/projects");
});
it("nested base works correctly", () => {
@@ -114,11 +114,11 @@ describe("crumbsFor", () => {
});
it("multi-level → all segments with correct paths", () => {
- expect(crumbsFor("/home/rahman/projects")).toEqual([
+ expect(crumbsFor("/home/operator/projects")).toEqual([
{ name: "mso", path: "/" },
{ name: "home", path: "/home" },
- { name: "rahman", path: "/home/rahman" },
- { name: "projects", path: "/home/rahman/projects" },
+ { name: "operator", path: "/home/operator" },
+ { name: "projects", path: "/home/operator/projects" },
]);
});
diff --git a/frontend/slices/managed-apps/update-api.test.ts b/frontend/slices/managed-apps/update-api.test.ts
index 3113ff36..54f6ca52 100644
--- a/frontend/slices/managed-apps/update-api.test.ts
+++ b/frontend/slices/managed-apps/update-api.test.ts
@@ -167,13 +167,13 @@ describe("backups", () => {
{
id: "2026-07-25T09-00-00-000Z",
createdAt: "2026-07-25T09:00:00.000Z",
- source: "/home/rahman/.hermes",
+ source: "/home/operator/.hermes",
reason: "pre-update",
files: 8421,
bytes: 383778816,
skipped: { symlinks: 1, dirs: 4, dirNames: ["node_modules", ".git", 9] },
},
- { name: "2026-07-24T09-00-00-000Z", path: "/home/rahman/.openclaw", size: 1024 },
+ { name: "2026-07-24T09-00-00-000Z", path: "/home/operator/.openclaw", size: 1024 },
],
},
});
@@ -183,7 +183,7 @@ describe("backups", () => {
id: "2026-07-25T09-00-00-000Z",
createdAt: "2026-07-25T09:00:00.000Z",
sizeBytes: 383778816,
- source: "/home/rahman/.hermes",
+ source: "/home/operator/.hermes",
reason: "pre-update",
files: 8421,
// What this snapshot never held is what restoring it cannot bring back,
diff --git a/frontend/slices/media-viewer/lib/kinds.test.ts b/frontend/slices/media-viewer/lib/kinds.test.ts
index 4dd78430..e9f14134 100644
--- a/frontend/slices/media-viewer/lib/kinds.test.ts
+++ b/frontend/slices/media-viewer/lib/kinds.test.ts
@@ -45,7 +45,7 @@ describe("kindForName", () => {
});
it("takes the extension from the last dot, and the name from the last slash", () => {
- expect(kindForName("/home/rahman/photos/my.trip.2026.jpg")).toBe("image");
+ expect(kindForName("/home/operator/photos/my.trip.2026.jpg")).toBe("image");
expect(kindForName("/var/log/nginx/access.log")).toBe("text");
});
diff --git a/frontend/slices/os-terminal/lib/fs-model.test.ts b/frontend/slices/os-terminal/lib/fs-model.test.ts
index 4337bb44..385065ec 100644
--- a/frontend/slices/os-terminal/lib/fs-model.test.ts
+++ b/frontend/slices/os-terminal/lib/fs-model.test.ts
@@ -3,14 +3,14 @@ import { resolve, rekey, extTag } from "./fs-model";
import type { FsModel } from "./fs-model";
describe("resolve", () => {
- const cwd = "/home/rahman";
+ const cwd = "/home/operator";
it("no arg returns cwd", () => {
- expect(resolve(cwd)).toBe("/home/rahman");
+ expect(resolve(cwd)).toBe("/home/operator");
});
it("'.' returns cwd", () => {
- expect(resolve(cwd, ".")).toBe("/home/rahman");
+ expect(resolve(cwd, ".")).toBe("/home/operator");
});
it("'/' returns root", () => {
@@ -30,8 +30,8 @@ describe("resolve", () => {
});
it("'..' multi-level via chained calls", () => {
- const first = resolve("/home/rahman/projects", "..");
- expect(first).toBe("/home/rahman");
+ const first = resolve("/home/operator/projects", "..");
+ expect(first).toBe("/home/operator");
expect(resolve(first, "..")).toBe("/home");
});
@@ -40,11 +40,11 @@ describe("resolve", () => {
});
it("relative arg appended to cwd", () => {
- expect(resolve(cwd, "projects")).toBe("/home/rahman/projects");
+ expect(resolve(cwd, "projects")).toBe("/home/operator/projects");
});
it("relative arg with nested path", () => {
- expect(resolve(cwd, "projects/mso")).toBe("/home/rahman/projects/mso");
+ expect(resolve(cwd, "projects/mso")).toBe("/home/operator/projects/mso");
});
it("strips trailing slash from absolute arg", () => {
@@ -52,7 +52,7 @@ describe("resolve", () => {
});
it("strips trailing slash from relative arg", () => {
- expect(resolve(cwd, "projects/")).toBe("/home/rahman/projects");
+ expect(resolve(cwd, "projects/")).toBe("/home/operator/projects");
});
it("strips trailing slash — root stays root", () => {
@@ -65,8 +65,8 @@ describe("rekey", () => {
function makeFs(): FsModel {
return {
"/home": [{ name: "rahman", kind: "dir", size: 0 }],
- "/home/rahman": [{ name: "file.txt", kind: "file", size: 10, ext: "txt" }],
- "/home/rahman/projects": [],
+ "/home/operator": [{ name: "file.txt", kind: "file", size: 10, ext: "txt" }],
+ "/home/operator/projects": [],
"/other": [],
};
}
@@ -74,7 +74,7 @@ describe("rekey", () => {
it("oldP === newP is a noop", () => {
const fs = makeFs();
const before = JSON.stringify(fs);
- rekey(fs, "/home/rahman", "/home/rahman");
+ rekey(fs, "/home/operator", "/home/operator");
expect(JSON.stringify(fs)).toBe(before);
});
@@ -87,24 +87,24 @@ describe("rekey", () => {
it("moves subtree: all keys starting with oldP+'/' are rekeyed", () => {
const fs = makeFs();
- rekey(fs, "/home/rahman", "/home/bob");
+ rekey(fs, "/home/operator", "/home/bob");
expect("/home/bob" in fs).toBe(true);
expect("/home/bob/projects" in fs).toBe(true);
- expect("/home/rahman" in fs).toBe(false);
- expect("/home/rahman/projects" in fs).toBe(false);
+ expect("/home/operator" in fs).toBe(false);
+ expect("/home/operator/projects" in fs).toBe(false);
});
it("leaves unrelated keys intact", () => {
const fs = makeFs();
- rekey(fs, "/home/rahman", "/home/bob");
+ rekey(fs, "/home/operator", "/home/bob");
expect("/home" in fs).toBe(true);
expect("/other" in fs).toBe(true);
});
it("entries are preserved under new key", () => {
const fs = makeFs();
- const original = fs["/home/rahman"];
- rekey(fs, "/home/rahman", "/home/bob");
+ const original = fs["/home/operator"];
+ rekey(fs, "/home/operator", "/home/bob");
expect(fs["/home/bob"]).toBe(original);
});
});
diff --git a/lib/auth/session-cookie.test.ts b/lib/auth/session-cookie.test.ts
index 7072f2b9..1814b8da 100644
--- a/lib/auth/session-cookie.test.ts
+++ b/lib/auth/session-cookie.test.ts
@@ -11,7 +11,7 @@ const req = (host: string, forwarded?: string) =>
headers: { host, ...(forwarded ? { "x-forwarded-host": forwarded } : {}) },
});
-const domainFor = (value: string | undefined, host = "mso.rahmanef.com") => {
+const domainFor = (value: string | undefined, host = "mso.example.com") => {
if (value === undefined) delete process.env.OS_SESSION_COOKIE_DOMAIN;
else process.env.OS_SESSION_COOKIE_DOMAIN = value;
return sessionCookieDomain(req(host));
@@ -29,21 +29,21 @@ describe("sessionCookieDomain", () => {
});
it("widens to the configured domain on the cockpit host", () => {
- expect(domainFor("mso.rahmanef.com")).toBe("mso.rahmanef.com");
+ expect(domainFor("mso.example.com")).toBe("mso.example.com");
});
it("widens on the split-origin app hosts (the whole point)", () => {
- expect(domainFor("mso.rahmanef.com", "hermes.mso.rahmanef.com")).toBe("mso.rahmanef.com");
- expect(domainFor("mso.rahmanef.com", "openclaw.mso.rahmanef.com")).toBe("mso.rahmanef.com");
+ expect(domainFor("mso.example.com", "hermes.mso.example.com")).toBe("mso.example.com");
+ expect(domainFor("mso.example.com", "openclaw.mso.example.com")).toBe("mso.example.com");
});
it("normalises a leading dot, casing, port and trailing dot", () => {
- expect(domainFor(".MSO.Rahmanef.com", "HERMES.mso.rahmanef.com.:4005")).toBe("mso.rahmanef.com");
+ expect(domainFor(".MSO.Example.com", "HERMES.mso.example.com.:4005")).toBe("mso.example.com");
});
it.each([
- ["mso.rahmanef.com; Path=/", "attribute smuggling"],
- ["mso.rahmanef.com Path=/", "space"],
+ ["mso.example.com; Path=/", "attribute smuggling"],
+ ["mso.example.com Path=/", "space"],
["os_rahmanef.com", "underscore"],
["-bad.com", "leading hyphen"],
["bad-.com", "trailing hyphen"],
@@ -54,11 +54,11 @@ describe("sessionCookieDomain", () => {
["os.rah\nmanef.com", "interior control char"],
["ötzi.rahmanef.com", "non-ASCII (must be punycode)"],
])("fails closed to host-only for %s (%s)", (value) => {
- expect(domainFor(value, "hermes.mso.rahmanef.com")).toBeUndefined();
+ expect(domainFor(value, "hermes.mso.example.com")).toBeUndefined();
});
it("tolerates surrounding whitespace from a hand-edited env file", () => {
- expect(domainFor(" mso.rahmanef.com\n")).toBe("mso.rahmanef.com");
+ expect(domainFor(" mso.example.com\n")).toBe("mso.example.com");
});
it("fails closed when a label or the whole name is over length", () => {
@@ -72,23 +72,23 @@ describe("sessionCookieDomain", () => {
it("fails closed when the request host does not domain-match", () => {
// Otherwise the browser drops the whole Set-Cookie and login 200s with no
// session — a login loop with no error anywhere.
- expect(domainFor("mso.rahmanef.com", "76.13.23.37")).toBeUndefined();
- expect(domainFor("mso.rahmanef.com", "localhost")).toBeUndefined();
+ expect(domainFor("mso.example.com", "76.13.23.37")).toBeUndefined();
+ expect(domainFor("mso.example.com", "localhost")).toBeUndefined();
// Suffix without a dot boundary is NOT a subdomain (RFC 6265 §5.1.3).
- expect(domainFor("mso.rahmanef.com", "notos.rahmanef.com")).toBeUndefined();
+ expect(domainFor("mso.example.com", "notos.rahmanef.com")).toBeUndefined();
});
it("ignores x-forwarded-host while a real Host header is present", () => {
// Host wins, so a client-settable header cannot steer the decision.
- process.env.OS_SESSION_COOKIE_DOMAIN = "mso.rahmanef.com";
- expect(sessionCookieDomain(req("mso.rahmanef.com", "evil.example"))).toBe("mso.rahmanef.com");
+ process.env.OS_SESSION_COOKIE_DOMAIN = "mso.example.com";
+ expect(sessionCookieDomain(req("mso.example.com", "evil.example"))).toBe("mso.example.com");
});
});
describe("sessionCookieAttrs", () => {
it("keeps the host-only attribute set unchanged when no domain is configured", () => {
delete process.env.OS_SESSION_COOKIE_DOMAIN;
- expect(sessionCookieAttrs(req("mso.rahmanef.com"), 86_400)).toEqual({
+ expect(sessionCookieAttrs(req("mso.example.com"), 86_400)).toEqual({
httpOnly: true,
secure: true,
sameSite: "strict",
@@ -99,15 +99,15 @@ describe("sessionCookieAttrs", () => {
it("adds only the Domain when configured — SameSite stays strict", () => {
// Strict is correct across the app hosts: SameSite is per SITE (registrable
- // domain), and mso.rahmanef.com / hermes.mso.rahmanef.com share rahmanef.com.
- process.env.OS_SESSION_COOKIE_DOMAIN = "mso.rahmanef.com";
- expect(sessionCookieAttrs(req("mso.rahmanef.com"), 0)).toEqual({
+ // domain), and mso.example.com / hermes.mso.example.com share rahmanef.com.
+ process.env.OS_SESSION_COOKIE_DOMAIN = "mso.example.com";
+ expect(sessionCookieAttrs(req("mso.example.com"), 0)).toEqual({
httpOnly: true,
secure: true,
sameSite: "strict",
path: "/",
maxAge: 0,
- domain: "mso.rahmanef.com",
+ domain: "mso.example.com",
});
});
});
diff --git a/lib/auth/session-cookie.ts b/lib/auth/session-cookie.ts
index 44bea803..8e27fc6d 100644
--- a/lib/auth/session-cookie.ts
+++ b/lib/auth/session-cookie.ts
@@ -21,8 +21,8 @@
//
// SameSite stays "strict" and the cross-origin iframe does NOT need it loosened:
// SameSite is evaluated per SITE — scheme + registrable domain — not per origin.
-// `mso.rahmanef.com` and `hermes.mso.rahmanef.com` share the registrable domain
-// `rahmanef.com` on the same scheme, so the frame's navigation and every
+// `mso.example.com` and `hermes.mso.example.com` share the registrable domain
+// `example.com` on the same scheme, so the frame's navigation and every
// subresource it fetches are same-site (RFC 6265bis §5.2); for a nested document
// the "site for cookies" is non-null when the top-level document and every
// ancestor are same-site with it, which holds here. Cross-ORIGIN (what the
diff --git a/lib/host/multipart.test.ts b/lib/host/multipart.test.ts
index bbb51796..e2ae9ea3 100644
--- a/lib/host/multipart.test.ts
+++ b/lib/host/multipart.test.ts
@@ -66,12 +66,12 @@ describe("boundaryFromContentType", () => {
describe("parseMultipart", () => {
it("parses a dest field + a file part with its filename/relPath", async () => {
const body = buildBody("B0", [
- { name: "dest", body: "/home/rahman/up" },
+ { name: "dest", body: "/home/operator/up" },
{ name: "file", filename: "docs/a.txt", body: "hello world" },
]);
const parts = await collect(body, "B0", 10 * MiB);
expect(parts).toHaveLength(2);
- expect(parts[0]).toMatchObject({ name: "dest", body: "/home/rahman/up" });
+ expect(parts[0]).toMatchObject({ name: "dest", body: "/home/operator/up" });
expect(parts[1]).toMatchObject({ name: "file", filename: "docs/a.txt", body: "hello world" });
});
diff --git a/lib/managed-apps/install.test.ts b/lib/managed-apps/install.test.ts
index 85868b0a..af30b4e0 100644
--- a/lib/managed-apps/install.test.ts
+++ b/lib/managed-apps/install.test.ts
@@ -72,10 +72,10 @@ describe("install job options", () => {
// allowlist, which reads as a broken dashboard on a gateway that is fine.
// origin.ts reads the template at module load, so this needs a fresh graph.
vi.resetModules();
- vi.stubEnv("NEXT_PUBLIC_MANAGED_APP_HOST_TEMPLATE", "{id}.mso.rahmanef.com");
+ vi.stubEnv("NEXT_PUBLIC_MANAGED_APP_HOST_TEMPLATE", "{id}.mso.example.com");
const fresh = await import("./install");
await fresh.startInstall("openclaw");
- expect(started().env?.MSO_INSTALL_APP_ORIGIN).toBe("https://openclaw.mso.rahmanef.com");
+ expect(started().env?.MSO_INSTALL_APP_ORIGIN).toBe("https://openclaw.mso.example.com");
vi.unstubAllEnvs();
});
diff --git a/lib/managed-apps/project-ingress-proxy.test.ts b/lib/managed-apps/project-ingress-proxy.test.ts
index cc521d46..7c97ff2d 100644
--- a/lib/managed-apps/project-ingress-proxy.test.ts
+++ b/lib/managed-apps/project-ingress-proxy.test.ts
@@ -1,7 +1,7 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { NextRequest } from "next/server";
-const TEMPLATE = "{id}.mso.rahmanef.com";
+const TEMPLATE = "{id}.mso.example.com";
const ROUTES = JSON.stringify([{
app: "hermes", method: "POST", path: "/webhooks/project-example",
target: "http://127.0.0.1:8644/webhooks/project-example", auth: "hmac-v2-json",
@@ -15,10 +15,10 @@ async function loadProxy(ingress = "") {
}
function req(path: string, signature = "a".repeat(64)) {
- return new NextRequest(`https://hermes.mso.rahmanef.com${path}`, {
+ return new NextRequest(`https://hermes.mso.example.com${path}`, {
method: "POST",
headers: {
- host: "hermes.mso.rahmanef.com",
+ host: "hermes.mso.example.com",
"sec-fetch-site": "cross-site",
"content-type": "application/json",
"x-webhook-timestamp": String(Math.floor(Date.now() / 1000)),
diff --git a/lib/managed-apps/proxy-csp.test.ts b/lib/managed-apps/proxy-csp.test.ts
index fc71661c..7fb5d9b5 100644
--- a/lib/managed-apps/proxy-csp.test.ts
+++ b/lib/managed-apps/proxy-csp.test.ts
@@ -6,8 +6,8 @@ import { describe, expect, it } from "vitest";
import { contentSecurityPolicy } from "./proxy-csp";
// The app is always root-mounted on its own host now; the cockpit is the framer.
-const PREFIX_URL = "https://hermes.mso.rahmanef.com/";
-const COCKPIT = "https://mso.rahmanef.com";
+const PREFIX_URL = "https://hermes.mso.example.com/";
+const COCKPIT = "https://mso.example.com";
const MOUNT = { cockpitOrigin: COCKPIT };
const OPENCLAW =
@@ -17,7 +17,7 @@ const OPENCLAW =
"media-src 'self' data: blob:; font-src 'self' https://fonts.gstatic.com; worker-src 'self'; " +
"connect-src 'self' ws: wss: https://api.openai.com https://tweakcn.com";
-const SOCKET = "wss://hermes.mso.rahmanef.com/";
+const SOCKET = "wss://hermes.mso.example.com/";
const directive = (csp: string, name: string) =>
csp
@@ -34,9 +34,9 @@ describe("contentSecurityPolicy without an upstream policy (Hermes sends none)",
for (const name of ["default-src", "connect-src", "form-action", "base-uri", "frame-src"]) {
expect(directive(csp, name)).toContain(PREFIX_URL);
}
- expect(directive(csp, "connect-src")).toBe(`connect-src ${PREFIX_URL} wss://hermes.mso.rahmanef.com/ data: blob:`);
- expect("https://mso.rahmanef.com/api/v1/exec".startsWith(PREFIX_URL)).toBe(false);
- expect("https://mso.rahmanef.com/api/v1/term".startsWith(PREFIX_URL)).toBe(false);
+ expect(directive(csp, "connect-src")).toBe(`connect-src ${PREFIX_URL} wss://hermes.mso.example.com/ data: blob:`);
+ expect("https://mso.example.com/api/v1/exec".startsWith(PREFIX_URL)).toBe(false);
+ expect("https://mso.example.com/api/v1/term".startsWith(PREFIX_URL)).toBe(false);
});
it("never grants 'self' — that would re-open the origin via a nested iframe", () => {
@@ -93,7 +93,7 @@ describe("contentSecurityPolicy intersected with the live OpenClaw policy", () =
expect(directive(csp, "style-src")).toBe(`style-src ${PREFIX_URL} 'unsafe-inline' https://fonts.googleapis.com`);
expect(directive(csp, "font-src")).toBe(`font-src ${PREFIX_URL} https://fonts.gstatic.com`);
expect(directive(csp, "connect-src")).toBe(
- `connect-src ${PREFIX_URL} wss://hermes.mso.rahmanef.com/ https://api.openai.com https://tweakcn.com`,
+ `connect-src ${PREFIX_URL} wss://hermes.mso.example.com/ https://api.openai.com https://tweakcn.com`,
);
// The upstream's bare `wss:` is not copied — it would be every host on earth.
// The only socket source is the app's OWN origin, added by us: CSP matches the
@@ -131,7 +131,7 @@ describe("contentSecurityPolicy refuses to be widened by the upstream", () => {
it("never honours our own origin — that is the /api/v1/exec hole itself", () => {
const csp = contentSecurityPolicy(
PREFIX_URL,
- "connect-src 'self' https://mso.rahmanef.com https://mso.rahmanef.com/api/v1/exec",
+ "connect-src 'self' https://mso.example.com https://mso.example.com/api/v1/exec",
MOUNT,
);
expect(directive(csp, "connect-src")).toBe(`connect-src ${PREFIX_URL} ${SOCKET}`);
@@ -145,7 +145,7 @@ describe("contentSecurityPolicy refuses to be widened by the upstream", () => {
MOUNT,
);
expect(directive(csp, "img-src")).toBe(`img-src ${PREFIX_URL} data:`);
- expect(directive(csp, "connect-src")).toBe(`connect-src ${PREFIX_URL} wss://hermes.mso.rahmanef.com/ data: blob:`);
+ expect(directive(csp, "connect-src")).toBe(`connect-src ${PREFIX_URL} wss://hermes.mso.example.com/ data: blob:`);
expect(csp).not.toContain("evil.example");
expect(csp).not.toContain("tracker.example");
expect(csp).not.toContain("unsafe-eval");
@@ -193,7 +193,7 @@ describe("contentSecurityPolicy refuses to be widened by the upstream", () => {
it("treats our own origin on another port, or trailing-dot, as ours — not external", () => {
const csp = contentSecurityPolicy(
PREFIX_URL,
- "connect-src 'self' https://mso.rahmanef.com:8443 https://mso.rahmanef.com./x",
+ "connect-src 'self' https://mso.example.com:8443 https://mso.example.com./x",
MOUNT,
);
expect(directive(csp, "connect-src")).toBe(`connect-src ${PREFIX_URL} ${SOCKET}`);
diff --git a/lib/managed-apps/proxy-csp.ts b/lib/managed-apps/proxy-csp.ts
index e6f9e538..a45dfda4 100644
--- a/lib/managed-apps/proxy-csp.ts
+++ b/lib/managed-apps/proxy-csp.ts
@@ -22,7 +22,7 @@ export interface PolicyMount {
/** The cockpit origin. Root-mounted, the frame is CROSS-origin, so
* frame-ancestors must name it or the browser refuses to display the dashboard.
* It is also the one external host never honoured out of an upstream policy: a
- * compromised upstream granting itself `connect-src https://mso.rahmanef.com`
+ * compromised upstream granting itself `connect-src https://mso.example.com`
* would be calling the cockpit API from inside the frame. Missing ⇒ 'none',
* because a frame that will not display is a visible failure while a guessed
* framer is a silent invitation. */
@@ -132,7 +132,7 @@ const isHash = (src: string) => /^'sha(?:256|384|512)-/i.test(src);
const isScheme = (src: string) => /^[a-z][a-z0-9+.\-]*:$/i.test(src);
// hostname, not host: `URL.host` carries the port, and cookies are port-agnostic,
-// so `https://mso.rahmanef.com:8443` must still count as our own origin. Trailing
+// so `https://mso.example.com:8443` must still count as our own origin. Trailing
// dot is the same name to DNS.
const canonHost = (url: string): string | null => {
try {
@@ -164,7 +164,7 @@ function survives(src: string, theirs: string[], prefixUrl: string): boolean {
// An upstream can rewrite its own policy at will, so a honoured source is capped:
// https only, no wildcards, and NEVER our own origin — `connect-src
-// https://mso.rahmanef.com` from a compromised upstream would hand its JS
+// https://mso.example.com` from a compromised upstream would hand its JS
// /api/v1/exec, which is the one thing the scoping exists to prevent. The cockpit
// is excluded separately because root-mounted it is no longer the same host as
// prefixUrl, so `sameHost` alone would let the upstream name it.
diff --git a/lib/managed-apps/proxy-headers.test.ts b/lib/managed-apps/proxy-headers.test.ts
index 649217b4..6540ed93 100644
--- a/lib/managed-apps/proxy-headers.test.ts
+++ b/lib/managed-apps/proxy-headers.test.ts
@@ -14,7 +14,7 @@ const PREFIX = proxyPrefix("hermes");
describe("buildUpstreamHeaders", () => {
const base = new URL("http://127.0.0.1:9119");
const withHeaders = (init: Record<string, string>) =>
- new Request("https://hermes.mso.rahmanef.com/api/config", { headers: init });
+ new Request("https://hermes.mso.example.com/api/config", { headers: init });
it("forwards Hermes' own session token, because dropping it 401s every fetch", () => {
// Loopback Hermes injects an ephemeral token into the SPA HTML and requires it
diff --git a/lib/managed-apps/proxy-headers.ts b/lib/managed-apps/proxy-headers.ts
index bcbd5422..a8545228 100644
--- a/lib/managed-apps/proxy-headers.ts
+++ b/lib/managed-apps/proxy-headers.ts
@@ -56,8 +56,8 @@ const RESPONSE_HEADERS = [
];
// Cookie NAMESPACE, not a path. Load-bearing on an app host too: the cockpit
-// session cookie now carries Domain=mso.rahmanef.com, so it IS sent to
-// hermes.mso.rahmanef.com — and Hermes' own cookies are `hermes_session_at` /
+// session cookie now carries Domain=mso.example.com, so it IS sent to
+// hermes.mso.example.com — and Hermes' own cookies are `hermes_session_at` /
// `_rt` / `_provider` / `_pkce` / `hermes_sso_attempt`, any of which could just as
// easily have been called `session` (OpenClaw sets none at all today).
export const cookiePrefix = (id: string): string => `mapp_${id}_`;
diff --git a/lib/managed-apps/redact.test.ts b/lib/managed-apps/redact.test.ts
index 7eaea86a..051f5264 100644
--- a/lib/managed-apps/redact.test.ts
+++ b/lib/managed-apps/redact.test.ts
@@ -9,7 +9,7 @@ import { redact } from "./redact";
/** Assembled from the shapes actually seen in `hermes update` / `openclaw
* update` output, plus the two journald formats getManagedAppLogs asks for. */
const TRANSCRIPT = [
- "[mso] pre-update backup of /home/rahman/.hermes",
+ "[mso] pre-update backup of /home/operator/.hermes",
"npm WARN deprecated [email protected]: This module is not supported",
"npm notice New major version of npm available! 10.8.2 -> 11.0.0",
"added 412 packages, and audited 413 packages in 9s",
diff --git a/lib/managed-apps/update-cli.test.ts b/lib/managed-apps/update-cli.test.ts
index 2dfe8d39..d268ebdd 100644
--- a/lib/managed-apps/update-cli.test.ts
+++ b/lib/managed-apps/update-cli.test.ts
@@ -10,7 +10,7 @@ const { assertBranch, assertChannel, assertTag, updateAdapter, UNINSTALL_PREVIEW
const { parseHermesCheck } = await import("./update-probe");
const HERMES = "/usr/local/bin/hermes";
-const OPENCLAW = "/home/rahman/.local/bin/openclaw";
+const OPENCLAW = "/home/operator/.local/bin/openclaw";
const result = (stdout: string, code = 0) => ({ code, stdout, stderr: "" });
describe("the argv each CLI actually gets", () => {
@@ -162,7 +162,7 @@ describe("reading what Hermes says back", () => {
});
describe("the 9Router wrapper argv", () => {
- const NINE = "/home/rahman/projects/mso/scripts/managed-app-9router";
+ const NINE = "/home/operator/projects/mso/scripts/managed-app-9router";
it("builds update and uninstall in the wrapper's own grammar", () => {
expect(updateAdapter("9router").updateArgv(NINE, {})).toEqual([NINE, "update", "--yes"]);
diff --git a/lib/mcp/privacy-portability.test.ts b/lib/mcp/privacy-portability.test.ts
new file mode 100644
index 00000000..89ccf797
--- /dev/null
+++ b/lib/mcp/privacy-portability.test.ts
@@ -0,0 +1,94 @@
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+const reset = () => {
+ vi.unstubAllEnvs();
+ vi.resetModules();
+};
+afterEach(reset);
+
+describe("portable public MCP configuration", () => {
+ it("derives safe public and sibling widget origins", async () => {
+ vi.stubEnv("OS_PUBLIC_ORIGIN", "https://mso.example.test/ignored?x=1");
+ const config = await import("./ui-config");
+ expect(config.MSO_ORIGIN).toBe("https://mso.example.test");
+ expect(config.MCP_UI_DOMAIN).toBe("https://mso-ui.example.test");
+ expect(JSON.stringify(config.widgetResourceMeta("test"))).not.toMatch(
+ /rahmanef\.com|\/home\/rahman/,
+ );
+ });
+ it("uses explicit UI origin only when it is a safe browser origin", async () => {
+ vi.stubEnv("OS_PUBLIC_ORIGIN", "https://console.example.test");
+ vi.stubEnv("OS_MCP_UI_ORIGIN", "https://widgets.example.test/path");
+ let config = await import("./ui-config");
+ expect(config.MCP_UI_DOMAIN).toBe("https://widgets.example.test");
+ reset();
+ vi.stubEnv("OS_PUBLIC_ORIGIN", "https://console.example.test");
+ vi.stubEnv("OS_MCP_UI_ORIGIN", "https://user:[email protected]");
+ config = await import("./ui-config");
+ expect(config.MCP_UI_DOMAIN).toBe("https://console.example.test");
+ });
+ it("has no external app or frame CSP without explicit configuration", async () => {
+ vi.stubEnv("OS_PUBLIC_ORIGIN", "https://mso.example.test");
+ const catalog = await import("./surface-catalog");
+ expect(catalog.publicSurfaceApps()).toEqual([]);
+ expect(catalog.surfaceFrameDomains()).toEqual([]);
+ const config = await import("./ui-config");
+ expect(
+ JSON.stringify({
+ metadataBase: config.MSO_ORIGIN,
+ apps: catalog.publicSurfaceApps(),
+ meta: config.widgetResourceMeta("test"),
+ }),
+ ).not.toMatch(/rahmanef\.com|\/home\/rahman/);
+ });
+ it("validates, deduplicates and exposes configured external apps only", async () => {
+ vi.stubEnv(
+ "MSO_SURFACE_APPS_JSON",
+ JSON.stringify([
+ {
+ id: "demo",
+ title: "Demo",
+ description: "safe",
+ origin: "https://demo.example.test",
+ startPath: "/embed",
+ renderer: "iframe",
+ presentation: "inline",
+ environment: "production",
+ sandbox: "allow-scripts allow-same-origin",
+ externalAuthPath: "/login",
+ },
+ {
+ id: "demo",
+ title: "Duplicate",
+ origin: "https://other.example.test",
+ startPath: "/",
+ renderer: "remote",
+ presentation: "inline",
+ environment: "other",
+ },
+ {
+ id: "bad",
+ title: "Bad",
+ origin: "http://evil.example.test",
+ startPath: "/",
+ renderer: "iframe",
+ presentation: "inline",
+ environment: "production",
+ },
+ ]),
+ );
+ const catalog = await import("./surface-catalog");
+ expect(catalog.publicSurfaceApps()).toEqual([
+ expect.objectContaining({
+ id: "demo",
+ origin: "https://demo.example.test",
+ }),
+ ]);
+ expect(catalog.surfaceFrameDomains()).toEqual([
+ "https://demo.example.test",
+ ]);
+ expect(catalog.resolveSurfaceRoute("/apps/demo").app?.url).toBe(
+ "https://demo.example.test/embed",
+ );
+ });
+});
diff --git a/lib/mcp/redirect.test.ts b/lib/mcp/redirect.test.ts
index af97c007..b7837d47 100644
--- a/lib/mcp/redirect.test.ts
+++ b/lib/mcp/redirect.test.ts
@@ -62,9 +62,9 @@ describe("selfUrl", () => {
it("carries `resource`, which ChatGPT sends", () => {
const params = new URL(
- `https://mso.test${selfUrl({ ...REQ, resource: "https://mso.rahmanef.com/mcp" })}`,
+ `https://mso.test${selfUrl({ ...REQ, resource: "https://mso.example.com/mcp" })}`,
).searchParams;
- expect(params.get("resource")).toBe("https://mso.rahmanef.com/mcp");
+ expect(params.get("resource")).toBe("https://mso.example.com/mcp");
});
it("drops anything the flow does not read", () => {
diff --git a/lib/mcp/surface-catalog.test.ts b/lib/mcp/surface-catalog.test.ts
index c442b06e..f57f458f 100644
--- a/lib/mcp/surface-catalog.test.ts
+++ b/lib/mcp/surface-catalog.test.ts
@@ -1,47 +1,40 @@
-import { describe, expect, it } from "vitest";
+import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { publicSurfaceApps, resolveSurfaceRoute, surfaceFrameDomains } from "./surface-catalog";
import { MSO_SURFACE_SCRIPT } from "./ui-surface-script";
import { OPEN_IN_MSO_SCRIPT } from "./ui-navigation";
+const configured = [{
+ id: "demo", title: "Demo", description: "Configured demo", origin: "https://demo.example.test",
+ startPath: "/embed", renderer: "iframe", presentation: "inline", environment: "production",
+ sandbox: "allow-scripts allow-same-origin",
+}];
+
describe("MSO Page trusted app catalog", () => {
- it("allowlists only the reviewed Play Together production origin", () => {
- expect(surfaceFrameDomains()).toEqual(["https://game.rahmanef.com"]);
+ beforeEach(() => { process.env.MSO_SURFACE_APPS_JSON = JSON.stringify(configured); });
+ afterEach(() => { delete process.env.MSO_SURFACE_APPS_JSON; });
+
+ it("uses only instance-configured reviewed origins", () => {
+ expect(surfaceFrameDomains()).toEqual(["https://demo.example.test"]);
const apps = publicSurfaceApps();
expect(apps).toHaveLength(1);
- expect(apps[0]).toMatchObject({
- id: "play-together",
- title: "Play Together",
- origin: "https://game.rahmanef.com",
- startPath: "/embed",
- renderer: "iframe",
- presentation: "inline",
- environment: "production",
- });
+ expect(apps[0]).toMatchObject({ id: "demo", title: "Demo", origin: "https://demo.example.test", startPath: "/embed", renderer: "iframe", presentation: "inline", environment: "production" });
expect(JSON.stringify(apps)).not.toContain("sandbox");
});
it("rejects arbitrary URLs, protocol-relative routes and traversal", () => {
- for (const route of [
- "https://evil.example/app",
- "//evil.example/app",
- "/apps/unknown",
- "/apps/play-together/../admin",
- "/apps/play-together/%2e%2e/admin",
- "/apps/play-together\\evil",
- ]) {
+ for (const route of ["https://evil.example/app", "//evil.example/app", "/apps/unknown", "/apps/demo/../admin", "/apps/demo/%2e%2e/admin", "/apps/demo\\evil"]) {
expect(() => resolveSurfaceRoute(route), route).toThrow();
}
});
- it("keeps every Play Together demo route inside /embed", () => {
- const root = resolveSurfaceRoute("/apps/play-together");
- expect(root).toMatchObject({ kind: "app", title: "Play Together", openPath: "/assistant/mcp" });
- expect(root.app).toMatchObject({ id: "play-together", renderer: "iframe", environment: "production" });
+ it("keeps every configured iframe route inside its start path", () => {
+ const root = resolveSurfaceRoute("/apps/demo");
+ expect(root).toMatchObject({ kind: "app", title: "Demo", openPath: "/assistant/mcp" });
+ expect(root.app).toMatchObject({ id: "demo", renderer: "iframe", environment: "production" });
expect(new URL(root.app!.url).pathname).toBe("/embed");
-
- const room = resolveSurfaceRoute("/apps/play-together/room/ABCD?join=remote");
+ const room = resolveSurfaceRoute("/apps/demo/room/ABCD?join=remote");
const url = new URL(room.app!.url);
- expect(url.origin).toBe("https://game.rahmanef.com");
+ expect(url.origin).toBe("https://demo.example.test");
expect(url.pathname).toBe("/embed/room/ABCD");
expect(url.searchParams.get("join")).toBe("remote");
});
@@ -56,5 +49,6 @@ describe("MSO Page trusted app catalog", () => {
expect(MSO_SURFACE_SCRIPT).not.toContain("window.openai.callTool");
expect(MSO_SURFACE_SCRIPT).toContain("url.origin!==safe.origin");
expect(MSO_SURFACE_SCRIPT).toContain("!url.pathname.startsWith(start+\"/\")");
+ expect(MSO_SURFACE_SCRIPT).not.toContain("play-together:embed-ready");
});
});
diff --git a/lib/mcp/surface-catalog.ts b/lib/mcp/surface-catalog.ts
index 57369711..aabaa11a 100644
--- a/lib/mcp/surface-catalog.ts
+++ b/lib/mcp/surface-catalog.ts
@@ -1,46 +1,23 @@
-export type SurfaceRenderer = "iframe" | "remote";
-export type SurfacePresentation = "inline" | "fullscreen" | "pip";
-export type SurfaceEnvironment = "development" | "preview" | "production" | "other";
+import { configuredSurfaceApps, type SurfaceApp } from "./surface-config";
+export type { SurfaceApp, SurfaceRenderer, SurfacePresentation, SurfaceEnvironment } from "./surface-config";
-export type SurfaceApp = {
- id: string;
- title: string;
- description: string;
- origin: string;
- startPath: string;
- renderer: SurfaceRenderer;
- presentation: SurfacePresentation;
- environment: SurfaceEnvironment;
- sandbox?: string;
- externalAuthPath?: string;
- reason?: string;
-};
-
-// This is deliberately code-owned rather than model/user-provided. Every nested
-// frame origin becomes part of the MCP Apps CSP and therefore deserves review.
-// Apps that deny framing remain useful through the remote-browser seam instead of
-// having their X-Frame-Options/frame-ancestors stripped by MSO.
-export const SURFACE_APPS: readonly SurfaceApp[] = [
- {
- id: "play-together",
- title: "Play Together",
- description: "Live Play Together demo through its dedicated /embed security boundary.",
- origin: "https://game.rahmanef.com",
- startPath: "/embed",
- externalAuthPath: "/?auth=google",
- renderer: "iframe",
- presentation: "inline",
- environment: "production",
- sandbox: "allow-scripts allow-same-origin allow-forms allow-pointer-lock",
- },
-] as const;
+export function surfaceApps(): readonly SurfaceApp[] {
+ return configuredSurfaceApps();
+}
const ROUTE_MAX = 1024;
const BASE = "https://mso-surface.invalid";
export type ResolvedSurface = {
route: string;
- kind: "home" | "monitor" | "project" | "diff" | "browser" | "app" | "integrations";
+ kind:
+ | "home"
+ | "monitor"
+ | "project"
+ | "diff"
+ | "browser"
+ | "app"
+ | "integrations";
title: string;
openPath: string;
project?: string;
@@ -48,50 +25,116 @@ export type ResolvedSurface = {
app?: SurfaceApp & { url: string };
};
-export function publicSurfaceApps(): Array<Omit<SurfaceApp, "sandbox" | "externalAuthPath">> {
- return SURFACE_APPS.map(({ sandbox: _sandbox, externalAuthPath: _externalAuthPath, ...app }) => ({ ...app }));
+export function publicSurfaceApps(): Array<
+ Omit<SurfaceApp, "sandbox" | "externalAuthPath">
+> {
+ return surfaceApps().map(
+ ({ sandbox: _sandbox, externalAuthPath: _externalAuthPath, ...app }) => ({
+ ...app,
+ }),
+ );
}
export function surfaceFrameDomains(): string[] {
- return [...new Set(SURFACE_APPS.filter((app) => app.renderer === "iframe").map((app) => app.origin))];
+ return [
+ ...new Set(
+ surfaceApps()
+ .filter((app) => app.renderer === "iframe")
+ .map((app) => app.origin),
+ ),
+ ];
}
export function surfaceAppById(id: string): SurfaceApp | undefined {
- return SURFACE_APPS.find((app) => app.id === id);
+ return surfaceApps().find((app) => app.id === id);
}
function cleanRoute(raw: string): URL {
- if (!raw || raw.length > ROUTE_MAX || !raw.startsWith("/") || raw.startsWith("//") || /[\\\u0000-\u001f]/.test(raw)) {
+ if (
+ !raw ||
+ raw.length > ROUTE_MAX ||
+ !raw.startsWith("/") ||
+ raw.startsWith("//") ||
+ /[\\\u0000-\u001f]/.test(raw)
+ ) {
throw new Error("surface route must be a bounded absolute MSO-style path");
}
const url = new URL(raw, BASE);
- if (url.origin !== BASE) throw new Error("surface route cannot change origin");
+ if (url.origin !== BASE)
+ throw new Error("surface route cannot change origin");
return url;
}
function safeDemoUrl(app: SurfaceApp, suffix: string, search: string): string {
const base = app.startPath === "/" ? "" : app.startPath.replace(/\/$/, "");
const path = suffix ? `${base}/${suffix}` : app.startPath;
- if (path.length > 768 || /[\\\u0000-\u001f]/.test(path) || path.split("/").some((part) => part === "." || part === "..")) {
+ if (
+ path.length > 768 ||
+ /[\\\u0000-\u001f]/.test(path) ||
+ path.split("/").some((part) => part === "." || part === "..")
+ ) {
throw new Error("invalid demo path");
}
const url = new URL(`${path}${suffix ? search : ""}`, app.origin);
- if (url.origin !== app.origin || url.username || url.password || url.protocol !== "https:") throw new Error("demo URL escaped its trusted origin");
+ if (
+ url.origin !== app.origin ||
+ url.username ||
+ url.password ||
+ url.protocol !== "https:"
+ )
+ throw new Error("demo URL escaped its trusted origin");
return url.href;
}
-export function resolveSurfaceRoute(rawRoute: string, context?: { project?: string; sha?: string }): ResolvedSurface {
+export function resolveSurfaceRoute(
+ rawRoute: string,
+ context?: { project?: string; sha?: string },
+): ResolvedSurface {
const url = cleanRoute(rawRoute);
const decoded = decodeURIComponent(url.pathname);
const parts = decoded.split("/").filter(Boolean);
const route = `${url.pathname}${url.search}`;
- if (parts.length === 0) return { route, kind: "home", title: "MSO", openPath: "/assistant/mcp" };
- if (parts[0] === "integrations" && parts.length === 1) return { route, kind: "integrations", title: "Integrations", openPath: "/integrations" };
- if (parts[0] === "monitor" && parts.length === 1) return { route, kind: "monitor", title: "System Monitor", openPath: "/monitor" };
- if (parts[0] === "browser" && parts.length === 1) return { route, kind: "browser", title: "Remote Browser", openPath: "/browser" };
- if (parts[0] === "project" && parts.length === 1) return { route, kind: "project", title: "Project", openPath: "/files", ...(context?.project ? { project: context.project } : {}) };
- if (parts[0] === "diff" && parts.length === 1) return { route, kind: "diff", title: "Project Diff", openPath: "/code", ...(context?.project ? { project: context.project } : {}), ...(context?.sha ? { sha: context.sha } : {}) };
+ if (parts.length === 0)
+ return { route, kind: "home", title: "MSO", openPath: "/assistant/mcp" };
+ if (parts[0] === "integrations" && parts.length === 1)
+ return {
+ route,
+ kind: "integrations",
+ title: "Integrations",
+ openPath: "/integrations",
+ };
+ if (parts[0] === "monitor" && parts.length === 1)
+ return {
+ route,
+ kind: "monitor",
+ title: "System Monitor",
+ openPath: "/monitor",
+ };
+ if (parts[0] === "browser" && parts.length === 1)
+ return {
+ route,
+ kind: "browser",
+ title: "Remote Browser",
+ openPath: "/browser",
+ };
+ if (parts[0] === "project" && parts.length === 1)
+ return {
+ route,
+ kind: "project",
+ title: "Project",
+ openPath: "/files",
+ ...(context?.project ? { project: context.project } : {}),
+ };
+ if (parts[0] === "diff" && parts.length === 1)
+ return {
+ route,
+ kind: "diff",
+ title: "Project Diff",
+ openPath: "/code",
+ ...(context?.project ? { project: context.project } : {}),
+ ...(context?.sha ? { sha: context.sha } : {}),
+ };
if (parts[0] === "apps" && parts[1]) {
const app = surfaceAppById(parts[1]);
diff --git a/lib/mcp/surface-config.ts b/lib/mcp/surface-config.ts
new file mode 100644
index 00000000..f6d0eae0
--- /dev/null
+++ b/lib/mcp/surface-config.ts
@@ -0,0 +1,82 @@
+export type SurfaceRenderer = "iframe" | "remote";
+export type SurfacePresentation = "inline" | "fullscreen" | "pip";
+export type SurfaceEnvironment = "development" | "preview" | "production" | "other";
+
+export type SurfaceApp = {
+ id: string;
+ title: string;
+ description: string;
+ origin: string;
+ startPath: string;
+ renderer: SurfaceRenderer;
+ presentation: SurfacePresentation;
+ environment: SurfaceEnvironment;
+ sandbox?: string;
+ externalAuthPath?: string;
+ reason?: string;
+};
+
+const MAX_APPS = 16;
+const MAX_TEXT = 240;
+const SAFE_SANDBOX = new Set([
+ "allow-downloads", "allow-forms", "allow-modals", "allow-orientation-lock",
+ "allow-pointer-lock", "allow-popups", "allow-popups-to-escape-sandbox",
+ "allow-presentation", "allow-same-origin", "allow-scripts",
+]);
+const PRESENTATIONS = new Set<SurfacePresentation>(["inline", "fullscreen", "pip"]);
+const ENVIRONMENTS = new Set<SurfaceEnvironment>(["development", "preview", "production", "other"]);
+
+function safeOrigin(value: unknown): string | null {
+ if (typeof value !== "string") return null;
+ try {
+ const url = new URL(value);
+ if (url.protocol !== "https:" || url.username || url.password || url.pathname !== "/" || url.search || url.hash) return null;
+ return url.origin;
+ } catch { return null; }
+}
+
+function safePath(value: unknown): string | null {
+ if (typeof value !== "string" || !value.startsWith("/") || value.startsWith("//") || value.length > 768 || /[\\\u0000-\u001f]/.test(value)) return null;
+ try {
+ const url = new URL(value, "https://surface.invalid");
+ if (url.origin !== "https://surface.invalid" || url.search || url.hash || url.pathname.split("/").some((part) => part === "." || part === "..")) return null;
+ return url.pathname;
+ } catch { return null; }
+}
+
+function boundedText(value: unknown, required = false): string | undefined {
+ if (typeof value !== "string") return required ? undefined : "";
+ const result = value.trim();
+ return result && result.length <= MAX_TEXT ? result : required ? undefined : "";
+}
+
+function parseApp(entry: unknown, seen: Set<string>): SurfaceApp | null {
+ if (!entry || typeof entry !== "object") return null;
+ const row = entry as Record<string, unknown>;
+ const id = boundedText(row.id, true), title = boundedText(row.title, true);
+ const origin = safeOrigin(row.origin), startPath = safePath(row.startPath);
+ const renderer = row.renderer, presentation = row.presentation, environment = row.environment;
+ if (!id || !/^[a-z0-9][a-z0-9-]{0,63}$/.test(id) || seen.has(id) || !title || !origin || !startPath) return null;
+ if (renderer !== "iframe" && renderer !== "remote") return null;
+ if (!PRESENTATIONS.has(presentation as SurfacePresentation) || !ENVIRONMENTS.has(environment as SurfaceEnvironment)) return null;
+ const sandbox = typeof row.sandbox === "string" ? row.sandbox.trim() : undefined;
+ if (sandbox && (sandbox.length > 240 || !sandbox.split(/\s+/).every((token) => SAFE_SANDBOX.has(token)))) return null;
+ const externalAuthPath = row.externalAuthPath === undefined ? undefined : safePath(row.externalAuthPath);
+ if (row.externalAuthPath !== undefined && !externalAuthPath) return null;
+ seen.add(id);
+ const reason = boundedText(row.reason);
+ return {
+ id, title, description: boundedText(row.description) ?? "", origin, startPath, renderer,
+ presentation: presentation as SurfacePresentation, environment: environment as SurfaceEnvironment,
+ ...(sandbox ? { sandbox } : {}), ...(externalAuthPath ? { externalAuthPath } : {}), ...(reason ? { reason } : {}),
+ };
+}
+
+export function configuredSurfaceApps(raw = process.env.MSO_SURFACE_APPS_JSON): SurfaceApp[] {
+ if (!raw || raw.length > 16_384) return [];
+ let entries: unknown;
+ try { entries = JSON.parse(raw); } catch { return []; }
+ if (!Array.isArray(entries)) return [];
+ const seen = new Set<string>();
+ return entries.slice(0, MAX_APPS).map((entry) => parseApp(entry, seen)).filter((app): app is SurfaceApp => app !== null);
+}
diff --git a/lib/mcp/tools-surface.test.ts b/lib/mcp/tools-surface.test.ts
index 7a8804cf..d245cfdd 100644
--- a/lib/mcp/tools-surface.test.ts
+++ b/lib/mcp/tools-surface.test.ts
@@ -1,4 +1,4 @@
-import { describe, expect, it } from "vitest";
+import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { SURFACE_TOOLS } from "./tools-surface";
const tool = (name: string) => {
@@ -8,12 +8,14 @@ const tool = (name: string) => {
};
describe("MSO Page MCP tools", () => {
+ beforeEach(() => { process.env.MSO_SURFACE_APPS_JSON = JSON.stringify([{ id: "demo", title: "Demo", description: "Configured demo", origin: "https://demo.example.test", startPath: "/embed", renderer: "iframe", presentation: "inline", environment: "production", sandbox: "allow-scripts allow-same-origin" }]); });
+ afterEach(() => { delete process.env.MSO_SURFACE_APPS_JSON; });
it("returns only the server-reviewed public app catalog", async () => {
const result = await tool("mso_surface_apps_list").run({}, { scope: "read" }) as { apps: Array<Record<string, unknown>> };
- expect(result.apps.map((app) => app.id)).toEqual(["play-together"]);
+ expect(result.apps.map((app) => app.id)).toEqual(["demo"]);
expect(result.apps[0]).toMatchObject({
- title: "Play Together",
- origin: "https://game.rahmanef.com",
+ title: "Demo",
+ origin: "https://demo.example.test",
renderer: "iframe",
startPath: "/embed",
environment: "production",
@@ -22,30 +24,30 @@ describe("MSO Page MCP tools", () => {
expect(JSON.stringify(result)).not.toContain("<script");
});
- it("renders the VPSKU Play Together target without accepting a URL argument", async () => {
+ it("renders an instance-configured target without accepting a URL argument", async () => {
const render = tool("render_mso_page");
expect(render.inputSchema.properties).not.toHaveProperty("url");
expect(render.inputSchema.properties).not.toHaveProperty("html");
- const result = await render.run({ route: "/apps/play-together" }, { scope: "read" }) as { app?: Record<string, unknown> };
+ const result = await render.run({ route: "/apps/demo" }, { scope: "read" }) as { app?: Record<string, unknown> };
expect(result.app).toMatchObject({
- id: "play-together",
+ id: "demo",
renderer: "iframe",
presentation: "inline",
- origin: "https://game.rahmanef.com",
+ origin: "https://demo.example.test",
startPath: "/embed",
environment: "production",
- url: "https://game.rahmanef.com/embed",
+ url: "https://demo.example.test/embed",
});
expect(result.app).not.toHaveProperty("sandbox");
expect((render.meta?.ui as { resourceUri?: string }).resourceUri).toMatch(/^ui:\/\/mso\/page-v10\.html$/);
expect(render.meta?.["openai/outputTemplate"]).toBeUndefined();
});
- it("keeps scanner-facing Page metadata scoped to Play Together", () => {
+ it("keeps scanner-facing Page metadata generic", () => {
const render = tool("render_mso_page");
const metadata = JSON.stringify({ description: render.description, chatgptDescription: render.chatgptDescription });
- expect(metadata).toContain("play-together");
- expect(metadata.toLowerCase()).not.toContain("antinrml");
+ expect(metadata).toContain("<configured-app-id>");
+ expect(metadata.toLowerCase()).not.toMatch(/rahmanef|antinrml/);
});
it("keeps project identity separate from the route string", async () => {
diff --git a/lib/mcp/tools-surface.ts b/lib/mcp/tools-surface.ts
index 4a9fa61e..1d8ad660 100644
--- a/lib/mcp/tools-surface.ts
+++ b/lib/mcp/tools-surface.ts
@@ -90,7 +90,7 @@ export const SURFACE_TOOLS: McpTool[] = [
name: "render_mso_page",
title: "Render MSO Page",
description: "Render the full MSO Page MCP App for native operator views or reviewed development/production embeds. Use an MSO-style route such as /, /integrations, /monitor, /project, /diff, /browser, or /apps/<reviewed-app-id>. For project/diff views pass project separately. This tool never accepts raw HTML or arbitrary external URLs; iframe targets come only from the server-owned allowlist.",
- chatgptDescription: "Render the full secure MSO Page in ChatGPT. Native routes: /, /integrations, /monitor, /project, /diff, /browser; reviewed live demo: /apps/play-together. Raw HTML and arbitrary URLs are rejected.",
+ chatgptDescription: "Render the full secure MSO Page in ChatGPT. Native routes: /, /integrations, /monitor, /project, /diff, /browser; configured app route: /apps/<configured-app-id>. Raw HTML and arbitrary URLs are rejected.",
scope: "read", annotations: READ_ONLY,
inputSchema: PAGE_INPUT,
outputSchema: PAGE_OUTPUT,
diff --git a/lib/mcp/ui-config.ts b/lib/mcp/ui-config.ts
index 9b948d00..ab75b51a 100644
--- a/lib/mcp/ui-config.ts
+++ b/lib/mcp/ui-config.ts
@@ -1,9 +1,61 @@
-export const MSO_ORIGIN = "https://mso.rahmanef.com";
-// Dedicated sibling origin for ChatGPT MCP Apps. It intentionally does NOT sit
-// below mso.rahmanef.com, whose session cookie may be scoped to that hostname.
-export const MCP_UI_DOMAIN = "https://mso-ui.rahmanef.com";
+/** Deployment-owned public browser origin. Never encode an operator instance here. */
+function loopback(hostname: string): boolean {
+ const host = hostname.toLowerCase().replace(/^\[/, "").replace(/\]$/, "");
+ return host === "localhost" || host === "::1" || host.startsWith("127.");
+}
+
+export function sanitizedBrowserOrigin(
+ value: string | undefined,
+ fallback = "http://localhost:4005",
+): string {
+ const raw = value?.trim();
+ if (raw) {
+ try {
+ const url = new URL(raw);
+ if (
+ !url.username &&
+ !url.password &&
+ (url.protocol === "https:" ||
+ (url.protocol === "http:" && loopback(url.hostname)))
+ )
+ return url.origin;
+ } catch {
+ /* use safe local fallback */
+ }
+ }
+ return fallback;
+}
+
+export function publicMsoOrigin(): string {
+ return sanitizedBrowserOrigin(process.env.OS_PUBLIC_ORIGIN);
+}
-export function widgetResourceMeta(description: string, options?: { frameDomains?: readonly string[]; connectDomains?: readonly string[]; resourceDomains?: readonly string[]; redirectDomains?: readonly string[] }): Record<string, unknown> {
+export function mcpUiOrigin(): string {
+ const explicit = process.env.OS_MCP_UI_ORIGIN?.trim();
+ if (explicit) return sanitizedBrowserOrigin(explicit, publicMsoOrigin());
+ const publicOrigin = publicMsoOrigin();
+ const url = new URL(publicOrigin);
+ if (url.hostname.toLowerCase().startsWith("mso.")) {
+ url.hostname = `mso-ui.${url.hostname.slice(4)}`;
+ return url.origin;
+ }
+ return publicOrigin;
+}
+
+// Kept as exports for existing resource modules. Values are deployment config at
+// process startup; helpers above are used where request-time recomputation matters.
+export const MSO_ORIGIN = publicMsoOrigin();
+export const MCP_UI_DOMAIN = mcpUiOrigin();
+
+export function widgetResourceMeta(
+ description: string,
+ options?: {
+ frameDomains?: readonly string[];
+ connectDomains?: readonly string[];
+ resourceDomains?: readonly string[];
+ redirectDomains?: readonly string[];
+ },
+): Record<string, unknown> {
const frameDomains = [...(options?.frameDomains ?? [])];
const connectDomains = [...(options?.connectDomains ?? [])];
const resourceDomains = [...(options?.resourceDomains ?? [])];
@@ -11,13 +63,19 @@ export function widgetResourceMeta(description: string, options?: { frameDomains
ui: {
domain: MCP_UI_DOMAIN,
prefersBorder: true,
- csp: { connectDomains, resourceDomains, ...(frameDomains.length ? { frameDomains } : {}) },
+ csp: {
+ connectDomains,
+ resourceDomains,
+ ...(frameDomains.length ? { frameDomains } : {}),
+ },
},
"openai/widgetDescription": description,
"openai/widgetPrefersBorder": true,
"openai/widgetDomain": MCP_UI_DOMAIN,
- // Standard CSP fields live only in `ui.csp`. OpenAI documents this legacy
- // key as still required for trusted `openExternal` redirect destinations.
- "openai/widgetCSP": { ...(connectDomains.length ? { connect_domains: connectDomains } : {}), ...(frameDomains.length ? { frame_domains: frameDomains } : {}), redirect_domains: [MSO_ORIGIN, ...(options?.redirectDomains ?? [])] },
+ "openai/widgetCSP": {
+ ...(connectDomains.length ? { connect_domains: connectDomains } : {}),
+ ...(frameDomains.length ? { frame_domains: frameDomains } : {}),
+ redirect_domains: [MSO_ORIGIN, ...(options?.redirectDomains ?? [])],
+ },
};
}
diff --git a/lib/mcp/ui-page-auth.test.ts b/lib/mcp/ui-page-auth.test.ts
index 966deb1d..bae3203f 100644
--- a/lib/mcp/ui-page-auth.test.ts
+++ b/lib/mcp/ui-page-auth.test.ts
@@ -14,7 +14,7 @@ function fixture(path = "/?auth=google") {
button: (_label: string, click: () => Promise<void>) => { const b = { click, focus: vi.fn(), disabled: false }; buttons.push(b); return b; },
};
const cleanup = runInNewContext(`${MSO_PAGE_AUTH_SCRIPT}; mountReviewedAuth`, context)(
- { origin: "https://game.rahmanef.com", externalAuthPath: path }, frame, { append: vi.fn() }, message,
+ { origin: "https://game.example.com", externalAuthPath: path }, frame, { append: vi.fn() }, message,
);
return { events, buttons, rpcRequest, frame, message, cleanup };
}
@@ -22,16 +22,16 @@ function fixture(path = "/?auth=google") {
describe("reviewed external auth action", () => {
it("opens only the code-owned same-origin path after a host button click", async () => {
const f = fixture();
- f.events.get("message")?.({ source: f.frame.contentWindow, origin: "https://game.rahmanef.com", data: { type: "mso:app-auth-request", schemaVersion: 1, provider: "google", url: "https://attacker.test" } });
+ f.events.get("message")?.({ source: f.frame.contentWindow, origin: "https://game.example.com", data: { type: "mso:app-auth-request", schemaVersion: 1, provider: "google", url: "https://attacker.test" } });
expect(f.buttons[0].focus).toHaveBeenCalledOnce();
expect(f.rpcRequest).not.toHaveBeenCalled();
await f.buttons[0].click();
- expect(f.rpcRequest).toHaveBeenCalledExactlyOnceWith("ui/open-link", { url: "https://game.rahmanef.com/?auth=google" });
+ expect(f.rpcRequest).toHaveBeenCalledExactlyOnceWith("ui/open-link", { url: "https://game.example.com/?auth=google" });
expect(f.message.textContent).toContain("Preview sessions are separate");
});
it("ignores spoofed message sources, origins, providers and schema versions", () => {
const f = fixture();
- const base = { source: f.frame.contentWindow, origin: "https://game.rahmanef.com", data: { type: "mso:app-auth-request", schemaVersion: 1, provider: "google" } };
+ const base = { source: f.frame.contentWindow, origin: "https://game.example.com", data: { type: "mso:app-auth-request", schemaVersion: 1, provider: "google" } };
for (const event of [{ ...base, source: {} }, { ...base, origin: "https://attacker.test" }, { ...base, data: { ...base.data, schemaVersion: 99 } }, { ...base, data: { ...base.data, provider: "unknown" } }]) f.events.get("message")?.(event);
expect(f.buttons[0].focus).not.toHaveBeenCalled();
expect(f.rpcRequest).not.toHaveBeenCalled();
diff --git a/lib/mcp/ui-page-frame.ts b/lib/mcp/ui-page-frame.ts
index e11ada93..6df73500 100644
--- a/lib/mcp/ui-page-frame.ts
+++ b/lib/mcp/ui-page-frame.ts
@@ -1,32 +1,30 @@
-// A reviewed app must acknowledge readiness; iframe load alone also fires for blocked pages.
+// Configured iframe apps are bounded by an exact reviewed origin/start path.
+// Readiness is UX only: browser load/error updates the status; CSP/origin checks
+// remain the security boundary and do not depend on an app-specific message.
export const MSO_PAGE_FRAME_SCRIPT = String.raw`
function mountReviewedFrame(safe,stage){
const wrap=el("div","frame-wrap"),frame=document.createElement("iframe");
- const status=el("div","frame-status"),message=el("span","","Connecting to live production…");
+ const status=el("div","frame-status"),message=el("span","","Connecting to configured app…");
status.setAttribute("role","status");status.setAttribute("aria-live","polite");
const retry=button("Retry preview",()=>loadFrame());retry.hidden=true;
- const external=button("Open production ↗",()=>openProduction());
+ const external=button("Open app ↗",()=>openProduction());
status.append(message,retry,external);stage.content.append(status,wrap);
- frame.title=safe.title+" live demo";frame.setAttribute("sandbox",safe.sandbox);
+ frame.title=safe.title+" app";frame.setAttribute("sandbox",safe.sandbox);
frame.referrerPolicy="no-referrer";frame.allow="fullscreen; autoplay; gamepad; accelerometer; gyroscope";
wrap.append(frame);let timer=0,disposed=false;
const clearAuth=mountReviewedAuth(safe,frame,status,message);
- function unavailable(){if(disposed)return;wrap.dataset.state="unavailable";message.textContent="Preview did not confirm readiness. Retry or open production directly.";retry.hidden=false}
- function loadFrame(){clearTimeout(timer);wrap.dataset.state="loading";message.textContent="Connecting to live production…";retry.hidden=true;frame.src=safe.url;timer=setTimeout(unavailable,12000)}
- function ready(event){
- if(event.source!==frame.contentWindow||event.origin!==safe.origin)return;
- const data=event.data;if(!data||data.type!=="play-together:embed-ready"||data.schemaVersion!==1)return;
- clearTimeout(timer);wrap.dataset.state="ready";message.textContent="Production app ready";retry.hidden=true;
- }
+ function unavailable(){if(disposed)return;wrap.dataset.state="unavailable";message.textContent="Preview did not load. Retry or open the app directly.";retry.hidden=false}
+ function loaded(){if(disposed)return;clearTimeout(timer);wrap.dataset.state="ready";message.textContent="App loaded";retry.hidden=true}
+ function loadFrame(){clearTimeout(timer);wrap.dataset.state="loading";message.textContent="Connecting to configured app…";retry.hidden=true;frame.src=safe.url;timer=setTimeout(unavailable,12000)}
async function openProduction(){
try{
if(hostConnected)await rpcRequest("ui/open-link",{url:safe.origin});
else if(window.openai&&typeof window.openai.openExternal==="function")await window.openai.openExternal({href:safe.origin});
else throw new Error("Host external navigation is unavailable");
- }catch(_){message.textContent="Open production in your browser: "+safe.origin}
+ }catch(_){message.textContent="Open app in your browser: "+safe.origin}
}
- window.addEventListener("message",ready);frame.addEventListener("error",unavailable);
- viewCleanup=()=>{clearAuth();disposed=true;clearTimeout(timer);window.removeEventListener("message",ready);frame.removeEventListener("error",unavailable)};
+ frame.addEventListener("load",loaded);frame.addEventListener("error",unavailable);
+ viewCleanup=()=>{clearAuth();disposed=true;clearTimeout(timer);frame.removeEventListener("load",loaded);frame.removeEventListener("error",unavailable)};
loadFrame();
}
`;
diff --git a/lib/mcp/ui-page-lifecycle.test.ts b/lib/mcp/ui-page-lifecycle.test.ts
index f0cb8b27..dd91772f 100644
--- a/lib/mcp/ui-page-lifecycle.test.ts
+++ b/lib/mcp/ui-page-lifecycle.test.ts
@@ -21,8 +21,8 @@ describe("MCP Page lifecycle and cached resource migration", () => {
'appInfo:{name:"MSO Page",version:"3.0.0"}',
'method:"ui/notifications/initialized"',
'event.source!==window.parent',
- 'event.source!==frame.contentWindow||event.origin!==safe.origin',
- 'data.type!=="play-together:embed-ready"||data.schemaVersion!==1',
+ 'frame.addEventListener("load",loaded)',
+ 'frame.referrerPolicy="no-referrer"',
'if(key===lastOutputKey){',
'setTimeout(unavailable,12000)',
'hostMax*.48',
@@ -32,5 +32,6 @@ describe("MCP Page lifecycle and cached resource migration", () => {
expect(html).toContain('max-height:var(--inline-max-h)');
expect(html).toContain('html[data-display-mode="fullscreen"] .surface{height:100vh;height:100dvh');
expect(html).not.toContain('presentation:"fullscreen"');
+ expect(script).not.toContain('play-together:embed-ready');
});
});
diff --git a/lib/mcp/ui-resources.test.ts b/lib/mcp/ui-resources.test.ts
index 81982431..db838025 100644
--- a/lib/mcp/ui-resources.test.ts
+++ b/lib/mcp/ui-resources.test.ts
@@ -135,15 +135,15 @@ describe("MCP Apps Block and Page contract", () => {
expect(MSO_BLOCK_URI).toContain("block-v2.html");
});
- it("serves the full Page with a minimal reviewed nested-frame allowlist", async () => {
+ it("serves the full Page without external frame domains by default", async () => {
const read = await dispatch({ id: 30, method: "resources/read", params: { uri: MSO_PAGE_URI } }, "read", "mcp:ui-page");
const content = (read.result as { contents: Array<{ mimeType: string; text: string; _meta: Record<string, any> }> }).contents[0];
expect(content.mimeType).toBe(MCP_APP_MIME_TYPE);
expect(content.text).toContain("requestDisplayMode");
expect(content.text).toContain("setWidgetState");
expect(content.text).toContain("render_mso_page");
- expect(content.text).toContain("https://game.rahmanef.com");
- expect(content.text).toContain('"environment":"production"');
+ expect(content.text).not.toMatch(/rahmanef\.com|\/home\/rahman/);
+ expect(content.text).toContain("const SAFE_APPS=[]");
expect(content.text).toContain('app.environment+" · "+app.renderer');
expect(content.text).toContain("fetch(endpoint,");
expect(content.text).toContain('credentials:"omit"');
@@ -154,9 +154,9 @@ describe("MCP Apps Block and Page contract", () => {
expect(content._meta.ui.csp).toMatchObject({
connectDomains: [MSO_ORIGIN],
resourceDomains: [],
- frameDomains: ["https://game.rahmanef.com"],
});
- expect(content._meta["openai/widgetCSP"]).toEqual({ connect_domains: [MSO_ORIGIN], frame_domains: ["https://game.rahmanef.com"], redirect_domains: [MSO_ORIGIN, "https://game.rahmanef.com"] });
+ expect(content._meta.ui.csp.frameDomains).toBeUndefined();
+ expect(content._meta["openai/widgetCSP"]).toEqual({ connect_domains: [MSO_ORIGIN], redirect_domains: [MSO_ORIGIN] });
expect(MSO_PAGE_URI).toContain("page-v10.html");
});
diff --git a/lib/mcp/ui-surface-script.ts b/lib/mcp/ui-surface-script.ts
index 9aceaeb1..3eda201e 100644
--- a/lib/mcp/ui-surface-script.ts
+++ b/lib/mcp/ui-surface-script.ts
@@ -2,14 +2,17 @@ import { MSO_PAGE_INTEGRATIONS_SCRIPT } from "./ui-page-integrations";
import { MSO_PAGE_BRIDGE_SCRIPT } from "./ui-page-bridge";
import { MSO_PAGE_FRAME_SCRIPT } from "./ui-page-frame";
import { MSO_PAGE_AUTH_SCRIPT } from "./ui-page-auth";
-import { SURFACE_APPS } from "./surface-catalog";
+import { surfaceApps } from "./surface-catalog";
import { MSO_WIDGET_THEME_SCRIPT } from "./ui-widget-tokens";
function safeJson(value: unknown): string {
- return JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/&/g, "\\u0026");
+ return JSON.stringify(value)
+ .replace(/</g, "\\u003c")
+ .replace(/>/g, "\\u003e")
+ .replace(/&/g, "\\u0026");
}
-const BROWSER_CATALOG = SURFACE_APPS.map((app) => ({
+const BROWSER_CATALOG = surfaceApps().map((app) => ({
id: app.id,
title: app.title,
description: app.description,
diff --git a/lib/path.test.ts b/lib/path.test.ts
index 676213e2..2cb51285 100644
--- a/lib/path.test.ts
+++ b/lib/path.test.ts
@@ -7,18 +7,18 @@ import { joinPath, parentPath, baseName, extOf } from "./path";
describe("joinPath", () => {
it("joins without doubling or dropping a separator", () => {
- expect(joinPath("/home/rahman", "a.txt")).toBe("/home/rahman/a.txt");
+ expect(joinPath("/home/operator", "a.txt")).toBe("/home/operator/a.txt");
expect(joinPath("/", "a.txt")).toBe("/a.txt");
- expect(joinPath("/home/rahman/", "a.txt")).toBe("/home/rahman/a.txt");
- expect(joinPath("/home/rahman", "/a.txt")).toBe("/home/rahman/a.txt");
+ expect(joinPath("/home/operator/", "a.txt")).toBe("/home/operator/a.txt");
+ expect(joinPath("/home/operator", "/a.txt")).toBe("/home/operator/a.txt");
expect(joinPath("/home//", "//a.txt")).toBe("/home/a.txt");
});
});
describe("parentPath", () => {
it("walks up, and stops at the root instead of returning empty", () => {
- expect(parentPath("/home/rahman/a.txt")).toBe("/home/rahman");
- expect(parentPath("/home/rahman/")).toBe("/home");
+ expect(parentPath("/home/operator/a.txt")).toBe("/home/operator");
+ expect(parentPath("/home/operator/")).toBe("/home");
expect(parentPath("/home")).toBe("/");
expect(parentPath("/")).toBe("/");
});
diff --git a/ops/traefik/mso-ui.yml b/ops/traefik/mso-ui.yml
index f4b60e43..75d08c6a 100644
--- a/ops/traefik/mso-ui.yml
+++ b/ops/traefik/mso-ui.yml
@@ -1,17 +1,17 @@
# Dedicated MCP Apps sandbox origin for ChatGPT/OpenAI plugin UI.
-# This hostname is deliberately a sibling of mso.rahmanef.com so the cockpit's
-# OS_SESSION_COOKIE_DOMAIN=mso.rahmanef.com cookie is not sent to the widget origin.
+# This hostname is deliberately a sibling of mso.example.com so the cockpit's
+# OS_SESSION_COOKIE_DOMAIN=mso.example.com cookie is not sent to the widget origin.
http:
routers:
mso-ui-router:
- rule: Host(`mso-ui.rahmanef.com`)
+ rule: Host(`mso-ui.example.com`)
service: mso-ui-service
middlewares:
- redirect-to-https
entryPoints:
- web
mso-ui-router-websecure:
- rule: Host(`mso-ui.rahmanef.com`)
+ rule: Host(`mso-ui.example.com`)
service: mso-ui-service
middlewares: []
entryPoints:
diff --git a/package.json b/package.json
index 4ccf1f72..3b1b2863 100644
--- a/package.json
+++ b/package.json
@@ -13,7 +13,7 @@
"typecheck": "tsc --noEmit",
"test": "vitest run",
"coverage": "vitest run --coverage",
- "check": "node scripts/check-cycles.mjs && node scripts/check-architecture.mjs && node scripts/check-docs.mjs && node scripts/gen-comparison.mjs --check && node scripts/check-contrast.mjs && node scripts/check-skill-flows.mjs",
+ "check": "node scripts/check-cycles.mjs && node scripts/check-architecture.mjs && node scripts/check-docs.mjs && node scripts/gen-comparison.mjs --check && node scripts/check-contrast.mjs && node scripts/check-skill-flows.mjs && bun run check:instance-literals",
"audit": "node scripts/audit.mjs",
"verify": "bun run typecheck && bun run lint && bun run coverage && bun run check && bun run audit",
"security:ultimate": "bash scripts/security-ultimate.sh",
@@ -41,7 +41,8 @@
"mcp:catalog": "node scripts/gen-mcp-catalog.mjs",
"audit:strict": "node scripts/audit.mjs --strict",
"test:features": "node scripts/test-features.mjs",
- "screenshot:cli": "node scripts/capture-cli.mjs"
+ "screenshot:cli": "node scripts/capture-cli.mjs",
+ "check:instance-literals": "bun scripts/check-instance-literals.mjs"
},
"dependencies": {
"@anthropic-ai/sdk": "^0.120.0",
diff --git a/proxy-machine-protocol.test.ts b/proxy-machine-protocol.test.ts
index 1b55727a..6f0656ff 100644
--- a/proxy-machine-protocol.test.ts
+++ b/proxy-machine-protocol.test.ts
@@ -1,7 +1,7 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { NextRequest } from "next/server";
-const TEMPLATE = "{id}.mso.rahmanef.com";
+const TEMPLATE = "{id}.mso.example.com";
async function loadProxy(template: string) {
vi.resetModules();
@@ -25,15 +25,15 @@ afterEach(() => {
vi.unstubAllEnvs();
});
-// The session cookie is widened to Domain=mso.rahmanef.com, so ANY host under that
+// The session cookie is widened to Domain=mso.example.com, so ANY host under that
// name receives it. A host in the namespace that is not one of the apps must
// therefore 404 rather than serve the cockpit — otherwise adding a DNS record is
// enough to hand a page a fully authenticated cockpit, with no code change at all.
describe("an unclaimed host inside the app namespace serves nothing", () => {
it.each([
- "staging.mso.rahmanef.com",
- "deep.sub.mso.rahmanef.com",
- "xhermes.mso.rahmanef.com",
+ "staging.mso.example.com",
+ "deep.sub.mso.example.com",
+ "xhermes.mso.example.com",
])("404s %s", async (host) => {
const proxy = await loadProxy(TEMPLATE);
for (const path of [
@@ -51,15 +51,15 @@ describe("an unclaimed host inside the app namespace serves nothing", () => {
it("refuses only the namespace: the cockpit, its siblings and single-origin mode all still serve", async () => {
const split = await loadProxy(TEMPLATE);
for (const host of [
- "mso.rahmanef.com",
- "api-mso.rahmanef.com",
+ "mso.example.com",
+ "api-mso.example.com",
"rahmanef.com",
]) {
expect((await split(req(host, "/files"))).status).toBe(200);
}
const single = await loadProxy("");
expect(
- (await single(req("staging.mso.rahmanef.com", "/files"))).status,
+ (await single(req("staging.mso.example.com", "/files"))).status,
).toBe(200);
});
});
@@ -67,7 +67,7 @@ describe("an unclaimed host inside the app namespace serves nothing", () => {
describe("single-origin mode (template unset) is unchanged", () => {
it("stamps a nonce + document policy on a page", async () => {
const proxy = await loadProxy("");
- const res = await proxy(req("mso.rahmanef.com", "/files"));
+ const res = await proxy(req("mso.example.com", "/files"));
const csp = res.headers.get("content-security-policy")!;
expect(csp).toContain("frame-ancestors 'none'");
expect(csp).toMatch(/script-src 'self' 'nonce-[^']+' 'strict-dynamic'/);
@@ -81,7 +81,7 @@ describe("single-origin mode (template unset) is unchanged", () => {
"/_next/image?url=%2Fx.png",
"/favicon.ico",
]) {
- const res = await proxy(req("mso.rahmanef.com", path));
+ const res = await proxy(req("mso.example.com", path));
expect(res.status).toBe(200);
expect(res.headers.get("content-security-policy")).toBeNull();
expect(res.headers.get("x-middleware-request-x-nonce")).toBeNull();
@@ -90,20 +90,20 @@ describe("single-origin mode (template unset) is unchanged", () => {
it("never treats an app-shaped host as an app host", async () => {
const proxy = await loadProxy("");
- const res = await proxy(req("hermes.mso.rahmanef.com", "/"));
+ const res = await proxy(req("hermes.mso.example.com", "/"));
expect(rewriteOf(res)).toBeNull();
});
it("still blocks a cross-site mutating /api and leaves reads alone", async () => {
const proxy = await loadProxy("");
const blocked = await proxy(
- req("mso.rahmanef.com", "/api/v1/exec/run", {
+ req("mso.example.com", "/api/v1/exec/run", {
method: "POST",
headers: { "sec-fetch-site": "cross-site" },
}),
);
expect(blocked.status).toBe(403);
- const read = await proxy(req("mso.rahmanef.com", "/api/v1/sys/status"));
+ const read = await proxy(req("mso.example.com", "/api/v1/sys/status"));
expect(read.status).toBe(200);
expect(read.headers.get("content-security-policy")).toBeNull();
});
@@ -111,7 +111,7 @@ describe("single-origin mode (template unset) is unchanged", () => {
it("treats A2A discovery and protocol routes as machine surfaces, not documents", async () => {
const proxy = await loadProxy("");
for (const path of ["/.well-known/agent-card.json", "/a2a/v1"]) {
- const res = await proxy(req("mso.rahmanef.com", path));
+ const res = await proxy(req("mso.example.com", path));
expect(res.status).toBe(200);
expect(res.headers.get("content-security-policy")).toBeNull();
expect(res.headers.get("x-middleware-request-x-nonce")).toBeNull();
@@ -121,7 +121,7 @@ describe("single-origin mode (template unset) is unchanged", () => {
it("lets remote bearer-authenticated A2A POST reach the route while keeping owner A2A management CSRF-protected", async () => {
const proxy = await loadProxy("");
const protocol = await proxy(
- req("mso.rahmanef.com", "/a2a/v1", {
+ req("mso.example.com", "/a2a/v1", {
method: "POST",
headers: { "sec-fetch-site": "cross-site" },
body: JSON.stringify({
@@ -136,7 +136,7 @@ describe("single-origin mode (template unset) is unchanged", () => {
expect(protocol.headers.get("content-security-policy")).toBeNull();
const management = await proxy(
- req("mso.rahmanef.com", "/api/v1/a2a", {
+ req("mso.example.com", "/api/v1/a2a", {
method: "POST",
headers: { "sec-fetch-site": "cross-site" },
body: JSON.stringify({ action: "state" }),
@@ -151,7 +151,7 @@ describe("single-origin mode (template unset) is unchanged", () => {
it("does not let an unverified cookie near the camoufox VNC bridge", async () => {
const proxy = await loadProxy("");
const res = await proxy(
- req("mso.rahmanef.com", "/camoufox-vnc/", {
+ req("mso.example.com", "/camoufox-vnc/", {
headers: { cookie: "session=anything" },
}),
);
diff --git a/proxy-websocket.test.ts b/proxy-websocket.test.ts
index a613fa97..2edc4f09 100644
--- a/proxy-websocket.test.ts
+++ b/proxy-websocket.test.ts
@@ -13,7 +13,7 @@ vi.mock("@/lib/auth/device-store", () => ({
: null,
}));
-const TEMPLATE = "{id}.mso.rahmanef.com";
+const TEMPLATE = "{id}.mso.example.com";
/** Env is read at module load, so each case needs a fresh module graph. */
async function loadProxy(template: string) {
@@ -62,7 +62,7 @@ describe("WebSocket upgrade on an app host", () => {
it("hands an authenticated upgrade to the app's own loopback gateway", async () => {
const proxy = await load();
- const res = await proxy(upgradeReq("openclaw.mso.rahmanef.com", "/chat?tab=1", session()));
+ const res = await proxy(upgradeReq("openclaw.mso.example.com", "/chat?tab=1", session()));
// Cross-origin destination = Next proxies it; that fork IS the transport.
expect(rewriteOf(res)).toBe(`${GATEWAY}/chat?tab=1`);
});
@@ -70,24 +70,24 @@ describe("WebSocket upgrade on an app host", () => {
it("requires operator or owner for a managed-app upgrade", async () => {
const proxy = await load();
approved.role = "viewer";
- expect((await proxy(upgradeReq("openclaw.mso.rahmanef.com", "/chat", session()))).status).toBe(404);
+ expect((await proxy(upgradeReq("openclaw.mso.example.com", "/chat", session()))).status).toBe(404);
approved.role = "operator";
- expect(rewriteOf(await proxy(upgradeReq("openclaw.mso.rahmanef.com", "/chat", session())))).toBe(`${GATEWAY}/chat`);
+ expect(rewriteOf(await proxy(upgradeReq("openclaw.mso.example.com", "/chat", session())))).toBe(`${GATEWAY}/chat`);
});
it("refuses an upgrade carrying no session — nothing downstream would have", async () => {
const proxy = await load();
- const res = await proxy(upgradeReq("openclaw.mso.rahmanef.com"));
+ const res = await proxy(upgradeReq("openclaw.mso.example.com"));
expect(res.status).toBe(404);
expect(rewriteOf(res)).toBeNull();
});
it("refuses a forged cookie, and a real one whose device was revoked", async () => {
const proxy = await load();
- expect((await proxy(upgradeReq("openclaw.mso.rahmanef.com", "/", "not-a-real-cookie"))).status).toBe(404);
+ expect((await proxy(upgradeReq("openclaw.mso.example.com", "/", "not-a-real-cookie"))).status).toBe(404);
// Valid HMAC is not enough: revoking a device must kill its live sockets too.
approved.value = false;
- expect((await proxy(upgradeReq("openclaw.mso.rahmanef.com", "/", session()))).status).toBe(404);
+ expect((await proxy(upgradeReq("openclaw.mso.example.com", "/", session()))).status).toBe(404);
});
it("refuses to relay off-box when the gateway env points somewhere public", async () => {
@@ -95,12 +95,12 @@ describe("WebSocket upgrade on an app host", () => {
vi.stubEnv("OS_SESSION_SECRET", SECRET);
approved.value = true;
const proxy = await loadProxy(TEMPLATE);
- expect((await proxy(upgradeReq("openclaw.mso.rahmanef.com", "/", session()))).status).toBe(404);
+ expect((await proxy(upgradeReq("openclaw.mso.example.com", "/", session()))).status).toBe(404);
});
it("leaves the cockpit host alone — the branch is app-hosts only", async () => {
const proxy = await load();
- const res = await proxy(upgradeReq("mso.rahmanef.com", "/apps", session()));
+ const res = await proxy(upgradeReq("mso.example.com", "/apps", session()));
// Not merely "not the gateway" — the cockpit is not rewritten at all, so a
// session-bearing upgrade there can never become a relay into an agent.
expect(rewriteOf(res)).toBeNull();
@@ -109,7 +109,7 @@ describe("WebSocket upgrade on an app host", () => {
it("does not fire for an ordinary request that merely mentions upgrade", async () => {
const proxy = await load();
const res = await proxy(
- req("openclaw.mso.rahmanef.com", "/chat", { upgrade: "h2c", cookie: `session=${session()}` }),
+ req("openclaw.mso.example.com", "/chat", { upgrade: "h2c", cookie: `session=${session()}` }),
);
expect(rewriteOf(res)).toContain("/api/v1/managed-apps/openclaw/proxy");
});
@@ -145,13 +145,13 @@ describe("per-app upgrade adapters", () => {
it("never relays the cockpit session cookie into an agent process", async () => {
// OS_SESSION_COOKIE_DOMAIN widens that cookie to the app hosts, so the browser
// sends it here. The HTTP path has always stripped it; the upgrade did not.
- for (const host of ["hermes.mso.rahmanef.com", "openclaw.mso.rahmanef.com"]) {
+ for (const host of ["hermes.mso.example.com", "openclaw.mso.example.com"]) {
expect((await upstream(host, "/")).header("cookie")).toBeNull();
}
});
it("presents Hermes the loopback Host/Origin its rebinding guard demands", async () => {
- const { rewrite, header } = await upstream("hermes.mso.rahmanef.com", "/api/pty?ticket=t1&channel=c");
+ const { rewrite, header } = await upstream("hermes.mso.example.com", "/api/pty?ticket=t1&channel=c");
expect(rewrite).toBe("http://127.0.0.1:9119/api/pty?ticket=t1&channel=c");
// This assertion used to be the exact opposite, on the premise that Hermes binds
// 0.0.0.0 and accepts any Origin. It binds 127.0.0.1, and FastAPI runs no HTTP
@@ -167,13 +167,13 @@ describe("per-app upgrade adapters", () => {
});
it("presents OpenClaw the REAL browser origin, so an allowlist entry can match it", async () => {
- const { rewrite, header } = await upstream("openclaw.mso.rahmanef.com", "/chat");
+ const { rewrite, header } = await upstream("openclaw.mso.example.com", "/chat");
expect(rewrite).toBe("http://127.0.0.1:18789/chat");
// Rewriting this to the loopback origin looked like consistency with the HTTP
// path and was the opposite of a fix: OpenClaw matches its allowedOrigins against
// the origin AS PRESENTED, so a rewritten one is exactly what would stop the
// operator adding this host to that list from working.
- expect(header("origin")).toBe("https://openclaw.mso.rahmanef.com");
+ expect(header("origin")).toBe("https://openclaw.mso.example.com");
});});
// The Camoufox VNC bridge — noVNC over websockify in front of x11vnc, i.e. live
@@ -184,7 +184,7 @@ describe("per-app upgrade adapters", () => {
describe("the Camoufox split-origin VNC bridge", () => {
const SECRET = "y".repeat(48);
const NOVNC = "http://127.0.0.1:6080";
- const VIEWER_HOST = "camoufox.mso.rahmanef.com";
+ const VIEWER_HOST = "camoufox.mso.example.com";
function session(secret = SECRET): string {
const now = Date.now();
@@ -193,7 +193,7 @@ describe("the Camoufox split-origin VNC bridge", () => {
async function load(novnc = NOVNC) {
vi.stubEnv("OS_SESSION_SECRET", SECRET);
- vi.stubEnv("OS_PUBLIC_ORIGIN", "https://mso.rahmanef.com");
+ vi.stubEnv("OS_PUBLIC_ORIGIN", "https://mso.example.com");
vi.stubEnv("CAMOUFOX_NOVNC_URL", novnc);
approved.value = true;
approved.role = "owner";
@@ -228,7 +228,7 @@ describe("the Camoufox split-origin VNC bridge", () => {
const target = new URL(rewriteOf(res)!);
expect(target.origin).toBe(NOVNC);
expect(target.pathname).toBe("/vnc_lite.html");
- expect(res.headers.get("content-security-policy")).toContain("frame-ancestors https://mso.rahmanef.com");
+ expect(res.headers.get("content-security-policy")).toContain("frame-ancestors https://mso.example.com");
expect(res.headers.get("referrer-policy")).toBe("no-referrer");
});
@@ -270,7 +270,7 @@ describe("the Camoufox split-origin VNC bridge", () => {
it("never exposes the old same-origin cockpit bridge", async () => {
const proxy = await load();
- const res = await proxy(req("mso.rahmanef.com", "/camoufox-vnc/vnc.html", { cookie: `session=${session()}` }));
+ const res = await proxy(req("mso.example.com", "/camoufox-vnc/vnc.html", { cookie: `session=${session()}` }));
expect(res.status).toBe(404);
expect(rewriteOf(res)).toBeNull();
});
diff --git a/proxy.test.ts b/proxy.test.ts
index c99602d6..73951d0a 100644
--- a/proxy.test.ts
+++ b/proxy.test.ts
@@ -10,7 +10,7 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { NextRequest } from "next/server";
-const TEMPLATE = "{id}.mso.rahmanef.com";
+const TEMPLATE = "{id}.mso.example.com";
const HERMES = "/api/v1/managed-apps/hermes/proxy";
const APP_HOST_HEADER = "x-os-managed-app-host";
@@ -50,23 +50,23 @@ describe("app host → that app's proxy, and nothing else", () => {
["/sessions/", `${HERMES}/sessions`],
])("rewrites %s into the proxy", async (path, expected) => {
const proxy = await loadProxy(TEMPLATE);
- const res = await proxy(req("hermes.mso.rahmanef.com", path));
+ const res = await proxy(req("hermes.mso.example.com", path));
expect(new URL(rewriteOf(res)!).pathname).toBe(expected);
});
it("preserves the query string", async () => {
const proxy = await loadProxy(TEMPLATE);
const res = await proxy(
- req("hermes.mso.rahmanef.com", "/login?next=%2Fchat"),
+ req("hermes.mso.example.com", "/login?next=%2Fchat"),
);
expect(rewriteOf(res)).toBe(
- `https://hermes.mso.rahmanef.com${HERMES}/login?next=%2Fchat`,
+ `https://hermes.mso.example.com${HERMES}/login?next=%2Fchat`,
);
});
it("routes each host to its OWN app — one origin per app, never a shared one", async () => {
const proxy = await loadProxy(TEMPLATE);
- const res = await proxy(req("openclaw.mso.rahmanef.com", "/chat"));
+ const res = await proxy(req("openclaw.mso.example.com", "/chat"));
expect(new URL(rewriteOf(res)!).pathname).toBe(
"/api/v1/managed-apps/openclaw/proxy/chat",
);
@@ -86,7 +86,7 @@ describe("app host → that app's proxy, and nothing else", () => {
async (_label, path) => {
const proxy = await loadProxy(TEMPLATE);
const res = await proxy(
- req("hermes.mso.rahmanef.com", path, {
+ req("hermes.mso.example.com", path, {
headers: { "sec-fetch-site": "same-origin" },
}),
);
@@ -106,7 +106,7 @@ describe("app host → that app's proxy, and nothing else", () => {
"/_next",
])("404s %s on an app host", async (path) => {
const proxy = await loadProxy(TEMPLATE);
- const res = await proxy(req("hermes.mso.rahmanef.com", path));
+ const res = await proxy(req("hermes.mso.example.com", path));
expect(res.status).toBe(404);
expect(rewriteOf(res)).toBeNull();
});
@@ -116,14 +116,14 @@ describe("app host → that app's proxy, and nothing else", () => {
const proxy = await loadProxy(TEMPLATE);
expect(
new URL(
- rewriteOf(await proxy(req("hermes.mso.rahmanef.com", "/favicon.ico")))!,
+ rewriteOf(await proxy(req("hermes.mso.example.com", "/favicon.ico")))!,
).pathname,
).toBe(`${HERMES}/favicon.ico`);
});
it("never stamps the cockpit document policy on an app host", async () => {
const proxy = await loadProxy(TEMPLATE);
- const res = await proxy(req("hermes.mso.rahmanef.com", "/"));
+ const res = await proxy(req("hermes.mso.example.com", "/"));
// The route sets its own, scoped to the app origin — see proxy-csp.ts.
expect(res.headers.get("content-security-policy")).toBeNull();
expect(res.headers.get("x-middleware-request-x-nonce")).toBeNull();
@@ -134,7 +134,7 @@ describe("app host → that app's proxy, and nothing else", () => {
// Forged, it would buy root-mounted mode: upstream cookies at Path=/ and a
// policy naming the cockpit as a legal framer.
const res = await proxy(
- req("hermes.mso.rahmanef.com", "/", {
+ req("hermes.mso.example.com", "/", {
headers: { [APP_HOST_HEADER]: "openclaw" },
}),
);
@@ -143,7 +143,7 @@ describe("app host → that app's proxy, and nothing else", () => {
it("leaves a host that is not an app host on the cockpit", async () => {
const proxy = await loadProxy(TEMPLATE);
- const res = await proxy(req("mso.rahmanef.com", "/apps"));
+ const res = await proxy(req("mso.example.com", "/apps"));
expect(rewriteOf(res)).toBeNull();
expect(res.headers.get("content-security-policy")).toContain(
"default-src 'self'",
@@ -156,10 +156,10 @@ describe("app host → that app's proxy, and nothing else", () => {
// host and claims the cockpit, which would reach /api/v1/exec with a session
// cookie that IS sent here.
const res = await proxy(
- req("hermes.mso.rahmanef.com", "/api/v1/exec/run", {
+ req("hermes.mso.example.com", "/api/v1/exec/run", {
method: "POST",
headers: {
- "x-forwarded-host": "mso.rahmanef.com",
+ "x-forwarded-host": "mso.example.com",
"sec-fetch-site": "same-origin",
},
}),
@@ -174,7 +174,7 @@ describe("CSRF depth-2 on an app host", () => {
it("passes the frame's own same-origin form POST", async () => {
const proxy = await loadProxy(TEMPLATE);
const res = await proxy(
- req("hermes.mso.rahmanef.com", "/auth/password-login", {
+ req("hermes.mso.example.com", "/auth/password-login", {
method: "POST",
headers: { "sec-fetch-site": "same-origin" },
}),
@@ -191,7 +191,7 @@ describe("CSRF depth-2 on an app host", () => {
])("blocks a mutating request from %s", async (_label, site) => {
const proxy = await loadProxy(TEMPLATE);
const res = await proxy(
- req("hermes.mso.rahmanef.com", "/api/tasks", {
+ req("hermes.mso.example.com", "/api/tasks", {
method: "POST",
headers: { "sec-fetch-site": site },
}),
@@ -203,14 +203,14 @@ describe("CSRF depth-2 on an app host", () => {
it("falls back to an Origin host match for non-browser clients", async () => {
const proxy = await loadProxy(TEMPLATE);
const ok = await proxy(
- req("hermes.mso.rahmanef.com", "/api/tasks", {
+ req("hermes.mso.example.com", "/api/tasks", {
method: "POST",
- headers: { origin: "https://hermes.mso.rahmanef.com" },
+ headers: { origin: "https://hermes.mso.example.com" },
}),
);
expect(rewriteOf(ok)).not.toBeNull();
const bad = await proxy(
- req("hermes.mso.rahmanef.com", "/api/tasks", {
+ req("hermes.mso.example.com", "/api/tasks", {
method: "POST",
headers: { origin: "https://evil.example" },
}),
@@ -221,7 +221,7 @@ describe("CSRF depth-2 on an app host", () => {
it("still routes a GET, which mutates nothing", async () => {
const proxy = await loadProxy(TEMPLATE);
const res = await proxy(
- req("hermes.mso.rahmanef.com", "/chat", {
+ req("hermes.mso.example.com", "/chat", {
headers: { "sec-fetch-site": "cross-site" },
}),
);
@@ -238,7 +238,7 @@ describe("the app-host header is never accepted from a client", () => {
// at the old same-origin URL — cookies at Path=/ and the cockpit named as a
// permitted framer, i.e. exactly the hole the split closes.
const res = await proxy(
- req("mso.rahmanef.com", `${HERMES}/chat`, {
+ req("mso.example.com", `${HERMES}/chat`, {
headers: { [APP_HOST_HEADER]: "hermes" },
}),
);
@@ -252,7 +252,7 @@ describe("the app-host header is never accepted from a client", () => {
it("strips it from a cockpit document request too", async () => {
const proxy = await loadProxy(TEMPLATE);
const res = await proxy(
- req("mso.rahmanef.com", "/apps", {
+ req("mso.example.com", "/apps", {
headers: { [APP_HOST_HEADER]: "hermes" },
}),
);
diff --git a/proxy.ts b/proxy.ts
index e28228a2..8ee03af1 100644
--- a/proxy.ts
+++ b/proxy.ts
@@ -3,7 +3,7 @@
// NEXT_PUBLIC_MANAGED_APP_HOST_TEMPLATE) EVERY path is rewritten into that
// app's proxy route, so the dashboard is root-mounted at "/" on its own origin
// and the cockpit — pages, /api/v1/exec, /api/auth/* — does not exist there.
-// That gating is what makes the widened session cookie (Domain=mso.rahmanef.com)
+// That gating is what makes the widened session cookie (Domain=mso.example.com)
// safe to hand to those hosts.
// 2. CSRF depth-2 for mutating /api — every /api route already verifies the
// signed session cookie via requireSession(); this adds the second factor
@@ -211,7 +211,7 @@ export async function proxy(request: NextRequest) {
return NextResponse.rewrite(new URL(ingress.target));
}
- // A host inside the app namespace that is NOT an app (a new `X.mso.rahmanef.com`
+ // A host inside the app namespace that is NOT an app (a new `X.mso.example.com`
// record, or a `*.os` wildcard) must not serve the cockpit: the session cookie is
// widened to that name, so such a host would be same-origin with a fully
// authenticated cockpit — the reach the split exists to remove, re-opened by a DNS
diff --git a/scripts/camoufox-vnc-service b/scripts/camoufox-vnc-service
index c4167509..2910a070 100755
--- a/scripts/camoufox-vnc-service
+++ b/scripts/camoufox-vnc-service
@@ -17,7 +17,14 @@ PROFILE="${CAMOUFOX_PROFILE:-$HOME/.local/share/camoufox/profiles/linkedin}"
# browser.startup.page=3 restores the tabs and stops there — the restored tabs come back
# unloaded, so the landing state costs nothing until something is clicked.
URL="${CAMOUFOX_START_URL:-}"
-BROWSER="${CAMOUFOX_BROWSER:-/home/rahman/.cache/camoufox/browsers/official/152.0.4-beta.28-924f3109/camoufox}"
+BROWSER="${CAMOUFOX_BROWSER:-}"
+if [ -z "$BROWSER" ]; then
+ BROWSER="$(find "$HOME/.cache/camoufox/browsers" -type f -name camoufox -perm -u+x 2>/dev/null | sort | tail -1)"
+fi
+if [ -z "$BROWSER" ] || [ ! -x "$BROWSER" ]; then
+ echo "camoufox-vnc: no executable browser found; set CAMOUFOX_BROWSER or install Camoufox" >&2
+ exit 1
+fi
mkdir -p "$PROFILE"
# 0700, enforced every start. What is in here is a live Google session (SID,
diff --git a/scripts/check-instance-literals.mjs b/scripts/check-instance-literals.mjs
new file mode 100644
index 00000000..39b1f375
--- /dev/null
+++ b/scripts/check-instance-literals.mjs
@@ -0,0 +1,24 @@
+import { execFileSync } from "node:child_process";
+
+// Keep operator-instance identities out of the portable/public repository. Build
+// these strings from fragments so the guard does not exempt itself by accident.
+const forbidden = [
+ ["mso", "rahmanef", "com"].join("."),
+ ["mso-ui", "rahmanef", "com"].join("."),
+ ["game", "rahmanef", "com"].join("."),
+ ["", "home", "rahman"].join("/"),
+];
+const candidates = execFileSync("git", ["ls-files", "--cached", "--others", "--exclude-standard"], { encoding: "utf8" })
+ .split("\n").filter(Boolean)
+ .filter((file) => !file.startsWith("coverage/") && !file.startsWith(".next/"));
+const hits = [];
+for (const file of candidates) {
+ let text;
+ try { text = await Bun.file(file).text(); } catch { continue; }
+ for (const literal of forbidden) if (text.toLowerCase().includes(literal.toLowerCase())) hits.push(`${file}: ${literal}`);
+}
+if (hits.length) {
+ console.error("Forbidden operator-instance literals in portable/public source:\n" + hits.join("\n"));
+ process.exit(1);
+}
+console.log(`instance literal guard passed (${candidates.length} files scanned)`);
diff --git a/scripts/e2e/integrations.mjs b/scripts/e2e/integrations.mjs
index a2d193f7..aef6ff4a 100644
--- a/scripts/e2e/integrations.mjs
+++ b/scripts/e2e/integrations.mjs
@@ -15,7 +15,7 @@ let checks=0;
try{
const page=await browser.newPage();
const errors=[];page.on("pageerror",error=>errors.push(error.message));
- await page.route("https://mso.rahmanef.com/**",route=>{
+ await page.route("https://mso.example.com/**",route=>{
const url=new URL(route.request().url());
if(url.pathname==="/integrations")return route.fulfill({contentType:"text/html",body:html});
if(url.pathname==="/api/auth/me")return route.fulfill({json:{role:"owner"}});
@@ -23,7 +23,7 @@ try{
if(url.pathname==="/api/v1/integrations")return route.fulfill({json:{ok:true,detail:"Connected to GitHub"}});
return route.fulfill({status:404,json:{error:"unhandled_fixture"}});
});
- await page.goto("https://mso.rahmanef.com/integrations");
+ await page.goto("https://mso.example.com/integrations");
await page.getByRole("heading",{name:"Delivery GitHub"}).waitFor();
for(const width of [320,390,768,1440,1920]){
await page.setViewportSize({width,height:900});
diff --git a/scripts/e2e/mcp-page.mjs b/scripts/e2e/mcp-page.mjs
index 85254844..1f9adeba 100644
--- a/scripts/e2e/mcp-page.mjs
+++ b/scripts/e2e/mcp-page.mjs
@@ -9,7 +9,7 @@ const { chromium } = require(path.join(process.cwd(), "os-browser/node_modules/p
const resource = JSON.parse(execFileSync("bun", ["-e", 'import { MSO_PAGE_RESOURCE } from "./lib/mcp/ui-surface"; console.log(JSON.stringify(MSO_PAGE_RESOURCE))'], { encoding: "utf8" }));
const output = {
route: "/apps/play-together", kind: "app", title: "Play Together", openPath: "/assistant/mcp", catalog: [],
- app: { id: "play-together", url: "https://game.rahmanef.com/embed" },
+ app: { id: "play-together", url: "https://game.example.com/embed" },
};
const browser = await chromium.launch({ executablePath: process.env.CHROME_PATH ?? "/usr/bin/google-chrome", args: ["--no-sandbox", "--disable-dev-shm-usage"] });
let assertions = 0;
@@ -18,37 +18,37 @@ try {
const page = await browser.newPage({ viewport: { width: legacy ? 390 : 1280, height: 800 } });
await page.clock.install();
let childLoads = 0;
- await page.route("https://game.rahmanef.com/embed", (route) => {
+ await page.route("https://game.example.com/embed", (route) => {
childLoads++;
return route.fulfill({ contentType: "text/html", body: "<!doctype html><title>Controlled game readiness fixture</title><main>Fixture game shell</main>" });
});
- await page.route("https://mso-ui.rahmanef.com/qa", (route) => route.fulfill({ contentType: "text/html", body: `${legacy ? `<script>window.openai={toolOutput:${JSON.stringify({ structuredContent: output })}}</script>` : ""}${resource.text}` }));
+ await page.route("https://mso-ui.example.com/qa", (route) => route.fulfill({ contentType: "text/html", body: `${legacy ? `<script>window.openai={toolOutput:${JSON.stringify({ structuredContent: output })}}</script>` : ""}${resource.text}` }));
await page.route("https://chatgpt.com/qa", (route) => route.fulfill({ contentType: "text/html", body: `<!doctype html><script>
window.calls=[];window.result=${JSON.stringify(output)};
window.addEventListener("message",event=>{
const msg=event.data;if(!msg||msg.jsonrpc!=="2.0")return;calls.push(msg);
const frame=document.querySelector("iframe").contentWindow;
- if(msg.method==="ui/initialize"&&!${legacy})frame.postMessage({jsonrpc:"2.0",id:msg.id,result:{protocolVersion:"2026-01-26",hostCapabilities:{serverTools:{},openLinks:{}},hostContext:{displayMode:"inline",maxHeight:800}}},"https://mso-ui.rahmanef.com");
+ if(msg.method==="ui/initialize"&&!${legacy})frame.postMessage({jsonrpc:"2.0",id:msg.id,result:{protocolVersion:"2026-01-26",hostCapabilities:{serverTools:{},openLinks:{}},hostContext:{displayMode:"inline",maxHeight:800}}},"https://mso-ui.example.com");
if(msg.method==="ui/notifications/initialized"){
- frame.postMessage({jsonrpc:"2.0",method:"ui/notifications/tool-input",params:{arguments:{route:result.route}}},"https://mso-ui.rahmanef.com");
- frame.postMessage({jsonrpc:"2.0",method:"ui/notifications/tool-result",params:{structuredContent:result}},"https://mso-ui.rahmanef.com");
+ frame.postMessage({jsonrpc:"2.0",method:"ui/notifications/tool-input",params:{arguments:{route:result.route}}},"https://mso-ui.example.com");
+ frame.postMessage({jsonrpc:"2.0",method:"ui/notifications/tool-result",params:{structuredContent:result}},"https://mso-ui.example.com");
}
if(msg.method==="ui/notifications/size-changed")document.querySelector("iframe").style.height=msg.params.height+"px";
- if(msg.method==="ui/open-link")frame.postMessage({jsonrpc:"2.0",id:msg.id,result:{}},"https://mso-ui.rahmanef.com");
- });</script><iframe src="https://mso-ui.rahmanef.com/qa" style="width:100%;height:740px"></iframe>` }));
+ if(msg.method==="ui/open-link")frame.postMessage({jsonrpc:"2.0",id:msg.id,result:{}},"https://mso-ui.example.com");
+ });</script><iframe src="https://mso-ui.example.com/qa" style="width:100%;height:740px"></iframe>` }));
await page.goto("https://chatgpt.com/qa");
- const component = page.frameLocator('iframe[src="https://mso-ui.rahmanef.com/qa"]');
+ const component = page.frameLocator('iframe[src="https://mso-ui.example.com/qa"]');
await component.locator('.frame-wrap[data-state="loading"]').waitFor();
assert.equal(childLoads, 1); assertions++;
assert.equal(await component.locator("iframe").count(), 1, "one Page document must mount exactly one reviewed app frame"); assertions++;
if (!legacy) {
await page.waitForTimeout(50);
- const hostHeight = await page.locator('iframe[src="https://mso-ui.rahmanef.com/qa"]').evaluate((node) => node.getBoundingClientRect().height);
+ const hostHeight = await page.locator('iframe[src="https://mso-ui.example.com/qa"]').evaluate((node) => node.getBoundingClientRect().height);
assert(hostHeight < 400, `inline Page must stay below 50% of the 800px host viewport, got ${hostHeight}`); assertions++;
assert.equal(await component.locator("#surface-mode").textContent(), "inline"); assertions++;
}
- const widget = page.frames().find((frame) => frame.url() === "https://mso-ui.rahmanef.com/qa");
- const game = page.frames().find((frame) => frame.url() === "https://game.rahmanef.com/embed");
+ const widget = page.frames().find((frame) => frame.url() === "https://mso-ui.example.com/qa");
+ const game = page.frames().find((frame) => frame.url() === "https://game.example.com/embed");
assert(widget && game);
if (!legacy) {
const calls = await page.evaluate(() => window.calls);
@@ -57,37 +57,37 @@ try {
assert.deepEqual(calls[0].params.appCapabilities.availableDisplayModes, ["inline", "fullscreen", "pip"]);
assert(calls.some((call) => call.method === "ui/notifications/initialized")); assertions++;
}
- await widget.evaluate(() => window.dispatchEvent(new MessageEvent("message", { origin: "https://game.rahmanef.com", source: window, data: { type: "play-together:embed-ready", schemaVersion: 1 } })));
+ await widget.evaluate(() => window.dispatchEvent(new MessageEvent("message", { origin: "https://game.example.com", source: window, data: { type: "play-together:embed-ready", schemaVersion: 1 } })));
assert.equal(await component.locator(".frame-wrap").getAttribute("data-state"), "loading"); assertions++;
- await game.evaluate(() => parent.postMessage({ type: "play-together:embed-ready", schemaVersion: 99 }, "https://mso-ui.rahmanef.com"));
+ await game.evaluate(() => parent.postMessage({ type: "play-together:embed-ready", schemaVersion: 99 }, "https://mso-ui.example.com"));
assert.equal(await component.locator(".frame-wrap").getAttribute("data-state"), "loading"); assertions++;
await page.clock.fastForward(13000);
await component.locator('.frame-wrap[data-state="unavailable"]').waitFor();
await component.getByRole("button", { name: "Retry preview" }).click();
await component.locator('.frame-wrap[data-state="loading"]').waitFor();
await page.waitForTimeout(50);
- const reloaded = page.frames().find((frame) => frame.url() === "https://game.rahmanef.com/embed");
+ const reloaded = page.frames().find((frame) => frame.url() === "https://game.example.com/embed");
assert(reloaded); assertions++;
- await reloaded.evaluate(() => parent.postMessage({ type: "play-together:embed-ready", schemaVersion: 1 }, "https://mso-ui.rahmanef.com"));
+ await reloaded.evaluate(() => parent.postMessage({ type: "play-together:embed-ready", schemaVersion: 1 }, "https://mso-ui.example.com"));
await component.locator('.frame-wrap[data-state="ready"]').waitFor(); assertions++;
const previousLoads = childLoads;
- await page.evaluate(() => document.querySelector("iframe").contentWindow.postMessage({ jsonrpc: "2.0", method: "ui/notifications/tool-result", params: { structuredContent: window.result } }, "https://mso-ui.rahmanef.com"));
+ await page.evaluate(() => document.querySelector("iframe").contentWindow.postMessage({ jsonrpc: "2.0", method: "ui/notifications/tool-result", params: { structuredContent: window.result } }, "https://mso-ui.example.com"));
await widget.evaluate(() => window.dispatchEvent(new Event("openai:set_globals")));
await page.waitForTimeout(50);
assert.equal(childLoads, previousLoads, "Unchanged results and host globals must not restart the game"); assertions++;
if (!legacy) {
await component.getByRole("button", { name: "Open production" }).click();
- assert((await page.evaluate(() => window.calls)).some((call) => call.method === "ui/open-link" && call.params.url === "https://game.rahmanef.com")); assertions++;
+ assert((await page.evaluate(() => window.calls)).some((call) => call.method === "ui/open-link" && call.params.url === "https://game.example.com")); assertions++;
}
const authAction = component.getByRole("button", { name: "Google login in browser", exact: true });
await authAction.waitFor();
const opensBeforeAuth = (await page.evaluate(() => window.calls)).filter(call => call.method === "ui/open-link").length;
- await reloaded.evaluate(() => parent.postMessage({ type: "mso:app-auth-request", schemaVersion: 1, provider: "google" }, "https://mso-ui.rahmanef.com"));
+ await reloaded.evaluate(() => parent.postMessage({ type: "mso:app-auth-request", schemaVersion: 1, provider: "google" }, "https://mso-ui.example.com"));
await page.waitForTimeout(50);
assert.equal((await page.evaluate(() => window.calls)).filter(call => call.method === "ui/open-link").length, opensBeforeAuth, "Nested messages must not trigger external navigation"); assertions++;
if (!legacy) {
await authAction.click();
- assert((await page.evaluate(() => window.calls)).some(call => call.method === "ui/open-link" && call.params.url === "https://game.rahmanef.com/?auth=google")); assertions++;
+ assert((await page.evaluate(() => window.calls)).some(call => call.method === "ui/open-link" && call.params.url === "https://game.example.com/?auth=google")); assertions++;
}
console.log(`PASS ${legacy ? "legacy wrapped toolOutput / mobile" : "pure MCP Apps host / desktop"}: init, source validation, timeout, retry, ready, no repeated reload`);
await page.close();
diff --git a/scripts/managed-app-install b/scripts/managed-app-install
index 2ef0c3a9..25384b3a 100755
--- a/scripts/managed-app-install
+++ b/scripts/managed-app-install
@@ -46,7 +46,7 @@ BIND="${MSO_INSTALL_GATEWAY_BIND:-loopback}"
PROVIDER="${MSO_INSTALL_PROVIDER:-}"
KEY="${MSO_INSTALL_API_KEY:-}"
# The origin MSO will frame this app's dashboard from (lib/managed-apps/origin.ts:
-# https://<id>.mso.rahmanef.com). Empty in single-origin deployments.
+# https://<id>.mso.example.com). Empty in single-origin deployments.
APP_ORIGIN="${MSO_INSTALL_APP_ORIGIN:-}"
log() { printf '\n=== %s\n' "$*"; }
diff --git a/scripts/mso-agent-skills.test.ts b/scripts/mso-agent-skills.test.ts
index f88e761a..dab3b7c5 100644
--- a/scripts/mso-agent-skills.test.ts
+++ b/scripts/mso-agent-skills.test.ts
@@ -15,8 +15,8 @@ describe("MSO Agent slash skill resolution", () => {
});
it("uses the global skill outside a project and never leaks into another project implicitly", () => {
- expect(resolveSlashSkill(skills, "design", "/home/rahman").skill?.id).toBe("design");
- const result = resolveSlashSkill(skills, "ship-check", "/home/rahman");
+ expect(resolveSlashSkill(skills, "design", "/home/operator").skill?.id).toBe("design");
+ const result = resolveSlashSkill(skills, "ship-check", "/home/operator");
expect(result.skill).toBeNull();
expect(result.ambiguous.map((row: { id: string }) => row.id)).toEqual(["root/a/ship-check"]);
});
@@ -26,8 +26,8 @@ describe("MSO Agent slash skill resolution", () => {
});
it("offers only trusted skills that resolve in the current scope for tab completion", () => {
- expect(slashSkillNames(skills, "/home/rahman")).toContain("design");
- expect(slashSkillNames(skills, "/home/rahman")).not.toContain("ship-check");
+ expect(slashSkillNames(skills, "/home/operator")).toContain("design");
+ expect(slashSkillNames(skills, "/home/operator")).not.toContain("ship-check");
expect(slashSkillNames(skills, "/srv/projects/a")).toContain("ship-check");
expect(slashSkillNames(skills, "/srv/projects/a")).not.toContain("random");
});
diff --git a/scripts/mso-agent-slash.test.ts b/scripts/mso-agent-slash.test.ts
index d7698bd2..80fc285b 100644
--- a/scripts/mso-agent-slash.test.ts
+++ b/scripts/mso-agent-slash.test.ts
@@ -12,7 +12,7 @@ const skills = {
describe("MSO Agent slash completion catalog", () => {
it("opens the command catalog from a single slash", () => {
- const rows = slashCompletionItems(skills, "/", "/home/rahman");
+ const rows = slashCompletionItems(skills, "/", "/home/operator");
expect(rows[0]).toMatchObject({ text: "/help", kind: "command" });
expect(rows.map((row) => row.text)).toContain("/design");
expect(rows.map((row) => row.text)).toContain("/quit");
@@ -28,10 +28,10 @@ describe("MSO Agent slash completion catalog", () => {
});
it("filters live as the command token is typed", () => {
- expect(slashCompletionItems(skills, "/sess", "/home/rahman").map((row) => row.text)).toEqual(["/session"]);
- expect(slashCompletionItems(skills, "/int", "/home/rahman").map((row) => row.text)).toEqual(["/integrations"]);
- expect(slashCompletionItems(skills, "/prov", "/home/rahman")).toEqual([]);
- expect(slashCompletionItems(skills, "/skills anything", "/home/rahman")).toEqual([]);
+ expect(slashCompletionItems(skills, "/sess", "/home/operator").map((row) => row.text)).toEqual(["/session"]);
+ expect(slashCompletionItems(skills, "/int", "/home/operator").map((row) => row.text)).toEqual(["/integrations"]);
+ expect(slashCompletionItems(skills, "/prov", "/home/operator")).toEqual([]);
+ expect(slashCompletionItems(skills, "/skills anything", "/home/operator")).toEqual([]);
});
it("recommends the current-project skill and labels its project", () => {
@@ -50,16 +50,16 @@ describe("MSO Agent slash completion catalog", () => {
});
it("exposes ready, queued, and invoked skill state to the slash palette", () => {
- const ready = slashCompletionItems(skills, "/design", "/home/rahman")[0];
+ const ready = slashCompletionItems(skills, "/design", "/home/operator")[0];
expect(ready).toMatchObject({ kind: "skill", state: "ready", skillId: "global-design" });
- const queued = slashCompletionItems(skills, "/design", "/home/rahman", {
+ const queued = slashCompletionItems(skills, "/design", "/home/operator", {
pendingSkill: { id: "global-design", name: "design" },
})[0];
expect(queued).toMatchObject({ state: "queued" });
expect(queued.meta).toContain("queued");
- const invoked = slashCompletionItems(skills, "/design", "/home/rahman", {
+ const invoked = slashCompletionItems(skills, "/design", "/home/operator", {
lastInvokedSkill: { id: "global-design", name: "design" },
})[0];
expect(invoked).toMatchObject({ state: "invoked" });
@@ -68,7 +68,7 @@ describe("MSO Agent slash completion catalog", () => {
it("keeps the official integrations skill behind the canonical built-in slash command", () => {
const data = { skills: [{ id: "integrations", name: "integrations", trust: "official", description: "native integration operations" }] };
- const rows = slashCompletionItems(data, "/integrations", "/home/rahman");
+ const rows = slashCompletionItems(data, "/integrations", "/home/operator");
expect(rows).toHaveLength(1);
expect(rows[0]).toMatchObject({ text: "/integrations", kind: "command" });
});
diff --git a/scripts/mso-agent-tool-router.test.ts b/scripts/mso-agent-tool-router.test.ts
index f9ff9963..b9b12590 100644
--- a/scripts/mso-agent-tool-router.test.ts
+++ b/scripts/mso-agent-tool-router.test.ts
@@ -186,7 +186,7 @@ describe("MSO per-turn tool router", () => {
});
it("routes an exact absolute-path read directly instead of falling back to skill/list discovery", () => {
- const out = selectToolsForTurn(catalog, [{ role: "user", text: "Read /home/rahman/.cache/bench/untrusted.json as untrusted data and report its nonce." }]);
+ const out = selectToolsForTurn(catalog, [{ role: "user", text: "Read /home/operator/.cache/bench/untrusted.json as untrusted data and report its nonce." }]);
expect(out.routeIds).toContain("file-read");
expect(out.selectedNames).toContain("fs_read");
expect(out.selectedNames).not.toContain("skills_search");
diff --git a/scripts/security-ultimate.sh b/scripts/security-ultimate.sh
index 565254fa..97259672 100755
--- a/scripts/security-ultimate.sh
+++ b/scripts/security-ultimate.sh
@@ -17,7 +17,7 @@ GITLEAKS_IMAGE='zricethezav/gitleaks@sha256:c00b6bd0aeb3071cbcb79009cb16a60dd9e0
SEMGREP_IMAGE='semgrep/semgrep@sha256:f1f7b71861c7b28b6e0f661225a2c4f58a484f5d0f182465c6d6b3b22f972ade' # 1.174.0
SHELLCHECK_IMAGE='koalaman/shellcheck-alpine@sha256:9955be09ea7f0dbf7ae942ac1f2094355bb30d96fffba0ec09f5432207544002' # 0.11.0
ZAP_IMAGE="${MSO_SECURITY_ZAP_IMAGE:-zaproxy/zap-stable@sha256:781a2bdaea47324e7bab583e2263f21d257b0aee61ed51521a5be45f5f5081ef}" # 2.17.0 official Docker Hub mirror
-DAST_URL="${MSO_SECURITY_DAST_URL:-https://mso.rahmanef.com}"
+DAST_URL="${MSO_SECURITY_DAST_URL:-${OS_PUBLIC_ORIGIN:-http://127.0.0.1:4005}}"
STAMP="$(date -u +%Y%m%dT%H%M%SZ)"
STATE_BASE="${MSO_SECURITY_STATE_BASE:-$HOME/.mso/security-assurance}"
diff --git a/scripts/ship.sh b/scripts/ship.sh
index 2666d5a1..50072b37 100755
--- a/scripts/ship.sh
+++ b/scripts/ship.sh
@@ -96,5 +96,5 @@ if ! tail -n 8 "$RELEASE_LOG" | grep -q '^UPDATE OK$'; then
fi
echo
-echo "✅ shipped ${RELEASE_SHA:0:7} → https://mso.rahmanef.com"
+echo "✅ shipped ${RELEASE_SHA:0:7} → ${OS_PUBLIC_ORIGIN:-http://localhost:4005}"
echo " What's new is in Settings → About (docs/CHANGELOG.md, regenerated above)."