routerrpc: reject payment to invoice that don't have payment secret or blinded paths#9752
Conversation
|
Important Review skippedAuto reviews are limited to specific labels. 🏷️ Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
ada4d4e to
69e180c
Compare
670fca4 to
b37fe55
Compare
b37fe55 to
bb59d52
Compare
MPins
left a comment
There was a problem hiding this comment.
Hello @erickcestari, could you please split the commit into two? One for the code changes and another for the documentation. Thanks!
bb59d52 to
50cc265
Compare
There was a problem hiding this comment.
Hi @erickcestari , consider adding a test case to TestExtractIntentFromSendRequest in router_backend_test.go to cover this scenario.
50cc265 to
6e7034a
Compare
2395167 to
51b1059
Compare
|
Hello @saubyk it would be nice to have the CI Workflow running for this PR. |
51b1059 to
ca77283
Compare
|
@erickcestari, remember to re-request review from reviewers when ready |
|
Approved CI. |
ca77283 to
c6abfff
Compare
|
Rebase conflict is preventing CI from running for some reason... |
2de5604 to
36675bd
Compare
Rebased |
c5ca026 to
3e7a64c
Compare
|
Needs to update lnd/lnrpc/routerrpc/router_server.go Lines 1506 to 1511 in fe40542 |
|
Missing payment_addr enforcement also for the following RPC calls:
With the restriction on decoding we have to be careful because all our keysend payments inject an invoice with a zero payment_addr into our invoice store, so they do not have a valid payment_addr but we should still be able to decode them. All those changes can be done in a followup PR as well imo. |
3e7a64c to
0966b27
Compare
Does keysend use the |
No we do not support it: Line 1409 in 79294df |
|
But probably all the adoption of RPC should be done in a follow-up. And I am not sure whether we can ever can remove the decoding. Tho I do not see a need to do so anyways. Why not keep the decoding at least available. |
|
Yes, I agree. Since keysend relies on invoices with zero payment addresses, phase 2 might be problematic.
Maybe we could focus on completing phase 1 across the other payment RPCs first? We might be able to achieve the spec goals through payment validation alone while keeping things working for keysend. |
b5d3d43 to
d2634a6
Compare
ziggie1984
left a comment
There was a problem hiding this comment.
Pending comments, then gtg 🤝
ellemouton
left a comment
There was a problem hiding this comment.
looks good! one or two style nits
| expiry := payReq.Expiry() | ||
| validUntil := payReq.Timestamp.Add(expiry) | ||
| if time.Now().After(validUntil) { | ||
| if clock.Now().After(validUntil) { |
Refactors payment request expiry validation to use an injected clock dependency instead of calling time.Now() directly.
Ensure that a payment is only sent if the invoice includes either a payment address (payment secret) or at least one blinded path.
d2634a6 to
831fefe
Compare
This PR introduces the initial phase of enforcing payment secret validation for invoices, as described in issue #9718.
Change Description
Adds validation to
extractIntentFromSendRequestto ensure that an invoice includes either a payment address (payment secret) or at least one blinded path when parsing the SendRequest details.Related to: #9700, #9718