Kantoor. Feeds. NetGuard
(Kantoor v1.0.0)
Where a feed fetch may connect. The address of a feed comes from a user (or from a provisioning system), so Kantoor must not become a way to reach its own network: the host name is resolved here, every address is checked, and the fetch connects to the checked address itself, never to the name again (a second lookup could answer differently: DNS rebinding).
Refused: anything that is not on the public internet or leads back into it in disguise.
- IPv4: this network (
0.0.0.0/8), private ranges (10.0.0.0/8,172.16.0.0/12,192.168.0.0/16), carrier-grade NAT (100.64.0.0/10), loopback, link-local (including the cloud metadata address169.254.169.254), IETF assignments, documentation ranges, 6to4 relay, benchmarking, multicast and the reserved range up to the broadcast address; - IPv6: unspecified, loopback and the rest of
::/96, IPv4-translated and NAT64 addresses, discard-only, Teredo, benchmarking, documentation, 6to4, unique local (fc00::/7), link-local, site-local and multicast. An IPv4-mapped address (::ffff:10.0.0.1) is checked as the IPv4 address it carries.
A host name with even one refused address is refused as a whole. Resolution goes
through Kantoor.Feeds.Resolver (replaced by a stub in tests).
Summary
Functions
True when ip is a public address.
Resolves host and checks every address. See the module doc.
Types
@type result() :: {:ok, [:inet.ip_address(), ...]} | {:error, :not_public | :unresolvable}
Functions
@spec public?(:inet.ip_address()) :: boolean()
True when ip is a public address.
Resolves host and checks every address. See the module doc.