Documentation
¶
Overview ¶
Package ssrf provides SSRF protection utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidScheme indicates a URL used a non-http(s) scheme. ErrInvalidScheme = errors.New("invalid URL scheme") // ErrEmptyHostname indicates a URL is missing a hostname. ErrEmptyHostname = errors.New("empty hostname") // ErrBlockedHostname indicates a URL hostname is blocked by SSRF policy. ErrBlockedHostname = errors.New("hostname is blocked") )
Functions ¶
func IsBlockedHostname ¶
IsBlockedHostname reports whether a hostname should be blocked for SSRF protection.
It blocks:
- IP literals that are blocked by IsBlockedIP
- known internal/metadata hostnames and their subdomains (e.g. *.metadata.azure.com)
func IsBlockedIP ¶
IsBlockedIP reports whether the IP should be blocked for SSRF protection.
func ValidateURL ¶
ValidateURL validates that a URL is safe to resolve and dial from an SSRF perspective.
It enforces: - http/https schemes only - non-empty hostname - hostname is not blocked by IsBlockedHostname (including IP literals)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.