Refusing webhook targets inside the network the application runs in.
A webhook URL is chosen by whoever creates the subscription, and the request is made from the server: without this, a tenant could point one at the cloud metadata endpoint or an internal admin port and read the answer in the delivery log.
Checked at create time and again before every attempt, because DNS can
change in between. The attempt connects to the addresses that check
approved, so a name that answers differently a second time (DNS rebinding)
gets no second lookup. :allowed-hosts is the way to reach a private host
on purpose.
Refusing webhook targets inside the network the application runs in. A webhook URL is chosen by whoever creates the subscription, and the request is made from the server: without this, a tenant could point one at the cloud metadata endpoint or an internal admin port and read the answer in the delivery log. Checked at create time and again before every attempt, because DNS can change in between. The attempt connects to the addresses that check approved, so a name that answers differently a second time (DNS rebinding) gets no second lookup. `:allowed-hosts` is the way to reach a private host on purpose.
(check-host url {:keys [allowed-hosts]} resolve)Resolve the host of url once with resolve and judge the answer: {:addresses [..]} to
connect to, {} for a host in :allowed-hosts (not resolved), or
{:problem {:type .. :message ..}}. :refused for a private address,
:unresolvable when DNS has no answer — the first will not change by
retrying, the second may.
Resolve the host of `url` once with `resolve` and judge the answer: `{:addresses [..]}` to
connect to, `{}` for a host in `:allowed-hosts` (not resolved), or
`{:problem {:type .. :message ..}}`. `:refused` for a private address,
`:unresolvable` when DNS has no answer — the first will not change by
retrying, the second may.(private-address? addr)Whether addr is loopback, link-local, private, unspecified, multicast,
carrier-grade NAT, benchmarking, reserved, IPv6 unique-local, or an IPv6
address that carries one of those.
Whether `addr` is loopback, link-local, private, unspecified, multicast, carrier-grade NAT, benchmarking, reserved, IPv6 unique-local, or an IPv6 address that carries one of those.
(system-resolve host)Every address host resolves to; throws UnknownHostException.
Every address `host` resolves to; throws UnknownHostException.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |