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(browser): probe cache-isolated Camoufox path

Rahmanf2d80ee2956d
diff --git a/app/api/v1/camoufox/session/route.ts b/app/api/v1/camoufox/session/route.ts
index af2b6df9..84ccd1e4 100644
--- a/app/api/v1/camoufox/session/route.ts
+++ b/app/api/v1/camoufox/session/route.ts
@@ -7,7 +7,7 @@ import { getSessionContext } from "@/lib/auth/require-session";
import { roleAtLeast } from "@/lib/auth/roles";
import { camoufoxViewerOrigin } from "@/lib/camoufox/origin";
import { createCamoufoxViewerTicket } from "@/lib/camoufox/viewer-auth";
-import { CAMOUFOX_VIEWER_PUBLIC_PREFIX } from "@/lib/camoufox/viewer-gate";
+import { CAMOUFOX_VIEWER_PUBLIC_PREFIX } from "@/lib/camoufox/viewer-path";
import { IS_DEMO } from "@/lib/demo";
export const runtime = "nodejs";
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 06b89c4d..4471409d 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -4,6 +4,13 @@
Newest first. `docs/PROGRESS.md` is the source of truth for *why* a change was made;
this is the *what*, and it is what Settings → About shows as “What's new”.
+## 2026-09-19
+
+**Fixed**
+
+- `browser` probe cache-isolated Camoufox path
+- `browser` isolate Camoufox viewer cache
+
## 2026-09-18
**Added**
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index 73e51b9c..a09e1d0c 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,3 +1,14 @@
+## 2026-09-19 — Probe the cache-isolated Camoufox viewer entry path
+
+The viewer cache boundary moved noVNC under `/_mso-camoufox`, while the authenticated
+transport diagnostic still probed legacy `/vnc.html` with redirects forbidden. A healthy
+viewer therefore returned 307 and the Browser UI rejected it before requesting its viewer
+ticket. The public viewer prefix and entry path now live in one lightweight contract used by
+the gate, session metadata and server-side transport probe. The probe still sends no cockpit
+credentials, follows no redirects, requires HTTPS and keeps the existing SSRF/TLS checks.
+Targeted regressions verify the exact namespaced HEAD request, viewer gate, service route and
+client connection behavior.
+
## 2026-09-18 — Close external-editor review around durable session policy and owner stores
The latest PR review found four boundary issues after the cookie-policy epoch landed. CLI device
diff --git a/lib/camoufox/viewer-gate.test.ts b/lib/camoufox/viewer-gate.test.ts
index 73be1604..82a6aa38 100644
--- a/lib/camoufox/viewer-gate.test.ts
+++ b/lib/camoufox/viewer-gate.test.ts
@@ -7,7 +7,7 @@ import {
createCamoufoxViewerCookie,
createCamoufoxViewerTicket,
} from "@/lib/camoufox/viewer-auth";
-import { CAMOUFOX_VIEWER_PUBLIC_PREFIX } from "@/lib/camoufox/viewer-gate";
+import { CAMOUFOX_VIEWER_PUBLIC_PREFIX } from "@/lib/camoufox/viewer-path";
const approved = vi.hoisted(() => ({
value: true,
diff --git a/lib/camoufox/viewer-gate.ts b/lib/camoufox/viewer-gate.ts
index c1c7e62f..a0e54513 100644
--- a/lib/camoufox/viewer-gate.ts
+++ b/lib/camoufox/viewer-gate.ts
@@ -10,11 +10,11 @@ import {
verifyCamoufoxViewerTicket,
} from "./viewer-auth";
import { IS_DEMO } from "@/lib/demo";
+import { CAMOUFOX_VIEWER_ENTRY_PATH, CAMOUFOX_VIEWER_PUBLIC_PREFIX } from "./viewer-path";
const AUTHORIZED = Symbol("camoufox-viewer-authorized");
export type CamoufoxViewerGateResult = typeof AUTHORIZED | NextResponse;
-export const CAMOUFOX_VIEWER_PUBLIC_PREFIX = "/_mso-camoufox";
function noStore(headers: Headers): void {
headers.set("cache-control", "no-store");
@@ -143,7 +143,7 @@ export async function gateCamoufoxViewer(
(pathname === "/" || pathname === "/vnc.html")
) {
const redirect = new URL(request.url);
- redirect.pathname = CAMOUFOX_VIEWER_PUBLIC_PREFIX + "/vnc.html";
+ redirect.pathname = CAMOUFOX_VIEWER_ENTRY_PATH;
return NextResponse.redirect(redirect, 307);
}
@@ -155,7 +155,7 @@ export async function gateCamoufoxViewer(
if (await hasViewerSession(request)) return AUTHORIZED;
if (
(request.method === "GET" || request.method === "HEAD") &&
- pathname === CAMOUFOX_VIEWER_PUBLIC_PREFIX + "/vnc.html"
+ pathname === CAMOUFOX_VIEWER_ENTRY_PATH
) return bootstrap(request.method);
return notFound();
}
diff --git a/lib/camoufox/viewer-path.ts b/lib/camoufox/viewer-path.ts
new file mode 100644
index 00000000..99666469
--- /dev/null
+++ b/lib/camoufox/viewer-path.ts
@@ -0,0 +1,2 @@
+export const CAMOUFOX_VIEWER_PUBLIC_PREFIX = "/_mso-camoufox";
+export const CAMOUFOX_VIEWER_ENTRY_PATH = CAMOUFOX_VIEWER_PUBLIC_PREFIX + "/vnc.html";
diff --git a/lib/camoufox/viewer-transport.test.ts b/lib/camoufox/viewer-transport.test.ts
index 77640261..12b4867d 100644
--- a/lib/camoufox/viewer-transport.test.ts
+++ b/lib/camoufox/viewer-transport.test.ts
@@ -1,6 +1,7 @@
import { describe, expect, it, vi } from "vitest";
vi.mock("server-only", () => ({}));
import { inspectViewerTransport } from "./viewer-transport";
+import { CAMOUFOX_VIEWER_ENTRY_PATH } from "./viewer-path";
describe("Camoufox public transport is separate from power", () => {
it("does not probe an absent origin", async () => {
@@ -12,7 +13,7 @@ describe("Camoufox public transport is separate from power", () => {
const fetcher = vi.fn(async () => new Response(null, { status }));
expect(await inspectViewerTransport("https://camoufox.example.com", fetcher)).toMatchObject({ reachable: true, status });
const [target, init] = fetcher.mock.calls[0] as unknown as [URL, RequestInit];
- expect(target.href).toBe("https://camoufox.example.com/vnc.html");
+ expect(target.href).toBe("https://camoufox.example.com" + CAMOUFOX_VIEWER_ENTRY_PATH);
expect(init).toMatchObject({ method: "HEAD", redirect: "error", cache: "no-store" });
expect(init.headers).toBeUndefined();
});
diff --git a/lib/camoufox/viewer-transport.ts b/lib/camoufox/viewer-transport.ts
index f3ad81e9..f89dca27 100644
--- a/lib/camoufox/viewer-transport.ts
+++ b/lib/camoufox/viewer-transport.ts
@@ -2,6 +2,7 @@ import "server-only";
import { safeProviderFetch } from "@/lib/host/ssrf";
import { camoufoxViewerOrigin } from "./origin";
import { PRIVATE_ROUTE_CODE } from "@/lib/host/provider-network-policy";
+import { CAMOUFOX_VIEWER_ENTRY_PATH } from "./viewer-path";
export type ViewerTransport = {
reachable: boolean;
@@ -40,7 +41,7 @@ export async function inspectViewerTransport(origin: string | null, fetcher = sa
try {
const url = new URL(origin);
if (url.protocol !== "https:" || url.username || url.password || url.origin !== origin) throw new Error("Invalid viewer origin");
- url.pathname = "/vnc.html";
+ url.pathname = CAMOUFOX_VIEWER_ENTRY_PATH;
const signal = AbortSignal.timeout(4_000);
let timer: ReturnType<typeof setTimeout> | undefined;
try {