Skip to content

Sidechain spend window: sats in a record output are burnt without a warning; opt-in not enforced in the service worker #37

Done

Description

@jjohare

From a re-audit of main at bd39ce8. Context: src/sidestr/core.js:76 refuses any chain whose parent is a mainnet, so only test coins are exposed today. These should be closed before that gate is lifted.

What holds: signing is structured, not blind. The window rebuilds the UTXO set itself, discards the page's witness and computes the sighashes locally; the origin comes from Chrome's sender; trusted-origin and auto-sign settings never skip the window; and a spend digest cannot be confused with a Nostr event or NIP-98 signature.

  • Sats paid into an asset-record output are burnt with no warning. An OP_RETURN whose text matches issue:, tally: or pool: is classed asset-record whatever its value (src/sidestr/core.js:235). Burn warnings fire only for burn and pegout (src/sidestr/core.js:251-254), the window leaves asset-record out of the "Sending" list (popup/spend.js:135), and the details pane shows the record's text but not its value (popup/spend.js:189, :200). Reproduced: a transaction paying 1,000 sats to a recipient plus a record output carrying 998,000 showed "Sending: 1,000 sats", a normal fee and no warning. The only clue is that "Total leaving" exceeds sending plus fee. Fix: in review(), treat any OP_RETURN with value > 0 as a burn (warn, require the tick-box) and list it under "Sending" with its amount.
  • The opt-in is checked only in the window (popup/spend.js:305-313), not in spends.request (src/sidestr/spends.js:453-469). A page can open spend windows without limit while spends are off. Fix: check the setting in the service worker and fail fast; allow one pending spend per origin.
  • First-spend pinning trusts the highest claimed tip (vendor/sidestr announce.mjs:37, :61-66; src/sidestr/core.js:62; popup/spend.js:220). On a chain's first spend, whichever key announces the highest tip is used and then pinned. A lie about sat amounts fails safe, because the sighash commits to them; a lie about asset carries does not, and the real chain is then locked out. Fix: show the full signer key prominently on first spend, and refuse an announcement whose claimed tip has no matching header.
  • The vendored engine uses its own SHA-256 and BIP340 verify (vendor/sidestr/schema/codec/hash.js, secp256k1.js:155-175). That SHA-256 computes the digest the key signs. The engine already exposes setSha256Backend and a verify backend; nothing in src/ or popup/ sets them. Best changed upstream in @sidestr/spec and re-vendored, with BIP340/BIP341 vectors.
  • Mirror URL is whatever the announcement says (announce.mjs:52-54, explorer.mjs:67, :74, :79), fetched with <all_urls> privileges, including local-network hosts. Fix: require https: and refuse private and loopback hosts.
  • Display. A recipient's self-chosen profile name becomes the payee headline (popup/spend.js:105, :163); record and peg-out text is not stripped of bidi and control characters (popup/spend.js:148-152, :200).
  • No spending caps exist, per transaction or per day. Worth deciding before mainnet.
  • SIDESTR_SIGN_DIGESTS signs any 32-byte digests for an extension page holding a live request id (src/sidestr/spends.js:479-487); checking the digest count against the input count is a cheap guard.

Activity

  1. added
    bug
    on Nov 28, 2026
  2. jjohare commented on Nov 28, 2026

    @jjohare
    CollaboratorAuthor

    Addressed in 0.0.13 (a2265b7): any OP_RETURN carrying value is a burn and is listed; the opt-in is enforced in the service worker with one pending spend per site; the first spend shows the full signer key and refuses a tip the mirror does not hold; the engine's SHA-256 and signature checks use the noble libraries; mirror URLs must be public https; hidden and bidi characters are stripped and a self-chosen name is no longer the headline; the digest count must equal the input count. Spending caps are #46; the rest is in #47.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions