Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(app-frame): raise the MCP app CSP domain cap from 16 to 64

wlals0874d87337a89e92
diff --git a/shared/app-frame/csp.test.ts b/shared/app-frame/csp.test.ts
index 7cefb90283..46962b1ff2 100644
--- a/shared/app-frame/csp.test.ts
+++ b/shared/app-frame/csp.test.ts
@@ -106,8 +106,8 @@ describe("the domain filter", () => {
expect(filterAppDomains(["http://localhost:5173"], connect).kept).toEqual([]);
});
- it("keeps at most 16, refuses the rest, dedupes, and drops non-strings without a trace", () => {
- const many = Array.from({ length: 20 }, (_, index) => `https://h${index}.example.com`);
+ it("keeps at most 64, refuses the rest, dedupes, and drops non-strings without a trace", () => {
+ const many = Array.from({ length: APP_DOMAIN_LIMIT + 4 }, (_, index) => `https://h${index}.example.com`);
const { kept, refused } = filterAppDomains([...many, "https://h0.example.com", 7, null, { url: "https://x.example.com" }], strict);
expect(kept).toHaveLength(APP_DOMAIN_LIMIT);
expect(refused).toEqual(many.slice(APP_DOMAIN_LIMIT));
diff --git a/shared/app-frame/csp.ts b/shared/app-frame/csp.ts
index cde4ff0f21..b8a8e0a141 100644
--- a/shared/app-frame/csp.ts
+++ b/shared/app-frame/csp.ts
@@ -60,7 +60,7 @@ export function folderPageNetwork(files: string): { connect: string[]; resources
return { connect: [...BOT_HTML_NETWORK.connect, files, DUCKDB_EXTENSIONS], resources: [...BOT_HTML_NETWORK.resources, files] };
}
-export const APP_DOMAIN_LIMIT = 16;
+export const APP_DOMAIN_LIMIT = 64;
const REFUSED_SHOWN_CHARS = 120;
const LABEL = "[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?";