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
fix(mcp): allow ChatGPT regional file storage
rahmanef6362ee3e434703
diff --git a/lib/mcp/openai-file-upload.test.ts b/lib/mcp/openai-file-upload.test.tsnew file mode 100644index 00000000..39abcc3d--- /dev/null+++ b/lib/mcp/openai-file-upload.test.ts@@ -0,0 +1,47 @@+import { beforeEach, describe, expect, it, vi } from "vitest";+vi.mock("server-only", () => ({}));++const uploadInto = vi.fn(async () => ({ written: 1, failed: [] as string[] }));+vi.mock("@/lib/host", async (orig) => {+ const real = await orig<typeof import("@/lib/host")>();+ return { ...real, uploadInto };+});++const { importOpenAiProvidedFile } = await import("./openai-file-upload");++beforeEach(() => {+ uploadInto.mockClear();+ vi.stubGlobal("fetch", vi.fn(async () => new Response(Uint8Array.from([137, 80, 78, 71]), {+ status: 200,+ headers: { "content-type": "image/png", "content-length": "4" },+ })));+});++describe("ChatGPT file host allowlist", () => {+ it("accepts the observed OpenAI Southeast Asia blob host", async () => {+ const result = await importOpenAiProvidedFile({+ file: {+ download_url: "https://oaisdmntprseasia.blob.core.windows.net/container/file.png?sig=redacted",+ file_id: "file_test",+ mime_type: "image/png",+ file_name: "file.png",+ size: 4,+ },+ dest: "/home/antinrml/generated-images",+ filename: "file.png",+ });+ expect(result.bytes).toBe(4);+ expect(uploadInto).toHaveBeenCalledTimes(1);+ });++ it("rejects an unrelated Azure blob account", async () => {+ await expect(importOpenAiProvidedFile({+ file: {+ download_url: "https://attacker.blob.core.windows.net/container/file.png",+ file_id: "file_test",+ mime_type: "image/png",+ },+ dest: "/home/antinrml/generated-images",+ })).rejects.toThrow("host is not allowed: attacker.blob.core.windows.net");+ });+});diff --git a/lib/mcp/openai-file-upload.ts b/lib/mcp/openai-file-upload.tsindex 82edf088..e647536f 100644--- a/lib/mcp/openai-file-upload.ts+++ b/lib/mcp/openai-file-upload.ts@@ -27,7 +27,14 @@ function trustedDownloadUrl(raw: string): URL {try { url = new URL(raw); } catch { throw new HostError("file.download_url is invalid"); }if (url.protocol !== "https:") throw new HostError("file.download_url must use HTTPS");const host = url.hostname.toLowerCase();- if (host !== "files.oaiusercontent.com" && !host.endsWith(".oaiusercontent.com")) {+ const exactOpenAiHosts = new Set([+ "files.oaiusercontent.com",+ // ChatGPT-generated conversation files in the Southeast Asia storage region.+ // Keep this exact: accepting arbitrary *.blob.core.windows.net would turn the+ // bridge into a server-side fetch primitive.+ "oaisdmntprseasia.blob.core.windows.net",+ ]);+ if (!exactOpenAiHosts.has(host) && !host.endsWith(".oaiusercontent.com")) {throw new HostError(`file.download_url host is not allowed: ${host}`);}return url;