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

Centralize custom TLV validation behind `CustomTlvs`

Public commit record

What the developer wrote

Authored by shaavan

73/100 · Adequate
Centralize custom TLV validation behind `CustomTlvs`

Introduce a `CustomTlvs` wrapper to move sorting and validation of custom
TLVs out of `RecipientOnionFields` and into a dedicated type.

This makes TLV validity an explicit construction-time concern, allowing
`RecipientOnionFields` to assume correctness and remain a simple data
carrier. In turn, custom TLV usage becomes easier to extend without
duplicating protocol checks.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit is a code cleanup, not a security fix. It moves the existing checks that validate custom Lightning payment data (custom TLVs) from one place in the code into a new dedicated wrapper type called RecipientCustomTlvs. The same rules—type numbers must be large enough, must not duplicate reserved protocol types like keysend, and must not repeat—are preserved. No new restrictions are added and no vulnerability is described.

Recommended action

No security action required. Treat as ordinary refactoring. If reviewing, confirm that all previous call sites now construct RecipientCustomTlvs and that no new path bypasses validation.

Security signals we found

01

Refactor only: validation logic moved, not changed

02

Return type of with_custom_tlvs changed from Result to Self because validation now happens earlier in RecipientCustomTlvs::new

03

Same reserved-type rejections retained: keysend (5482373484) and async-payment invoice request (77_777)

04

No CVE, advisory, or security-relevant description in commit message or diff

Risk score

Why this scored 12/100

Our methodology →
Potential impact 0/30
Exploitability 0/25
Stealth signal 0/15
Affected reach 0/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.