(url: string | undefined)
| 85 | * validated after resolution at execution time. |
| 86 | */ |
| 87 | export function validateMcpDomain(url: string | undefined): void { |
| 88 | if (!url) { |
| 89 | if (getAllowedMcpDomainsFromEnv() !== null) { |
| 90 | throw new McpDomainNotAllowedError('(empty)') |
| 91 | } |
| 92 | return |
| 93 | } |
| 94 | if (hasEnvVarInHostname(url)) return |
| 95 | const rejected = checkMcpDomain(url) |
| 96 | if (rejected !== null) { |
| 97 | throw new McpDomainNotAllowedError(rejected) |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * Returns true if the IP is a loopback address (full 127.0.0.0/8 range, or ::1). |
no test coverage detected