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

Fix `StaticInvoice::is_offer_expired` to check the offer's expiry

Public commit record

What the developer wrote

Authored by Elias Rohrer

73/100 · Adequate
Fix `StaticInvoice::is_offer_expired` to check the offer's expiry

The std-only `StaticInvoice::is_offer_expired` accessor delegated to
`InvoiceContents::is_expired`, which compares `created_at +
relative_expiry` against the current time — that is the *invoice*'s
expiry, not the offer's. The `_no_std` sibling and `flow.rs::
enqueue_static_invoice` already treat the two as distinct checks.

A payer or forwarder using the std API to decide whether to honor a
static invoice would therefore get the wrong answer in either
direction: forwarding offers the issuer has already retired (when the
invoice is still fresh), or refusing offers that are still valid (when
the invoice has aged past its `relative_expiry` but the offer itself
has no `absolute_expiry`).

Route the std accessor through `InvoiceContents::is_offer_expired` so
both the std and no-std paths consult the offer's expiry.

Co-Authored-By: HAL 9000
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

A bug in a Lightning payment library caused one of its functions to check the wrong expiration date. A function named `is_offer_expired` was accidentally checking when the invoice itself expires, rather than when the underlying offer expires. This could make a payer or forwarder reject valid offers or accept offers the issuer had already retired. The fix routes the standard-library version of the function to the correct offer-expiry check, matching the already-correct no-standard-library version.

Recommended action

Review any deployments using the `std` feature to decide whether to backport this fix, especially if `StaticInvoice::is_offer_expired` is used to gate payment forwarding or acceptance. The regression test should be run in CI for both std and no-std configurations.

Security signals we found

01

Logic bug causing wrong expiry check

02

Potential payment forwarding/acceptance of retired offers

03

Potential denial of service by rejecting still-valid offers

04

Regression test added

05

std/no-std behavior inconsistency fixed

Risk score

Why this scored 62/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 10/15
Affected reach 10/15
Confidence 8/10
Evidence quality 4/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.