── 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)
| 389 | // hostnames are additionally resolved and range-checked, since Chromium |
| 390 | // dials by itself and ssrfDialControl cannot intercept it. |
| 391 | func 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 |