MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / validateLoopbackUrl

Function validateLoopbackUrl

pkg/npm/install.js:84–96  ·  view source on GitHub ↗
(rawUrl)

Source from the content-addressed store, hash-verified

82// Plain HTTP is accepted only for an exact loopback authority, as in
83// install.sh; such a fetch uses no proxy and follows no redirect.
84function validateLoopbackUrl(rawUrl) {
85 let parsed = null;
86 try {
87 parsed = new URL(rawUrl);
88 } catch (_) {
89 // Refused below.
90 }
91 if (!LOOPBACK_HTTP_URL.test(rawUrl) || !parsed || parsed.protocol !== 'http:' ||
92 !LOOPBACK_HOSTNAMES.has(parsed.hostname) || parsed.username || parsed.password) {
93 throw new Error(`Refusing non-loopback HTTP URL: ${rawUrl}`);
94 }
95 return parsed.href;
96}
97
98// CBM_DOWNLOAD_URL replaces the release download base (for testing), with
99// install.sh's policy: HTTPS, or plain HTTP to an exact loopback authority.

Callers 1

downloadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected