Files
nezha_domains/model
naibaandnaiba/CloudCode ea7ad67f03 fix(ddns): apply SSRF defense to webhook provider
GHSA-6x26-5727-rrm9: a low-privilege member could point a DDNS webhook
at internal or loopback hosts and the dashboard would dial them with the
unrestricted utils.HttpClient.

Extract the notification SSRF defenses (CIDR blocklist, IP-pin DialContext,
SNI preservation, redirect rejection) into reusable helpers in pkg/utils
(NewRestrictedHTTPClient / ResolveAllowedHTTPURL / buildRestrictedHTTPClient)
and route the DDNS webhook through the same path. Replace the notification
inline implementation with a thin wrapper to keep behaviour identical.

Side improvements collected by the refactor:
- prepareRequest now resolves DNS once and returns the paired client, so
  the dialer's pinned IP and the validated URL stay in sync (no more
  double resolution between prepareRequest and SetRecords).
- response body is drained and closed.
- HttpClient / HttpClientSkipTlsVerify are explicitly tagged unsafe for
  attacker-controlled URLs.

Tests cover: hermetic SNI preservation, redirect rejection, dial pin to
the vetted IP, the full blocked-CIDR list at the webhook entry point,
and the verifyTLS↔skipVerifyTLS inversion in the notification wrapper.

Co-authored-by: naiba/CloudCode <hi+cloudcode@nai.ba>
2026-05-18 15:14:27 +00:00
..
2024-12-19 23:21:15 +08:00
2024-12-28 23:50:59 +08:00
2026-02-15 13:13:33 +08:00
2024-11-16 20:57:03 +08:00
2025-04-26 18:28:21 +08:00
2024-10-25 09:09:08 +08:00
2024-12-04 20:00:18 +08:00
2025-01-21 22:23:15 +08:00
2025-01-21 22:23:15 +08:00
2024-11-16 20:57:03 +08:00
2024-10-20 00:32:55 +08:00
2025-03-19 22:21:21 +08:00
2024-11-16 20:57:03 +08:00
2024-10-21 23:00:51 +08:00
2025-03-27 19:17:00 +08:00
2026-02-15 13:13:33 +08:00
2026-02-15 13:13:33 +08:00
2026-02-15 13:13:33 +08:00
2026-02-15 13:13:33 +08:00
2024-10-22 22:01:01 +08:00
2024-11-16 20:57:03 +08:00