MCPcopy Create free account
hub / github.com/diillson/chatcli / renderRequestAllowed

Function renderRequestAllowed

cli/plugins/webfetch_render.go:391–406  ·  view source on GitHub ↗

── SSRF policy for in-page sub-requests ──────────────────────────── renderRequestAllowed enforces the SSRF policy on a sub-request issued by the rendered page. Non-HTTP schemes (data:, blob:, about:) never leave the renderer and are allowed. For HTTP(S), the same upfront validation as the static pa

(rawURL string)

Source from the content-addressed store, hash-verified

389// hostnames are additionally resolved and range-checked, since Chromium
390// dials by itself and ssrfDialControl cannot intercept it.
391func renderRequestAllowed(rawURL string) bool {
392 parsed, err := url.Parse(rawURL)
393 if err != nil {
394 return false
395 }
396 if parsed.Scheme != "http" && parsed.Scheme != "https" {
397 return true
398 }
399 if _, err := validateWebTarget(rawURL); err != nil {
400 return false
401 }
402 if !webBlockPrivate() {
403 return true
404 }
405 return resolvedHostAllowed(parsed.Hostname())
406}
407
408// hostVerdicts memoizes resolve-and-check results per hostname: an SPA
409// can fire hundreds of sub-requests against the same handful of hosts and

Calls 3

validateWebTargetFunction · 0.85
webBlockPrivateFunction · 0.85
resolvedHostAllowedFunction · 0.85