isLocalhostHTTP reports whether rawURL is an http:// URL targeting localhost.
(rawURL string)
| 473 | |
| 474 | // isLocalhostHTTP reports whether rawURL is an http:// URL targeting localhost. |
| 475 | func isLocalhostHTTP(rawURL string) bool { |
| 476 | u, err := url.Parse(rawURL) |
| 477 | if err != nil { |
| 478 | return false |
| 479 | } |
| 480 | return u.Scheme == "http" && u.Hostname() == "localhost" |
| 481 | } |
| 482 | |
| 483 | // validateAgentURL enforces that an agent URL uses HTTPS, with an exception |
| 484 | // for http://localhost which is allowed for local development. SSRF protection |
no test coverage detected