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): allow configured auth query

Rahmancc10113741d0
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index fbbbb193..9cd5a040 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` allow configured auth query
- `portability` derive instance MCP context
- `integrations` verify self-hosted Convex admin keys
diff --git a/lib/mcp/surface-catalog.test.ts b/lib/mcp/surface-catalog.test.ts
index f57f458f..5df97b51 100644
--- a/lib/mcp/surface-catalog.test.ts
+++ b/lib/mcp/surface-catalog.test.ts
@@ -6,7 +6,7 @@ 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",
+ sandbox: "allow-scripts allow-same-origin", externalAuthPath: "/?auth=google",
}];
describe("MSO Page trusted app catalog", () => {
@@ -19,6 +19,8 @@ describe("MSO Page trusted app catalog", () => {
expect(apps).toHaveLength(1);
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");
+ expect(JSON.stringify(apps)).not.toContain("externalAuthPath");
+ expect(resolveSurfaceRoute("/apps/demo").app?.externalAuthPath).toBe("/?auth=google");
});
it("rejects arbitrary URLs, protocol-relative routes and traversal", () => {
diff --git a/lib/mcp/surface-config.ts b/lib/mcp/surface-config.ts
index f6d0eae0..1439468e 100644
--- a/lib/mcp/surface-config.ts
+++ b/lib/mcp/surface-config.ts
@@ -44,6 +44,16 @@ function safePath(value: unknown): string | null {
} catch { return null; }
}
+
+function safeAuthPath(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.username || url.password || url.hash || url.pathname.split("/").some((part) => part === "." || part === "..")) return null;
+ return `${url.pathname}${url.search}`;
+ } catch { return null; }
+}
+
function boundedText(value: unknown, required = false): string | undefined {
if (typeof value !== "string") return required ? undefined : "";
const result = value.trim();
@@ -61,7 +71,7 @@ function parseApp(entry: unknown, seen: Set<string>): SurfaceApp | 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);
+ const externalAuthPath = row.externalAuthPath === undefined ? undefined : safeAuthPath(row.externalAuthPath);
if (row.externalAuthPath !== undefined && !externalAuthPath) return null;
seen.add(id);
const reason = boundedText(row.reason);