Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

540 B
Raw Blame
import { isBlockedHostnameOrIp } from './_generated/leaf/src/infra/net/ssrf.js';

/**
 * Resource downloads are host-side writes and must not become a local-network
 * fetch primitive for page content.
 */
export function isPublicHttpResourceUrl(value: string): boolean {
  try {
    const parsed = new URL(value);
    return (
      (parsed.protocol === 'http:' || parsed.protocol === 'https:')
      && !parsed.username
      && !parsed.password
      && !isBlockedHostnameOrIp(parsed.hostname)
    );
  } catch {
    return false;
  }
}