Skip to content

fix(nut17): decode notification payloads with subscription kind#2210

Merged
thesimplekid merged 1 commit into
cashubtc:mainfrom
thesimplekid:subsciption_kind_decond
Jul 8, 2026
Merged

fix(nut17): decode notification payloads with subscription kind#2210
thesimplekid merged 1 commit into
cashubtc:mainfrom
thesimplekid:subsciption_kind_decond

Conversation

@thesimplekid

Copy link
Copy Markdown
Collaborator

NUT-17 notification payloads are ambiguous without the subscription kind. Quote response shapes overlap and tolerate unknown fields, so shape-based decoding can select the wrong payload variant.

Add a kind-aware payload decoder and use it in the wallet subscription client while preserving the existing generic payload deserialization surface for backports.

This prevents onchain and custom quote notifications from being decoded as the wrong payload variant.

Description


Notes to the reviewers


Suggested CHANGELOG Updates

CHANGED

ADDED

REMOVED

FIXED


Checklist

  • I followed the code style guidelines
  • I ran just quick-check before committing
  • If the Wallet API was modified (added/removed/changed), I have reflected those changes in the FFI bindings (crates/cdk-ffi)

@thesimplekid

Copy link
Copy Markdown
Collaborator Author

@cdk-bot review

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.18321% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.93%. Comparing base (10cab2a) to head (419878e).

Files with missing lines Patch % Lines
crates/cashu/src/nuts/nut17/mod.rs 95.81% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2210      +/-   ##
==========================================
- Coverage   72.95%   72.93%   -0.02%     
==========================================
  Files         359      359              
  Lines       79276    79452     +176     
==========================================
+ Hits        57834    57952     +118     
- Misses      21442    21500      +58     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cdk-bot cdk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verified findings approved for disclosure:

  • Kind-aware notification decoding rejects case-insensitive PaymentMethod values (low) - A notification payload with a semantically matching but non-lowercase standard method, such as "BOLT11" for a bolt11_mint_quote subscription, is rejected before PaymentMethod can normalize it. In the wallet subscription stream this parsing error is propagated, terminating message processing for that stream.
    Additional locations included in summary:
    • crates/cashu/src/nuts/nut17/mod.rs:318

Comment thread crates/cashu/src/nuts/nut17/mod.rs
@thesimplekid thesimplekid force-pushed the subsciption_kind_decond branch from 8b002eb to 419878e Compare July 7, 2026 22:25
@thesimplekid

Copy link
Copy Markdown
Collaborator Author

@cdk-bot review

NUT-17 notification payloads are ambiguous without the subscription
kind. Quote response shapes overlap and tolerate unknown fields, so
shape-based decoding can select the wrong payload variant.

Add a kind-aware payload decoder and use it in the wallet subscription
client while preserving the existing generic payload deserialization
surface for backports.

This prevents onchain and custom quote notifications from being decoded
as the wrong payload variant.
@thesimplekid thesimplekid force-pushed the subsciption_kind_decond branch from 419878e to ba17883 Compare July 8, 2026 08:19
@thesimplekid thesimplekid merged commit ba17883 into cashubtc:main Jul 8, 2026
2 of 4 checks passed
@thesimplekid thesimplekid deleted the subsciption_kind_decond branch July 8, 2026 08:19
@github-project-automation github-project-automation Bot moved this from Backlog to Done in CDK Jul 8, 2026
@cdk-bot

cdk-bot commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Backport failed for v0.17.x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin v0.17.x
git worktree add -d .worktree/backport-2210-to-v0.17.x origin/v0.17.x
cd .worktree/backport-2210-to-v0.17.x
git switch --create backport-2210-to-v0.17.x
git cherry-pick -x ba17883082b80be99b293c1bf4537533aa915ecd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants