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

Function validateLoopbackURL

pkg/go/cmd/codebase-memory-mcp/main.go:517–525  ·  view source on GitHub ↗

validateLoopbackURL accepts only plain HTTP to an exact loopback authority.

(rawURL string)

Source from the content-addressed store, hash-verified

515
516// validateLoopbackURL accepts only plain HTTP to an exact loopback authority.
517func validateLoopbackURL(rawURL string) error {
518 parsed, err := url.Parse(rawURL)
519 if err != nil || !loopbackHTTPURL.MatchString(rawURL) ||
520 parsed.Scheme != "http" || parsed.User != nil ||
521 !loopbackHostnames[parsed.Hostname()] {
522 return fmt.Errorf("refusing non-loopback HTTP URL: %s", rawURL)
523 }
524 return nil
525}
526
527// httpsOnlyClient returns an HTTP client that rejects non-HTTPS redirects.
528var httpsOnlyClient = &http.Client{

Callers 1

downloadClientFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected