Skip to content

Uncorrelated payment_required notifications trigger auto-payment #65

@1amKhush

Description

@1amKhush

The client's payment handler executes blindly without requiring a verified request correlation. The recent fix successfully drops correlated notifications (where the e tag is present but invalid). However, if a notification is sent without an e tag (an uncorrelated notification), correlatedEventId is undefined. This bypasses the new check in nostr-client-transport.ts entirely, forwards it as 'unknown' to client-payments.ts, and still executes the payment handler blindly.

To Reproduce

  1. Send a payment_required notification to the client without an e tag.
  2. The notification bypasses the correlatedEventId check since correlatedEventId evaluates to undefined.
  3. client-payments.ts receives 'unknown' as requestEventId and pending evaluates to undefined.
  4. The handler still evaluates handler.canHandle(req) and executes handler.handle(req).

Expected behavior
The client must enforce correlation. If pending is undefined (or requestEventId === 'unknown'), the payment request should be immediately rejected or dropped.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions