gl-client/gl-sdk: Harden LNURL-pay against real-world services#702
Merged
cdecker merged 1 commit into2026w15-lnurlfrom Apr 24, 2026
Merged
gl-client/gl-sdk: Harden LNURL-pay against real-world services#702cdecker merged 1 commit into2026w15-lnurlfrom
cdecker merged 1 commit into2026w15-lnurlfrom
Conversation
5 tasks
Collaborator
|
Thanks @angelix, I'm surprised by the fact that the metadata match check is giving issues, then again, why am I surprised that the spec is not being followed? 😉 |
83df44e to
5a5a308
Compare
Gaps surfaced when paying stacker.news exposed several mismatches
between the current implementation and what wallets need in practice.
Changes align gl-sdk's LNURL-pay surface with the LUD specs and with
what Breez SDK does for the convention-level gaps:
- Parse LUD-06 service errors: callback responses with {"status":"ERROR"}
are now recognised and surfaced as LnUrlPayResult::EndpointError with
the service's reason, instead of failing JSON deserialization.
- Add LnUrlPayResult::PayError { payment_hash, reason } so CLN pay-side
failures return structured results rather than Error::Rpc.
- Pre-flight amount/comment validation in gl-sdk::lnurl_pay to reject
out-of-bounds requests before any network round-trip.
- Drop the description_hash == SHA256(metadata) check that rejected
compliant-enough services whose metadata embeds per-request data.
- Skip the empty `comment` query param in the callback URL when the
caller passes None or an empty string.
- Enforce LUD-09/10 bounds on SuccessAction payloads (Message/Url
description ≤ 144, AES description ≤ 144, ciphertext ≤ 4096, IV
exactly 24 chars) before any AES decryption.
- Validate the invoice's BOLT-11 currency prefix against the node's
configured network; thread `network` through Node::with_signer so
the check has something to compare against.
- Validate that a URL success action's domain matches the callback
domain, with an opt-out via LnUrlPayRequest.validate_success_action_url
(defaults to true).
- Sync the gl-sdk-napi (Node.js bindings) shapes: add
validate_success_action_url to the NAPI LnUrlPayRequest, add
LnUrlPayErrorData and the "pay_error" discriminator on LnUrlPayResult,
wire the new variant through napi_lnurl_pay_result_from_gl.
5a5a308 to
6ecde83
Compare
Collaborator
|
Fixed the error in #701 and rebased on top of it. Merging as soon as green. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gaps surfaced when paying stacker.news exposed several mismatches between the current implementation and what wallets need in practice. Changes align gl-sdk's LNURL-pay surface with the LUD specs and with what Breez SDK does for the convention-level gaps:
commentquery param in the callback URL when the caller passes None or an empty string.networkthrough Node::with_signer so the check has something to compare against.