diff options
| author | Adam Soltys <[email protected]> | 2026-11-25 09:25:18 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-11-25 09:25:18 -0700 |
| commit | cdd086afc3044d9c8beefb0cc1abc307d1e4557e (patch) | |
| tree | b0397b911bf34d4af2b0b68ff5bcd05a60f93cfe /lib/invoices.ts | |
| parent | 0f3cb69da812dc81b2a5d939b1eebf1146ee2369 (diff) | |
| download | coinos-server-cdd086afc3044d9c8beefb0cc1abc307d1e4557e.tar.gz coinos-server-cdd086afc3044d9c8beefb0cc1abc307d1e4557e.zip | |
webhooks, zaps: send user-supplied URLs through the SSRF guard
Invoice webhooks must be plain http(s) strings and are posted with safePost
(checked, pinned address, no redirects). Zap requests resolve the
recipient lud16/lud06 and callback through safeGot instead of fetching
them as-is.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VMan6SEnsbshZrUDtTsxAX
Diffstat (limited to 'lib/invoices.ts')
| -rw-r--r-- | lib/invoices.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/invoices.ts b/lib/invoices.ts index 835b1247..1de1f95b 100644 --- a/lib/invoices.ts +++ b/lib/invoices.ts @@ -47,9 +47,13 @@ export const generate = async ({ invoice, user }) => { single_use, type = PaymentType.lightning, usePreimage, - webhook, secret, } = invoice; + // Only a plain http(s) URL is a webhook; anything else is dropped. + const webhook = + typeof invoice.webhook === "string" && /^https?:\/\//i.test(invoice.webhook) + ? invoice.webhook.slice(0, 2048) + : undefined; amount = Number.parseInt(amount || 0); tip = tip == null ? null : Number.parseInt(tip); |
