Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoice Acceptor: ensure asset ID match between RFQ and HTLC #1299

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

GeorgeTsagk
Copy link
Member

Description

This PR adds an extra strictness check which requires the asset ID of the RFQ quote and HTLC records to match. This is done as an extra strict check to guard against HTLC and RFQ asset ID mismatch, which can lead to malicious behavior where a quote for a different asset is being accounted for when accepting an asset HTLC.

Closes #1255

@GeorgeTsagk GeorgeTsagk self-assigned this Jan 14, 2025
Copy link
Contributor

@ffranr ffranr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!

tapchannel/aux_invoice_manager.go Show resolved Hide resolved
@dstadulis
Copy link
Collaborator

TODO

  • itest to cover the negative cases

@dstadulis dstadulis added this to the v0.6 milestone Jan 14, 2025
We add a simple assetIDFromQuote function that fetches the asset ID
associated with a certain accepted quote identified by its rfq ID. We
will later use this in the handleInvoice function to compare the asset
ID of the quote with that of the HTLCs.
In this commit we use the previously defined helper to fetch the asset
ID of the accepted quote, then we compare it with the asset ID of each
HTLC. This is done as an extra strict check to guard against HTLC and
RFQ asset ID mismatch, which can lead to malicious behavior where a
quote for a different asset is being accounted for when accepting an
asset HTLC.
@GeorgeTsagk GeorgeTsagk force-pushed the inv-accept-asset-id-match branch from 7eb3643 to ef54607 Compare January 16, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

Assert invoice-RFQ asset ID and HTLC asset ID match
3 participants