Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
Mock SSRF guard's fetchSafePublicUrlPinned method to enforce maxBytes validation in tests
nirholasffc3a0e50fb1
diff --git a/tests/api/material-studio-store.test.js b/tests/api/material-studio-store.test.jsindex c254dbcd0..4666b73ea 100644--- a/tests/api/material-studio-store.test.js+++ b/tests/api/material-studio-store.test.js@@ -32,6 +32,31 @@ vi.mock('../../api/_lib/ssrf.js', () => ({assertPublicHttpsUrl: vi.fn(async (url) => url),}));+// material-studio-store.js fetches through the pinned SSRF guard (raw+// sockets). Route it through the per-test fetch stub, enforcing opts.maxBytes+// the way the real guard does.+vi.mock('../../api/_lib/ssrf-guard.js', async () => {+ const actual = await vi.importActual('../../api/_lib/ssrf-guard.js');+ return {+ ...actual,+ fetchSafePublicUrlPinned: async (url, init, opts) => {+ const resp = await globalThis.fetch(url, init);+ if (opts?.maxBytes == null) return resp;+ const buf = await resp.arrayBuffer();+ if (buf.byteLength > opts.maxBytes) {+ throw new actual.MaxBytesExceededError(buf.byteLength, opts.maxBytes);+ }+ return {+ ok: resp.ok,+ status: resp.status,+ headers: resp.headers ?? new Headers(),+ arrayBuffer: async () => buf,+ text: async () => Buffer.from(buf).toString('utf8'),+ };+ },+ };+});+vi.mock('../../api/_lib/watsonx.js', () => ({watsonxConfig: vi.fn(() => ({ configured: true, chatModel: 'ibm/granite-3-8b-instruct' })),watsonxChatComplete: vi.fn(async () => ({diff --git a/tests/api/okx-identity-studio.test.js b/tests/api/okx-identity-studio.test.jsindex 6914ff5a4..56cb2f10e 100644--- a/tests/api/okx-identity-studio.test.js+++ b/tests/api/okx-identity-studio.test.js@@ -60,8 +60,12 @@ vi.mock('../../api/_lib/r2.js', () => ({// Reference-image validation calls the real SSRF guard's public-URL check —// stub it to a pass-through so tests control reachability via fetch alone.+// fetchSafePublicUrlPinned is routed through the fetch router for the same+// reason (the pinned variant opens raw sockets, which the sandbox has no+// egress for).vi.mock('../../api/_lib/ssrf-guard.js', () => ({assertSafePublicUrl: vi.fn(async () => {}),+ fetchSafePublicUrlPinned: vi.fn(async (url, init) => globalThis.fetch(url, init)),SsrfBlockedError: class SsrfBlockedError extends Error {},}));