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

Function validateUrl

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

Source from the content-addressed store, hash-verified

57// Security: only follow HTTPS URLs (defense-in-depth). Parse the URL instead
58// of relying on a string prefix so every redirect is checked unambiguously.
59function validateUrl(rawUrl) {
60 let parsed;
61 try {
62 parsed = new URL(rawUrl);
63 } catch (err) {
64 throw new Error(`Invalid download URL ${rawUrl}: ${err.message}`);
65 }
66 if (parsed.protocol !== 'https:' || !parsed.hostname || parsed.username || parsed.password) {
67 throw new Error(`Refusing non-HTTPS or credentialed URL: ${rawUrl}`);
68 }
69 return parsed.href;
70}
71
72function validateExactTarMemberListing(listing, expectedNames) {
73 if (listing.includes('\0')) {

Callers 2

downloadHopFunction · 0.85
downloadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected