Skip to content

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.

fix(forge): turnaround-view synthesis died on a phantom fetch helper

nirholas307e58ce6160
diff --git a/api/_mcp3d/vertex-imagen.js b/api/_mcp3d/vertex-imagen.js
index 98b4e7ca0..e70c97361 100644
--- a/api/_mcp3d/vertex-imagen.js
+++ b/api/_mcp3d/vertex-imagen.js
@@ -264,10 +264,12 @@ export async function editImage(imageUrl, prompt, { maskUrl = null } = {}) {
async function imageToBase64(imageUrl) {
if (imageUrl.startsWith('data:')) return imageUrl.split(',')[1];
- const { fetch_remote_bytes } = await import('../_lib/fetch-bytes.js').catch(() => ({}));
- if (!fetch_remote_bytes) throw new Error('cannot fetch image for editing');
- const bytes = await fetch_remote_bytes(imageUrl);
- return Buffer.from(bytes).toString('base64');
+ // SSRF-guarded fetch (redirect hops re-validated): the source URL is
+ // caller-supplied and the response is render-only input to the edit model.
+ const { fetchSafePublicUrl } = await import('../_lib/ssrf-guard.js');
+ const res = await fetchSafePublicUrl(imageUrl);
+ if (!res.ok) throw new Error(`cannot fetch image for editing (upstream ${res.status})`);
+ return Buffer.from(await res.arrayBuffer()).toString('base64');
}
async function editViaGemini({ sourceB64, prompt, project, location, model, token }) {