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(mcp): bind ChatGPT Azure file trust to OAuth provenance

Rahmanf3fd68b628a2
diff --git a/.env.example b/.env.example
index 3ccf33de..16c166c7 100644
--- a/.env.example
+++ b/.env.example
@@ -331,10 +331,10 @@ OS_MCP_MAX_SCOPE=exec
# Origin and need no entry. Exact origins only; this never weakens loopback/DNS-
# rebinding protection. Example: https://claude.example,https://cursor.example
# OS_MCP_BROWSER_ORIGINS=
-# Optional exact Azure Blob hostnames accepted for ChatGPT fileParams downloads.
-# `*.oaiusercontent.com` remains trusted without configuration; Azure account-name
-# prefixes are NOT ownership proof, so list exact hosts only when your ChatGPT
-# attachment URL uses Azure Blob. Comma-separated; wildcards are rejected.
+# Optional exact Azure Blob hostnames for generic MCP file imports. `*.oaiusercontent.com`
+# is trusted directly. OAuth clients with a verified `chatgpt.com` callback may also use
+# ChatGPT's rotating oaisdmntpr<region> Azure family; a client name alone is insufficient.
+# Other Azure hosts remain exact-only here. Comma-separated; wildcards are rejected.
# OS_MCP_OPENAI_FILE_HOSTS=oaisdmntprseasia.blob.core.windows.net
# Persistent semantic skill/recipe memory. The default is ~/.mso/skill-memory.json
# (0600). Embeddings are deterministic and local — no API key, model download or
diff --git a/app/mcp/route.test.ts b/app/mcp/route.test.ts
index 0d87f35b..209f45da 100644
--- a/app/mcp/route.test.ts
+++ b/app/mcp/route.test.ts
@@ -47,7 +47,11 @@ vi.mock("@/lib/mcp/capability-runtime", () => ({
}));
vi.mock("@/lib/mcp/tools", () => ({ TOOLS: [] }));
vi.mock("@/lib/mcp/toolset", () => ({ toolsetInfo: () => ({}) }));
-vi.mock("@/lib/mcp/client-profile", () => ({ detectMcpToolProfile: ({ name }: { name?: string }) => name === "ChatGPT" ? "chatgpt" : "full" }));
+vi.mock("@/lib/mcp/client-profile", () => ({
+ detectMcpToolProfile: ({ name }: { name?: string }) => name === "ChatGPT" ? "chatgpt" : "full",
+ isTrustedOpenAiFileParamsClient: ({ redirectUris }: { redirectUris?: string[] }) =>
+ (redirectUris ?? []).some((uri) => uri.startsWith("https://chatgpt.com/")),
+}));
vi.mock("@/lib/mcp/tool-contract", () => ({ visibleToolsForProfile: () => [] }));
vi.mock("@/lib/agent/session-store", () => ({
@@ -164,6 +168,7 @@ describe("/mcp request boundary", () => {
principal: `mcp-client:${token.clientId}`,
sessionId: "20260901_100000_aabbccdd",
toolProfile: "chatgpt",
+ trustedOpenAiFileParams: true,
capabilities: expect.objectContaining({ list: expect.any(Function), invoke: expect.any(Function) }),
});
});
diff --git a/app/mcp/route.ts b/app/mcp/route.ts
index bfaa0bd2..d44ff87e 100644
--- a/app/mcp/route.ts
+++ b/app/mcp/route.ts
@@ -5,7 +5,7 @@ import { publicOrigin, clientIp, mcpCorsHeaders, mcpRequestOriginAllowed } from
import { rateLimited, rateLimitedUntrusted } from "@/lib/host/limits-api";
import { TOOLS } from "@/lib/mcp/tools";
import { toolsetInfo } from "@/lib/mcp/toolset";
-import { detectMcpToolProfile } from "@/lib/mcp/client-profile";
+import { detectMcpToolProfile, isTrustedOpenAiFileParamsClient } from "@/lib/mcp/client-profile";
import { validateMcpRequest, modernMcpResult } from "@/lib/mcp/modern-http";
import { MCP_SERVER_VERSION } from "@/lib/mcp/toolset";
import { visibleToolsForProfile } from "@/lib/mcp/tool-contract";
@@ -82,6 +82,7 @@ export async function POST(req: Request) {
if (token.resource && token.resource !== expectedResource) return unauthorized("token was minted for a different MCP resource");
const client = token.clientId ? await getClient(token.clientId).catch(() => null) : null;
const toolProfile = token.profile ?? client?.profile ?? detectMcpToolProfile({ clientId: token.clientId, name: client?.name, redirectUris: client?.redirectUris });
+ const trustedOpenAiFileParams = isTrustedOpenAiFileParamsClient({ clientId: token.clientId, redirectUris: client?.redirectUris });
const resolved = await resolveMcpSession(req, rpc, principal, token.label);
if ("response" in resolved) return resolved.response;
const headers = responseHeaders(req, mcpSessionHeaders(wire.modern ? undefined : resolved.responseSessionId));
@@ -93,6 +94,7 @@ export async function POST(req: Request) {
principal,
...(resolved.agentSessionId ? { sessionId: resolved.agentSessionId } : {}),
toolProfile,
+ trustedOpenAiFileParams,
...(token.allowedTools ? { allowedTools: token.allowedTools } : {}),
...(token.toolArgumentConstraints ? { toolArgumentConstraints: token.toolArgumentConstraints } : {}),
capabilities: msoCapabilityRuntime,
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index f98ee799..bac9f4d6 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**
+- `mcp` bind ChatGPT Azure file trust to OAuth provenance
- `mcp` make project plugins explicit opt-in installs
- `mcp` trust verified ChatGPT Azure file host
- `integrations` preserve strict SC bundle validation
diff --git a/docs/CHATGPT-PLUGIN.md b/docs/CHATGPT-PLUGIN.md
index c19acd50..12163a81 100644
--- a/docs/CHATGPT-PLUGIN.md
+++ b/docs/CHATGPT-PLUGIN.md
@@ -130,16 +130,18 @@ ChatGPT file parameter VPS file
│ │
├─ PNG/WebP/JPEG/JSON/ZIP only ├─ OS_FS_READ_ROOTS + credential denylist
├─ 20 MiB streamed cap ├─ original bytes, max 10 MiB
- ├─ trusted OpenAI host / exact Azure host ├─ SHA-256
+ ├─ provenance-bound OpenAI/Azure host ├─ SHA-256
└─ OS_FS_WRITE_ROOTS └─ private 15-minute temp-share
│
▼
approved-device authenticated download
```
-Upload trusts `*.oaiusercontent.com` directly. If ChatGPT supplies an Azure Blob URL, the exact
-host must be configured in `OS_MCP_OPENAI_FILE_HOSTS`; wildcard or prefix-based Azure trust is
-intentionally rejected. Export returns a `resource_link` plus structured checksum/size metadata.
+Upload trusts `*.oaiusercontent.com` directly. When OAuth proves a `chatgpt.com` callback,
+`openai/fileParams` may also use ChatGPT's rotating `oaisdmntpr<region>.blob.core.windows.net`
+temporary-file family. A self-declared client name never unlocks that family; generic MCP clients
+need exact `OS_MCP_OPENAI_FILE_HOSTS` entries. Export returns a `resource_link` plus structured
+checksum/size metadata.
The link is not public, consumes the existing MSO approved-device session gate, allows at most five
downloads, and preserves the source bytes exactly. `session_artifacts` remains a preview/artifact
workflow and may recompress large images, so it is not the original-file export path.
diff --git a/docs/MCP.md b/docs/MCP.md
index 5fe63972..899de109 100644
--- a/docs/MCP.md
+++ b/docs/MCP.md
@@ -562,11 +562,13 @@ body incrementally with a hard **20 MiB** ceiling even when `Content-Length` is
The declared/inferred MIME must be in that five-format matrix; generic octet-stream may be used on
the wire but cannot bypass the declared matrix. PNG/JPEG/WebP magic bytes, JSON UTF-8 + syntax,
and ZIP signatures are validated before the normal credential/path jail writes into
-`OS_FS_WRITE_ROOTS`. `*.oaiusercontent.com` is trusted directly. Azure Blob hosts are accepted only
-when their exact hostname is listed in `OS_MCP_OPENAI_FILE_HOSTS`; account-name prefixes are not
-treated as ownership proof. The final write uses an exclusive random temporary file and atomic
-rename, never executes transferred bytes, and returns path, bytes and SHA-256. Existing same-name
-files may still be replaced, so import remains a write/destructive action.
+`OS_FS_WRITE_ROOTS`. `*.oaiusercontent.com` is trusted directly. For an OAuth client whose
+registered callback is owned by `chatgpt.com`, the `openai/fileParams` bridge may also follow the
+rotating `oaisdmntpr<region>.blob.core.windows.net` family used by ChatGPT temporary downloads.
+That family exception is never granted from a self-declared client name alone; generic MCP clients
+still need exact Azure hosts in `OS_MCP_OPENAI_FILE_HOSTS`. The final write uses an exclusive random
+temporary file and atomic rename, never executes transferred bytes, and returns path, bytes and
+SHA-256. Existing same-name files may still be replaced, so import remains a write/destructive action.
**`fs_export_file`** is the read-side counterpart for one original file up to **10 MiB**. It uses
the same `OS_FS_READ_ROOTS`, realpath and credential denylist as other reads, reads with
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index 909dfd9d..26e99f7e 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -15,9 +15,11 @@ READ-root/credential guards and `O_NOFOLLOW` remain authoritative, bytes are not
recompressed, SHA-256 is returned, and the approved-device download expires after 15 minutes / five
downloads. ChatGPT import is now an explicit PNG/WebP/JPEG/JSON/ZIP matrix with format validation;
generic octet-stream is accepted only as a transport response for a known declared/inferred format,
-not as a bypass. Azure Blob trust moved from an account-name prefix heuristic to exact optional
-`OS_MCP_OPENAI_FILE_HOSTS` entries; `*.oaiusercontent.com` remains trusted directly. Derivative MSO
-projects remain unchanged until this upstream contract passes release verification.
+not as a bypass. Generic MCP Azure Blob trust remains exact-only through optional
+`OS_MCP_OPENAI_FILE_HOSTS`, while `*.oaiusercontent.com` is trusted directly. The rotating
+`oaisdmntpr<region>` Azure family is accepted only when OAuth registration proves a
+`chatgpt.com` callback; a self-declared ChatGPT client name does not grant that exception.
+Derivative MSO projects remain unchanged until this upstream contract passes release verification.
## 2026-09-14 — Integrations is a first-class shell app and SI-Coder worktrees are detected safely
diff --git a/lib/capabilities/actors.ts b/lib/capabilities/actors.ts
index 2a5b81fa..95d71a06 100644
--- a/lib/capabilities/actors.ts
+++ b/lib/capabilities/actors.ts
@@ -1,6 +1,6 @@
import type { CapabilityToolProfile } from "./tool";
-export interface CapabilityAgentContext { principal?: string; sessionId?: string; toolProfile?: CapabilityToolProfile; allowedTools?: readonly string[]; toolArgumentConstraints?: Readonly<Record<string, Readonly<Record<string, readonly string[]>>>>; }
+export interface CapabilityAgentContext { principal?: string; sessionId?: string; toolProfile?: CapabilityToolProfile; trustedOpenAiFileParams?: boolean; allowedTools?: readonly string[]; toolArgumentConstraints?: Readonly<Record<string, Readonly<Record<string, readonly string[]>>>>; }
export function workflowActor(actor: string | undefined, context?: CapabilityAgentContext): string | undefined {
return context?.principal && context.sessionId ? `${context.principal}#session:${context.sessionId}` : actor;
}
diff --git a/lib/capabilities/execute.ts b/lib/capabilities/execute.ts
index 10b98824..a166ca99 100644
--- a/lib/capabilities/execute.ts
+++ b/lib/capabilities/execute.ts
@@ -118,6 +118,7 @@ export async function executeCapabilityCall(input: {
toolArgumentConstraints: context?.toolArgumentConstraints,
capabilities: context?.capabilities,
toolProfile: context?.toolProfile,
+ trustedOpenAiFileParams: context?.trustedOpenAiFileParams,
});
const reportedFailure = capabilityReportedFailure(result) || trail?.outcome?.(result)?.ok === false;
const completedState = reportedFailure ? "failed" : "completed";
diff --git a/lib/capabilities/tool.ts b/lib/capabilities/tool.ts
index 691feba7..3b37b886 100644
--- a/lib/capabilities/tool.ts
+++ b/lib/capabilities/tool.ts
@@ -49,6 +49,7 @@ export interface CapabilityRunContext {
toolArgumentConstraints?: Readonly<Record<string, Readonly<Record<string, readonly string[]>>>>;
capabilities?: CapabilityRuntime;
toolProfile?: CapabilityToolProfile;
+ trustedOpenAiFileParams?: boolean;
}
/**
diff --git a/lib/mcp/client-profile.test.ts b/lib/mcp/client-profile.test.ts
index 5795a963..280f665b 100644
--- a/lib/mcp/client-profile.test.ts
+++ b/lib/mcp/client-profile.test.ts
@@ -1,16 +1,22 @@
import { describe, expect, it } from "vitest";
-import { detectMcpToolProfile } from "./client-profile";
+import { detectMcpToolProfile, isTrustedOpenAiFileParamsClient } from "./client-profile";
describe("MCP client profile detection", () => {
- it("recognizes the current ChatGPT connector callback host", () => {
- expect(detectMcpToolProfile({ redirectUris: ["https://chatgpt.com/connector/oauth/callback-123"] })).toBe("chatgpt");
+ it("recognizes the current ChatGPT connector callback host and trusts fileParams provenance", () => {
+ const input = { redirectUris: ["https://chatgpt.com/connector/oauth/callback-123"] };
+ expect(detectMcpToolProfile(input)).toBe("chatgpt");
+ expect(isTrustedOpenAiFileParamsClient(input)).toBe(true);
});
- it("recognizes a legacy registered ChatGPT client by name", () => {
- expect(detectMcpToolProfile({ clientId: "mcpc_legacy", name: "ChatGPT" })).toBe("chatgpt");
+ it("keeps legacy name-only ChatGPT compatibility without using the self-declared name as a file trust signal", () => {
+ const input = { clientId: "mcpc_legacy", name: "ChatGPT", redirectUris: ["https://example.com/oauth/callback"] };
+ expect(detectMcpToolProfile(input)).toBe("chatgpt");
+ expect(isTrustedOpenAiFileParamsClient(input)).toBe(false);
});
- it("keeps generic MCP clients on the full MSO catalog", () => {
- expect(detectMcpToolProfile({ clientId: "mcpc_generic", name: "Cursor", redirectUris: ["https://example.com/oauth/callback"] })).toBe("full");
+ it("keeps generic MCP clients on the full MSO catalog and outside ChatGPT file trust", () => {
+ const input = { clientId: "mcpc_generic", name: "Cursor", redirectUris: ["https://example.com/oauth/callback"] };
+ expect(detectMcpToolProfile(input)).toBe("full");
+ expect(isTrustedOpenAiFileParamsClient(input)).toBe(false);
});
});
diff --git a/lib/mcp/client-profile.ts b/lib/mcp/client-profile.ts
index 90681528..d278a5e1 100644
--- a/lib/mcp/client-profile.ts
+++ b/lib/mcp/client-profile.ts
@@ -4,11 +4,18 @@ function hostOf(value: string): string {
try { return new URL(value).hostname.toLowerCase(); } catch { return ""; }
}
-export function detectMcpToolProfile(input: { clientId?: string; name?: string; redirectUris?: string[] }): McpToolProfile {
- const name = (input.name ?? "").toLowerCase();
+function isChatGptHost(host: string): boolean {
+ return host === "chatgpt.com" || host.endsWith(".chatgpt.com");
+}
+
+export function isTrustedOpenAiFileParamsClient(input: { clientId?: string; redirectUris?: string[] }): boolean {
const clientHost = hostOf(input.clientId ?? "");
const redirectHosts = (input.redirectUris ?? []).map(hostOf);
- if (name.includes("chatgpt") || name === "openai" || clientHost === "chatgpt.com" || clientHost.endsWith(".chatgpt.com") ||
- redirectHosts.some((host) => host === "chatgpt.com" || host.endsWith(".chatgpt.com"))) return "chatgpt";
+ return isChatGptHost(clientHost) || redirectHosts.some(isChatGptHost);
+}
+
+export function detectMcpToolProfile(input: { clientId?: string; name?: string; redirectUris?: string[] }): McpToolProfile {
+ const name = (input.name ?? "").toLowerCase();
+ if (name.includes("chatgpt") || name === "openai" || isTrustedOpenAiFileParamsClient(input)) return "chatgpt";
return "full";
}
diff --git a/lib/mcp/dispatch-types.ts b/lib/mcp/dispatch-types.ts
index 0039fde2..b723e2ee 100644
--- a/lib/mcp/dispatch-types.ts
+++ b/lib/mcp/dispatch-types.ts
@@ -20,6 +20,7 @@ export interface McpAgentContext {
principal?: string;
sessionId?: string;
toolProfile?: McpToolProfile;
+ trustedOpenAiFileParams?: boolean;
allowedTools?: readonly string[];
toolArgumentConstraints?: Readonly<Record<string, Readonly<Record<string, readonly string[]>>>>;
capabilities?: CapabilityRuntime;
diff --git a/lib/mcp/openai-file-upload.test.ts b/lib/mcp/openai-file-upload.test.ts
index 83c99808..60d0727b 100644
--- a/lib/mcp/openai-file-upload.test.ts
+++ b/lib/mcp/openai-file-upload.test.ts
@@ -32,7 +32,7 @@ function importFile(input: {
mime_type?: string;
file_name?: string;
size?: number;
-}) {
+}, allowChatGptAzureFamily = false) {
return importOpenAiProvidedFile({
file: {
download_url: input.download_url || "https://files.oaiusercontent.com/file",
@@ -42,6 +42,7 @@ function importFile(input: {
size: input.size,
},
dest: "/home/example/generated-files",
+ allowChatGptAzureFamily,
});
}
@@ -50,6 +51,13 @@ describe("ChatGPT file host allowlist", () => {
await expect(importFile({ download_url: "https://files.oaiusercontent.com/file.png", mime_type: "image/png" })).resolves.toMatchObject({ bytes: 8 });
});
+ it.each(["oaisdmntprkoreacentral.blob.core.windows.net", "oaisdmntprjapaneast.blob.core.windows.net"])
+ ("accepts rotating ChatGPT Azure host %s only with trusted fileParams provenance", async (host) => {
+ await expect(importFile({ download_url: `https://${host}/container/file.png?sig=redacted`, mime_type: "image/png" }, true))
+ .resolves.toMatchObject({ bytes: 8 });
+ });
+
+
it("rejects Azure account-name prefixes unless the exact host is configured", async () => {
await expect(importFile({ download_url: "https://oaisdmntprseasia.blob.core.windows.net/container/file.png", mime_type: "image/png" }))
.rejects.toThrow("host is not allowed");
@@ -80,6 +88,12 @@ describe("ChatGPT file host allowlist", () => {
.rejects.toThrow("host is not allowed: attacker.blob.core.windows.net");
});
+ it("keeps the ChatGPT Azure exception scoped to the oaisdmntpr account family", async () => {
+ await expect(importFile({ download_url: "https://attacker.blob.core.windows.net/container/file.png?sig=redacted", mime_type: "image/png" }, true))
+ .rejects.toThrow("host is not allowed");
+ });
+
+
it("allows a redirect to an exact configured Azure host", async () => {
process.env.OS_MCP_OPENAI_FILE_HOSTS = "oaisdmntprseasia.blob.core.windows.net";
const fetchMock = vi.fn()
diff --git a/lib/mcp/openai-file-upload.ts b/lib/mcp/openai-file-upload.ts
index a8f96321..da32bcd3 100644
--- a/lib/mcp/openai-file-upload.ts
+++ b/lib/mcp/openai-file-upload.ts
@@ -15,7 +15,7 @@ export interface OpenAiProvidedFile {
const MAX_FILE_BYTES = 20 * 1024 * 1024;
const SUPPORTED_MIME = new Set(["image/png", "image/webp", "image/jpeg", "application/json", "application/zip"]);
const WIRE_MIME = new Set([...SUPPORTED_MIME, "application/octet-stream"]);
-const BUILTIN_AZURE_HOSTS = new Set(["oaisdmntprkoreacentral.blob.core.windows.net"]);
+const CHATGPT_AZURE_FILE_HOST = /^oaisdmntpr[a-z0-9]{2,40}\.blob\.core\.windows\.net$/;
const MIME_ALIASES = new Map([["application/x-zip-compressed", "application/zip"]]);
const EXTENSION_MIME = new Map([
[".png", "image/png"],
@@ -40,7 +40,7 @@ function normalizeMime(value: string): string {
}
function configuredAzureHosts(): Set<string> {
- const hosts = new Set<string>(BUILTIN_AZURE_HOSTS);
+ const hosts = new Set<string>();
for (const raw of (process.env.OS_MCP_OPENAI_FILE_HOSTS || "").split(",")) {
const host = raw.trim().toLowerCase();
if (!host) continue;
@@ -52,23 +52,24 @@ function configuredAzureHosts(): Set<string> {
return hosts;
}
-function trustedDownloadUrl(raw: string): URL {
+function trustedDownloadUrl(raw: string, allowChatGptAzureFamily = false): URL {
let url: 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();
- // OpenAI-owned oaiusercontent hosts are trusted directly. Azure Blob accounts
- // are accepted only as exact known hosts; one observed ChatGPT host is built in
- // and operators may add more. Shared prefixes are never ownership proof.
+ // Generic MCP clients get only oaiusercontent + operator-exact Azure hosts.
+ // The rotating oaisdmntpr Azure family is accepted only when the OAuth client
+ // is proven to use a ChatGPT-owned callback and fileParams performed the bind.
const openAiContentHost = host === "files.oaiusercontent.com" || host.endsWith(".oaiusercontent.com");
- if (!openAiContentHost && !configuredAzureHosts().has(host)) {
+ const trustedChatGptAzure = allowChatGptAzureFamily && CHATGPT_AZURE_FILE_HOST.test(host);
+ if (!openAiContentHost && !trustedChatGptAzure && !configuredAzureHosts().has(host)) {
throw new HostError(`file.download_url host is not allowed: ${host}`);
}
return url;
}
-async function fetchTrustedFile(initialUrl: URL): Promise<Response> {
+async function fetchTrustedFile(initialUrl: URL, allowChatGptAzureFamily = false): Promise<Response> {
let url = initialUrl;
for (let hop = 0; hop <= 3; hop += 1) {
const response = await fetch(url, {
@@ -79,7 +80,7 @@ async function fetchTrustedFile(initialUrl: URL): Promise<Response> {
if (![301, 302, 303, 307, 308].includes(response.status)) return response;
const location = response.headers.get("location");
if (!location) throw new HostError("OpenAI file redirect was missing a location");
- url = trustedDownloadUrl(new URL(location, url).toString());
+ url = trustedDownloadUrl(new URL(location, url).toString(), allowChatGptAzureFamily);
}
throw new HostError("OpenAI file download exceeded the redirect limit");
}
@@ -167,6 +168,7 @@ export async function importOpenAiProvidedFile(opts: {
file: unknown;
dest: string;
filename?: string;
+ allowChatGptAzureFamily?: boolean;
}): Promise<{
ok: true;
fileId: string;
@@ -177,13 +179,13 @@ export async function importOpenAiProvidedFile(opts: {
sha256: string;
}> {
const file = providedFile(opts.file);
- const url = trustedDownloadUrl(file.download_url);
+ const url = trustedDownloadUrl(file.download_url, opts.allowChatGptAzureFamily === true);
const mimeType = declaredMime(file);
if (typeof file.size === "number" && (!Number.isFinite(file.size) || file.size < 0 || file.size > MAX_FILE_BYTES)) {
throw new HostError("file exceeds the 20 MiB MCP import limit");
}
- const response = await fetchTrustedFile(url);
+ const response = await fetchTrustedFile(url, opts.allowChatGptAzureFamily === true);
if (!response.ok) throw new HostError(`OpenAI file download failed (${response.status})`);
const wireMime = responseMime(response);
if (wireMime && wireMime !== "application/octet-stream" && wireMime !== mimeType) {
diff --git a/lib/mcp/tools-mutate.ts b/lib/mcp/tools-mutate.ts
index dd7662a3..6bd5948b 100644
--- a/lib/mcp/tools-mutate.ts
+++ b/lib/mcp/tools-mutate.ts
@@ -36,7 +36,7 @@ export const MUTATE_TOOLS: McpTool[] = [
audit: { action: "fs.upload" as const, targetArg: "dest" },
description:
"Import one ChatGPT conversation/generated PNG, WebP, JPEG, JSON or ZIP file into an existing VPS directory. " +
- "ChatGPT binds the top-level file parameter through openai/fileParams; MSO downloads the temporary OpenAI URL immediately, validates exact host/type/size/content, writes within OS_FS_WRITE_ROOTS, and returns byte count plus SHA-256. Azure Blob download hosts require explicit OS_MCP_OPENAI_FILE_HOSTS allowlisting. Existing same-name files may be replaced.",
+ "ChatGPT binds the top-level file through openai/fileParams; MSO validates temporary URL provenance, type, size and content before writing inside OS_FS_WRITE_ROOTS. Verified ChatGPT OAuth callbacks may use its rotating Azure file hosts; generic MCP clients require exact Azure allowlisting. Returns bytes + SHA-256; existing same-name files may be replaced.",
scope: "write",
annotations: { destructiveHint: true, openWorldHint: true },
meta: { "openai/fileParams": ["file"] },
@@ -58,10 +58,11 @@ export const MUTATE_TOOLS: McpTool[] = [
dest: { type: "string", description: "Existing destination directory on the VPS, within OS_FS_WRITE_ROOTS." },
filename: { type: "string", description: "Optional safe destination basename; defaults to the ChatGPT filename." },
}, ["file", "dest"]),
- run: async (a) => importOpenAiProvidedFile({
+ run: async (a, context) => importOpenAiProvidedFile({
file: a.file,
dest: str(a, "dest"),
filename: opt(a, "filename"),
+ allowChatGptAzureFamily: context.trustedOpenAiFileParams === true,
}),
},
{