Skip to content

OpenReceive v0.6.8

Latest

Choose a tag to compare

@OpenReceive OpenReceive released this 02 Dec 23:50

Security

  • PHP: wallet events from the relay must carry the wallet's signature.
    The PHP engine's relay client and notification listener read an event once
    its author field named the wallet, without checking the event's id and
    signature. A relay could then attach an older wallet reply to a newer
    request, such as an invoice for a smaller amount to a larger order, or forge
    the wallet's info event. Every event is now checked against the wallet's key
    before any of its fields is read, as the Python, Ruby, Node and .NET engines
    already did, and the notification listener reads only the notification kind
    of the negotiated encryption. This affects every PHP integration (WooCommerce,
    Easy Digital Downloads, Magento, Shopware, PrestaShop, Sylius, Laravel,
    Symfony, Paymenter, FOSSBilling and HikaShop).
  • Every engine: an invoice for another amount is refused. The order is
    bound to the invoice's payment hash, so createCheckout now refuses a
    wallet invoice whose amount differs from the one requested (502
    UNSUPPORTED_METHOD, logged as checkout.invoice_amount.rejected) before
    any payer sees it.

Fixed

  • An unreadable wallet row no longer lets a paid order expire. Before an
    unpaid attempt closes as expired, the engine walks the wallet's history to
    prove it was never paid. A history row the engine skipped as unreadable
    could be that payment, yet the walk still counted as proof. Now a skipped
    row blocks closing anything by absence unless its payment hash is readable
    and belongs to none of the attempts being checked; rows that were read still
    settle. Four shared cases in wallet-scan-truncation.json hold every engine
    to the rule.
  • A settlement whose delivery failed is read again. The Rails, PHP, Python
    and .NET reconcile scans recorded a payment as settled before onPaid ran, so
    a delivery that failed or ran past the pass's deadline was skipped by later
    passes until the scan window wrapped. Only a delivered settlement is
    recorded now, as in the JS engine.
  • Price feeds and the swap provider can no longer hold a request open
    forever.
    The Ruby, Python, PHP and .NET fallback price feeds had no timeout, the
    Laravel and Symfony HTTP clients had none at all, and the JS feeds and
    FixedFloat reads stopped timing once the headers arrived. Every price-feed
    and swap-provider call now has a total timeout (5 s for the primary feed,
    10 s for the fallback feed and FixedFloat), body included.
  • A swap provider failure on a quote is the retryable 503. In the JS, Ruby,
    Python and PHP engines the quote called the provider outside the error
    mapping, so an outage or rate limit reached the payer as an opaque 500.
  • Garbage requests are refused before the database is read. The Rails,
    Python, PHP and .NET handlers ran the opportunistic reconcile pass (a database
    read and a gate claim) before the cheap request checks. They now check
    Sec-Fetch-Site, the content type, the JSON, the declared fields and the
    reference first, in the JS handler's order. PHP also reads a request body to
    its end; a short PSR-7 read could truncate it.
  • Laravel and Symfony: a relay that does not answer no longer takes the site
    down.
    Under PHP-FPM the boot preflight runs on every request, so one relay
    timeout with a cold cache made every page of the site answer 500. A bad
    code, a spend-capable wallet or a wallet that cannot receive still stops the
    app; a wallet or relay that does not answer is logged, and only the
    OpenReceive routes answer a retryable 503 until it does. Laravel's engine
    also follows a database reconnect (Octane, queue workers) instead of keeping
    a dead connection.
  • PHP and .NET: receive-only is proven from the connection's own
    get_info.
    Both clients took the method list from the wallet service's
    shared info event, so a hub that lists spend methods for the whole service
    refused a receive-only connection. They now ask get_info, as the JS engine
    does, and a get_info that lists spend methods still fails. PHP also reads a
    wallet reply whose e tag carries a relay hint instead of timing out.
  • .NET: an unreadable make_invoice reply is not sent again. A reply that
    decrypted but could not be read made the client send make_invoice a second
    time, which could create a second invoice. It now fails the request.
  • .NET: relay sockets close at shutdown. The engine, the ASP.NET Core
    runtime and the nopCommerce plugin now dispose the wallet client and its
    relay connections, and a client whose preflight failed is closed at once.
  • Doctors exit 1 when a check fails. rake openreceive:doctor,
    php artisan openreceive:doctor and bin/console openreceive:doctor always
    exited 0. They now also check that both OpenReceive tables exist, and exit 1
    when configuration, a required hook, the tables or the wallet preflight
    failed, so a deploy script can stop on them.
  • Symfony, Shopware and FOSSBilling: "the OpenReceive tables have not been
    migrated"
    now shows for a missing table through Doctrine DBAL too, instead
    of DBAL's raw TableNotFoundException.
  • Python: the notifications worker resubscribes when a relay closes its
    subscription.
    A CLOSED frame (relay limits, restarts, auth) left the
    worker on a socket that would never deliver again; it now reconnects on its
    usual back-off.
  • sequelizeDb(sequelize, "sqlite") works. Every statement failed with
    SQLITE_RANGE, because Sequelize's bind reads only $1 placeholders.
    SQLite now gets replacements, like MySQL.
  • Node: an app started before its migration recovers without a restart.
    The schema-version check cached its refusal forever; only a completed read
    is remembered now.
  • Node: unexpected 500s are logged, and a bad amountFor price is named. A
    request that ended in 500 INTERNAL logged nothing on the server; it now
    logs one redacted line with the method, path and request id. An amountFor
    that returns undefined, a fraction, NaN or a negative is a logged 500
    naming amountFor, not a 400 that blames the payer.
  • Express: app.use("/openreceive", openReceiveExpress(...)) serves the
    routes.
    Every route answered 404, because Express strips the mount path
    and the default prefix was still expected. A mount path ending with the
    prefix now counts as the prefix.
  • Express and Fastify (and Medusa and Vendure): a malformed Host header is
    the client's 400, not a 500.
  • Next.js: cors works. openReceiveNextHandlers() now also returns
    OPTIONS for the browser's preflight; see Upgrading.
  • The Node scaffold's onPaid records an outbox row instead of shipping.
    The generated wiring guide called shipOrder() inside the transactional
    onPaid, which runs again after a rollback.
  • Checkout: an expired swap shows one "New payment address" button.
    Reopening a checkout could serve an expired or failed swap address again; it
    never does now.
  • Checkout: the refund screens. The element's refund confirmation keeps the
    address in an editable, labelled field, locks its button while the request
    runs, and shows a short error inline; React's refund form does the same.
    Their text meets WCAG AA contrast in the light theme (it was as low as
    1.7:1).
  • Checkout: a swap status the provider cannot report shows "Status
    unavailable"
    and clears on the next good poll. A failed swap start no
    longer repeats its title as the detail.
  • Checkout: Copy works without the clipboard API (a selection fallback) and
    shows a check mark.
  • Checkout: screen readers and keyboards. A polite announcer reads swap
    status changes and the countdown at a few marks, focus moves to the new
    step when the screen changes under the payer, and the tutorial dialog keeps
    Tab inside it. React's checkout matches the element.
  • React: swap deposit and refund transactions link to a block explorer.
  • Vue, Svelte and Angular forward slot="order" content into the
    checkout's order slot, as React's children do. The element also no longer
    clears its own children while it has nothing to show, which removed
    Angular's projected content.
  • MySQL: large reconcile checkpoints fit. A checkpoint may reach 128 KiB,
    and the Rails, SQLAlchemy, PHP and .NET schemas gave it a TEXT column, which
    MySQL caps at 64 KiB: a strict-mode server refused the write. New installs
    get MEDIUMTEXT, as the JS engine already did; see Upgrading for existing
    ones.

