MCPcopy Create free account
hub / github.com/atripati/ark / checkDomain

Method checkDomain

pkg/tools/http.go:309–327  ·  view source on GitHub ↗
(rawURL string)

Source from the content-addressed store, hash-verified

307 return "", fmt.Errorf("%w (after %d retries)", lastErr, maxRetries)
308}
309func (h *HTTPExecutor) checkDomain(rawURL string) error {
310 if len(h.AllowedDomains) == 0 {
311 return nil
312 }
313
314 parsed, err := url.Parse(rawURL)
315 if err != nil {
316 return fmt.Errorf("ark/tools/http: invalid URL %q: %w", rawURL, err)
317 }
318
319 host := parsed.Hostname()
320 for _, allowed := range h.AllowedDomains {
321 if host == allowed || strings.HasSuffix(host, "."+allowed) {
322 return nil
323 }
324 }
325
326 return fmt.Errorf("ark/tools/http: domain %q not in allowlist %v", host, h.AllowedDomains)
327}
328func sanitizeOutput(s string) string {
329 if len(s) <= maxOutputLen {
330 return s

Callers 1

ExecuteMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected