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

lsps-plugin: use lsps-types for the protocol types

Public commit record

What the developer wrote

Authored by Peter Neuroth

78/100 · Adequate
lsps-plugin: use lsps-types for the protocol types

Replace the plugin's copies of the JSON-RPC, LSPS0 and LSPS2 protocol
types and of the opening fee computation with the ones from
lsps-types, so client and service share one implementation. The
plugin's proto modules re-export lsps-types for now; the imports are
switched in the next commit.

Service-only code stays in proto/lsps2.rs: the policy plugin API, the
datastore entry, JIT scid generation, the BOLT4 failure codes and the
HMAC promise. The HMAC check moves out of `OpeningFeeParams::validate`
into `verify_promise()`, which `lsps2.buy` calls before
`OpeningFeeParams::validate()`. The order of the checks and the error
codes are unchanged: bad promise or expired params -> 201, fee overflow
-> 203, fee not below the payment size -> 202.

Other adaptations, no behavior change:
- `into_request()` with a random id becomes an extension trait in the
plugin, so lsps-types does not need `rand` and `hex`.
- `ShortChannelId` is converted via u64 where it meets cln-rpc (the
`htlc_accepted` onion, the client's datastore record).
- `DateTime` is converted with `as_chrono()` where the plugin computes
with chrono values.

The one behavior change from switching is the promise character check
that lsps-types added in "lsps-types: restrict promise to printable
ASCII without JSON escapes".

Changelog-None
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit is a code cleanup in Core Lightning's LSPS (Lightning Service Provider Specification) plugin. It removes duplicated protocol type definitions and replaces them with a shared library called lsps-types. The only functional change mentioned is a stricter check on the 'promise' string, limiting it to printable ASCII characters without JSON escape characters. This is a hardening improvement, not an obvious vulnerability fix.

Recommended action

Treat as a routine refactoring/hardening commit. Review the lsps-types implementation of OpeningFeeParams::validate, verify_promise, and promise parsing to confirm the stricter character check is correctly enforced and that the shared library preserves the existing HMAC and fee-overflow semantics. No urgent mitigation is indicated by this commit alone.

Security signals we found

01

Refactoring to shared library reduces duplicated security-critical code (HMAC, fee validation)

02

HMAC promise verification extracted into separate verify_promise() function

03

Stricter promise character validation added by lsps-types (printable ASCII, no JSON escapes)

04

No changelog security entry; commit message says 'Changelog-None' and 'no behavior change' except promise restriction

Risk score

Why this scored 24/100

Our methodology →
Potential impact 3/30
Exploitability 4/25
Stealth signal 3/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.