Changed

  • PHP requires swentel/nostr-php directly, at the locked 1.9 line. The
    engine signs and verifies wallet events with it, and reached it only through
    dsbaars/nostr-php-nwc.

Docs

  • The guides index lists every guide and agent-directions file, the API
    reference documents the .NET engine, and the host-testing guide covers .NET
    and gives the reconcile gate's floor as 3 s.
  • The rate-limiting guide warns that most proxies append to X-Forwarded-For
    rather than replace it, so its first entry can still be forged.
  • The agent skill names openReceiveNextHandlers() and installs
    @openreceive/nuxt for Nuxt.

Upgrading

  • MySQL, existing installs. Postgres, SQLite and the JS engine need
    nothing; Magento applies the change on bin/magento setup:upgrade and
    nopCommerce when the plugin updates. Otherwise run once on MySQL.

    Rails and SQLAlchemy:

    ALTER TABLE openreceive_meta MODIFY value MEDIUMTEXT NOT NULL;

    PHP (Laravel, Symfony, Sylius, Shopware, WordPress, PrestaShop, HikaShop,
    FOSSBilling, Paymenter) and ASP.NET Core, with your platform's table prefix
    (wp_ on WordPress):

    ALTER TABLE openreceive_payments
      MODIFY checkout_data MEDIUMTEXT NOT NULL,
      MODIFY swap_data MEDIUMTEXT NULL;
    ALTER TABLE openreceive_meta MODIFY value MEDIUMTEXT NOT NULL;
  • Next.js with cors: export the new handler too:
    export const { GET, POST, OPTIONS } = openReceiveNextHandlers(...).

  • Deploy scripts that run a doctor (rake, artisan or bin/console openreceive:doctor) now stop when a check fails.