AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 26 Bitcoin

Split `OffersContext::OutboundPayment` into `InRefund`/`InInvReq`

Public commit record

What the developer wrote

Authored by Matt Corallo

85/100 · Strong
Split `OffersContext::OutboundPayment` into `InRefund`/`InInvReq`

Because they end up both being used to validate a `Bolt12Invoice`,
we ended up with a single `OffersContext` both for inclusion in a
`Refund` and an `InvoiceRequest`. However, this is ambiguous, and
while it doesn't seem like an issue, it also seems like a nice
property to only use a given `OffersContext` in one place.

Further, in the next commit, we use `OffersContext` to figure out
what we're building a blinded path for and changing behavior based
on it, so its nice to be unambiguous.

Thus, we split the single existing context into
`OutboundPaymentInRefund` and `OutboundPaymentInInvReq`.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This commit refactors how the Lightning Dev Kit tracks whether a BOLT12 invoice is tied to a Refund versus a regular InvoiceRequest. Previously, one shared context type was used for both, which could lead to ambiguous handling. The change splits that shared context into two distinct variants and adds checks so that Refund-only contexts are only accepted for Refund invoices and InvoiceRequest contexts only for Offer invoices. It is a hardening/correctness change rather than a clear-cut security fix, but it removes ambiguity that could in principle be abused to trick the code into accepting an invoice in the wrong context.

Recommended action

Treat as a defensive hardening commit. Review the follow-up commit referenced in the message to confirm that behavior changes based on the new context types do not introduce new validation gaps. Ensure downstream serialization compatibility is handled for the renamed enum variant and new tag.

Security signals we found

01

Removes ambiguous shared context that was used for two different BOLT12 flows

02

Adds explicit type checks before verifying Bolt12Invoice against payer data

03

Moves invoice verification logic into a dedicated offers flow module

04

Prevents an OutboundPaymentForOffer context from being accepted for a Refund invoice and vice versa

05

Commit message explicitly notes the ambiguity and the desire to avoid it

Risk score

Why this scored 26/100

Our methodology →
Potential impact 5/30
Exploitability 3/25
Stealth signal 4/15
Affected reach 5/15
Confidence 6/10
Evidence quality 3/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.