Module domain_guard
Expand description
Shared domain/URL validation and allowlist helpers.
Functionsยง
- host_
matches_ allowlist - is_
private_ or_ local_ host - Check whether
hostis a private, loopback, link-local, or otherwise non-globally-routable address (SSRF guard). Handles both IPv4 and IPv6, as well aslocalhostand.localdomains. True whenhostis loopback, private, link-local, a documentation/ benchmark range, or one of thelocalhost/*.localname forms. Accepts bracketed IPv6 ([::1]) and is case-insensitive. - normalize_
allowed_ domains - normalize_
domain