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.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
import { afterEach, describe, expect, it, vi } from "vitest";
import { workflowEmbeds, listWorkflowEmbeds, workflowEmbedSettings } from "./workflow-embeds-api";
const cockpit = "https://mso.example.com";
const app = { id: "editor", title: "Editor", description: "Reviewed external editor", origin: "https://n8n.mso.example.com", startPath: "/editor", externalAuthPath: "/signin", renderer: "iframe" as const, presentation: "inline" as const, environment: "production" as const, placements: ["n8n", "mcp-page"] as Array<"n8n" | "mcp-page"> };
afterEach(() => vi.unstubAllEnvs());
describe("external editor session-cookie isolation", () => {
it.each(["mso.example.com", ".MSO.EXAMPLE.COM", " example.com "])("keeps frames and navigation on the same host/another port blocked despite obsolete domain %s", domain => {
vi.stubEnv("OS_SESSION_COOKIE_DOMAIN", domain);
const result = workflowEmbeds([{ ...app, origin: cockpit + ":8443" }], [cockpit])[0];
expect(result).toMatchObject({ id: "editor", renderer: "remote", blocked: true });
expect(result.url).toBeUndefined(); expect(result.loginUrl).toBeUndefined();
expect(result.reason).toContain("session cookie");
});
it("does not offer unsafe top-level navigation for remote-only providers", () => {
vi.stubEnv("OS_SESSION_COOKIE_DOMAIN", "mso.example.com");
expect(workflowEmbeds([{ ...app, origin: cockpit + ":8443", renderer: "remote" }], [cockpit])[0].url).toBeUndefined();
});
it("allows a separately hosted editor and rejects label-prefix tricks", () => {
vi.stubEnv("OS_SESSION_COOKIE_DOMAIN", "mso.example.com");
for (const origin of ["https://n8n.example.com", "https://othermso.example.com", "https://mso.example.com.editor.test"]) {
expect(workflowEmbeds([{ ...app, origin }], [cockpit])[0]).toMatchObject({ renderer: "iframe", url: origin + "/editor" });
}
});
it("protects host-only cookies across different ports without disabling sibling hosts", () => {
vi.stubEnv("OS_SESSION_COOKIE_DOMAIN", "");
expect(workflowEmbeds([{ ...app, origin: cockpit + ":8443" }], [cockpit])[0].url).toBeUndefined();
expect(workflowEmbeds([app], [cockpit])[0].renderer).toBe("iframe");
expect(workflowEmbeds([{ ...app, origin: cockpit }], [cockpit])[0]).toMatchObject({ renderer: "remote", url: cockpit + "/editor" });
});
it("rechecks runtime cookie policy through settings, list and shared Page readers", async () => {
vi.stubEnv("OS_PUBLIC_ORIGIN", cockpit);
vi.stubEnv("MSO_SURFACE_APPS_JSON", JSON.stringify([{ ...app, origin: cockpit + ":8443" }]));
vi.stubEnv("OS_SESSION_COOKIE_DOMAIN", "mso.example.com");
expect((await listWorkflowEmbeds("http://localhost:4005"))[0].url).toBeUndefined();
expect((await workflowEmbedSettings("http://localhost:4005")).apps[0].url).toBeUndefined();
vi.stubEnv("OS_SESSION_COOKIE_DOMAIN", "");
expect((await listWorkflowEmbeds("http://localhost:4005"))[0].url).toBeUndefined();
vi.stubEnv("MSO_SURFACE_APPS_JSON", JSON.stringify([app]));
expect((await listWorkflowEmbeds("http://localhost:4005"))[0].renderer).toBe("iframe");
});
});