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

Function validateRedirectTarget

server/src/utils/url-security.ts:84–91  ·  view source on GitHub ↗
(
  location: string,
  baseUrl: string | URL,
)

Source from the content-addressed store, hash-verified

82 * Used when manually following redirects to prevent redirect-to-internal bypasses.
83 */
84export async function validateRedirectTarget(
85 location: string,
86 baseUrl: string | URL,
87): Promise<URL> {
88 const redirectUrl = new URL(location, baseUrl);
89 await validateFetchUrl(redirectUrl);
90 return redirectUrl;
91}
92
93/**
94 * Reconstruct a URL from its validated components.

Callers 4

safeFetchFunction · 0.85
fetchUrlMetadataFunction · 0.85
createMemberToolHandlersFunction · 0.85
fetchUrlContentFunction · 0.85

Calls 1

validateFetchUrlFunction · 0.85

Tested by

no test coverage detected