(url: URL)
| 71 | * Checks protocol, hostname, and DNS resolution. |
| 72 | */ |
| 73 | export async function validateFetchUrl(url: URL): Promise<void> { |
| 74 | if (!['http:', 'https:'].includes(url.protocol)) { |
| 75 | throw new Error('Only http and https URLs are supported'); |
| 76 | } |
| 77 | await validateHostResolution(url.hostname); |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Validate a redirect target URL for SSRF safety. |
no test coverage detected