fix(webhooks): refuse internal webhook targets and stop following redirects

Merchant-supplied webhook URLs were posted to without any host check,
redirects were followed, and the raw request error was stored and returned
to the caller. With open registration, anyone could make the service send
requests to the wallet RPC, the database, the daemon or a cloud metadata
address, and read back what the error revealed.

Every delivery path now goes through webhook_targets.post_webhook. It
accepts only http and https URLs without embedded credentials, requires
every resolved address to be public, and never follows redirects (a 3xx is
a failed delivery). WEBHOOK_ALLOWED_PRIVATE_HOSTS names exact hosts that may
resolve privately, for receivers reached over a LAN. Stored delivery errors
carry only the refusal reason or the exception class.
This commit is contained in:
2026-11-18 15:40:51 -05:00
parent b44181d8d9
commit 3764ffc4c2
8 changed files with 223 additions and 46 deletions
+5
View File
@@ -33,6 +33,11 @@ MONERO_DAEMON_URL=http://xmr-node.cakewallet.com:18081
# Admin panel (generate with: openssl rand -base64 32 | tr -d '=' | head -c 32)
ADMIN_API_KEY=
# Webhook targets must resolve to public addresses. List exact hostnames here
# (comma separated) that may resolve to a private address, such as a receiver
# reached over the LAN. Empty refuses every private target.
WEBHOOK_ALLOWED_PRIVATE_HOSTS=
# Registration (set to false to require manual merchant onboarding)
OPEN_REGISTRATION=true