MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / validateFetchUrl

Function validateFetchUrl

server/src/utils/url-security.ts:73–78  ·  view source on GitHub ↗
(url: URL)

Source from the content-addressed store, hash-verified

71 * Checks protocol, hostname, and DNS resolution.
72 */
73export 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.

Callers 6

validateRedirectTargetFunction · 0.85
safeFetchFunction · 0.85
fetchUrlMetadataFunction · 0.85
createBrandFeedsRouterFunction · 0.85
createMemberToolHandlersFunction · 0.85
fetchUrlContentFunction · 0.85

Calls 1

validateHostResolutionFunction · 0.85

Tested by

no test coverage detected