Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

1.0 KB
Raw Blame
// Plain global fetch on purpose (not safeHttp): these URLs are S3 pre-signed links
// generated by our own app from admin-configured object storage — zero user influence,
// same trust level as the AWS SDK S3 client the app already uses unfiltered. Routing
// them through the SSRF filter would needlessly break self-hosted S3/MinIO on private
// networks. Using the runtime's built-in fetch keeps sandbox-pool dependency-free here.
export const bundleHttp = {
    async getBuffer(url: string): Promise<Buffer> {
        const response = await fetch(url)
        if (!response.ok) {
            throw new Error(`Flow bundle download failed: ${response.status} ${response.statusText}`)
        }
        return Buffer.from(await response.arrayBuffer())
    },

    async put(url: string, data: Buffer): Promise<void> {
        const response = await fetch(url, {
            method: 'PUT',
            body: data,
        })
        if (!response.ok) {
            throw new Error(`Flow bundle upload failed: ${response.status} ${response.statusText}`)
        }
    },
}