aboutsummaryrefslogtreecommitdiffstats
path: root/routes
Commit message (Collapse)AuthorAgeFilesLines
* Admin only from Adam's addresses: the admin account's sessions and the admin ↵HEADmasterHEADAdam Soltys5 hours2-2/+5
| | | | | | | | | password are refused from anywhere else. After the 2026-12-04 desk breach the JWT secret was kept, so a copied or forged admin session must be useless off Adam's networks. config.adminIps lists exact addresses and IPv4 ranges; a request is judged by its Cloudflare client address (the app is only reachable through the tunnel and Caddy), and Tor pages never qualify. A global preHandler (after each route's auth) answers 403 to an admin session from elsewhere; the master-password login and freeze only accept adminpass from an allowed address. Unset or empty adminIps keeps the old behaviour. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6WoqaQDYdpWkatPCar
* Credit deposits to a retired hot wallet's addresses (legacyWallets).Adam Soltys8 hours1-1/+5
| | | | | | | 2026-12-04: the bitcoin hot wallet's keys were stolen, so coinos moved to a new hot wallet. Users still pay the deposit addresses the old one handed out. With the old wallet loaded and named in config.bitcoin.legacyWallets, /confirm treats it like the hot wallet (credited by invoice address, not as an account wallet) and catchUp lists its receives too, posting its own wallet name. The coins themselves are swept to the new wallet by a host-side job. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6WoqaQDYdpWkatPCar
* auth: lock PIN checks after ten wrong PINs in an hourAdam Soltys2 days1-3/+7
| | | | | | | | | | | | | Every PIN check answered right or wrong with no per-account limit (POST /pin, the sends that require a PIN, and the settings update), so anyone holding a stolen session could try every 6-digit PIN from rotating IPs. checkPin() now counts wrong PINs per account in pinfail:<id>; after ten in an hour every PIN check fails, the right PIN included, until the hour is up. A missing PIN doesn't count, and the right PIN clears the count. POST /pin answers 429 while locked. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6SSfVopM1ZzXKZmLYU
* rate limits: key per-account limits on the user, add them to on-chain sendsAdam Soltys2 days1-7/+12
| | | | | | | | | | | | | The token-keyed limits on /lightning/quote and GET /invoice/:id used the first 50 characters of the Authorization header, which are the same for every JWT, so all signed-in users shared one bucket. /lightning/quote now limits per user id (checked after auth), and GET /invoice/:id per IP like the other invoice routes. /bitcoin/fee and /bitcoin/send get a per-user limit of 10 a minute, and repeated fee-estimate failures log once per user per 10 minutes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6SSfVopM1ZzXKZmLYU
* users: unlink an anon account's pubkey only after the signature checks outAdam Soltys2 days1-2/+5
| | | | | | | | | | Updating your pubkey to one held by an anonymous account deleted that account's user:<pubkey> pointer before the signed challenge was verified, so a request with a bad signature still detached the key from its account. Do the unlink after verification succeeds. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6SSfVopM1ZzXKZmLYU
* register: cap account creation over Tor at five an hourAdam Soltys2 days1-2/+4
| | | | | | | | | | | | | | Onion clients all arrive from the Tor gateway's address, so the per-IP and per-range signup caps either let them create unlimited accounts or would count unrelated internal traffic. Mark requests that came through Tor (including ones the UI's server-side rendering relays, which forward the client address in cf-connecting-ip) with req.isTor, and give them one shared quota of five new accounts an hour for /register and first-time nostr logins. The recaptcha bypass for onion users now uses the same flag instead of trusting the Host header. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6SSfVopM1ZzXKZmLYU
* users: stamp v3migrated when an account hands its name to v3Adam Soltys3 days1-0/+6
| | | | | | | | | | | `migrated` has been set on every new account since 2023, so it can't tell the names registrar whether an account actually handed its name over. When the account's own session posts the hand-off, also record a server-set `v3migrated` timestamp, and include it in the public user fields so the registrar can require a fresh one before granting the name. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6SSfVopM1ZzXKZmLYU
* funds: say "Funds have been discontinued" when refusing a fund actionAdam Soltys9 days1-1/+1
| | | | | Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6W9CsdxmhFrfaKNVHU
* funds: include archived and pre-rotation history in GET /fund/:idAdam Soltys9 days1-4/+20
| | | | | | | | | | | A fund's older payments live in the archive, and funds whose id was rotated keep that history under their previous id, so the fund page only showed the most recent entries. Merge the live and archived lists for both ids (fund:rotatedFrom:<id> maps a rotated fund back to its previous id) and sort newest first. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6W9CsdxmhFrfaKNVHU
* funds: serve fund history to anyone; close manager changesAdam Soltys9 days1-13/+14
| | | | | | | | | | Funds are closed and every value-moving route refuses, so a rotated fund's old id now resolves to its history for any viewer, read-only. Adding and removing managers is refused as well, so a fund without managers can't be claimed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6W9CsdxmhFrfaKNVHU
* names: ignore registrar records held by blocked keysAdam Soltys10 days1-1/+3
| | | | | | | | | Names whose v3 record belongs to a key in names:blocked_holders are treated as unclaimed: lightning address, NIP-05 and legacy forwarding stay with the local account. Fails open if the registrar or db cannot answer. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6SEnsbshZrUDtTsxAX
* remove the Shopify webhook integration; add a migration kill switchAdam Soltys10 days1-2/+6
| | | | | | | | | Drop the /shopify route and the shopify user fields. POST /user with `migrated` fails while migrate:disabled is set, which stops the UI migration hand-off before the registrar grant is issued. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6SEnsbshZrUDtTsxAX
* webhooks, zaps: send user-supplied URLs through the SSRF guardAdam Soltys10 days1-8/+26
| | | | | | | | | | Invoice webhooks must be plain http(s) strings and are posted with safePost (checked, pinned address, no redirects). Zap requests resolve the recipient lud16/lud06 and callback through safeGot instead of fetching them as-is. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6SEnsbshZrUDtTsxAX
* confirm: accept only canonical txids from the node notify scriptsAdam Soltys10 days1-1/+21
| | | | | | | | | | Lowercase and validate the txid so a mixed-case txid cannot slip past the case-sensitive dedupe keys, refuse requests that came through Cloudflare or the onion, and require the TCP peer to be a node container or loopback so internal relays cannot reach it either. Validate type and wallet. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6SEnsbshZrUDtTsxAX
* payments: hold Lightning deposits back from on-chain withdrawalAdam Soltys10 days1-49/+0
| | | | | | | | | | | | | | | | While hold:enabled is set, Lightning deposits above a daily free allowance are held: they can still be spent over Lightning or sent internally, but not withdrawn on-chain or over Lightning into our own on-chain liquidity. The check and release run inside the atomic debit script, internal transfers carry the hold to the receiver, and old holds expire via scripts/holds.ts. The listener notes which peer each deposit arrived from for review. sendOnchain now refuses frozen accounts before building the transaction or locking its inputs, so a frozen account retrying withdrawals cannot hold hot-wallet UTXOs and make other sends fail with locked outputs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6SEnsbshZrUDtTsxAX
* ecash: answer a missing token with a plain errorAdam Soltys2026-11-131-1/+1
| | | | Co-Authored-By: Claude Opus 5.5 <[email protected]>
* lnurl: fetch user-supplied URLs through the SSRF guard, relay only protocol ↵Adam Soltys2026-11-132-7/+14
| | | | | | | | | | | | | fields Lightning address sends (pay() and POST /send/<lnaddr>) now validate the name and domain and fetch through safeGot instead of plain got. Zap receipt relays from the zap request must resolve to public hosts. The LNURL decode and proxy routes return only LNURL protocol fields instead of whatever JSON the upstream sent, and the proxy logs failures rate-limited with a generic error to the client. Also blocks the 172.42.0.0/16 docker range. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* login: tell the client when an account's password was resetAdam Soltys2026-11-041-0/+11
| | | | | | | | | A rekeyed account holds the literal "reset" instead of a hash, so no password can match. Return "account reset" so the client can send the owner to support. The check runs after the captcha and the per-IP failure cap, and counts as a failure. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* self-delete: use the full delall sweep, require the PINAdam Soltys2026-11-041-79/+11
| | | | | | | | | | | POST /delete now runs lib/deluser, the same sweep as scripts/delall.ts: it also disables the account's bolt12 offers on the node, removes the invoice pointer keys (invoice:<hash|text|offer_id>), covers sub-account invoices and deletes from the archive too. Offers are disabled before any key is deleted, so an unreachable node aborts with the account intact. Accounts with a PIN must now send it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* users: ignore pubkey on signup, revoke a rekeyed account's nostr keyAdam Soltys2026-11-021-1/+4
| | | | | Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6VN9xvnX1cgvV6hrUV
* payments: credit each on-chain output once and require uuid invoice idsAdam Soltys2026-11-021-0/+12
| | | | | Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6VN9xvnX1cgvV6hrUV
* apps: require a hex NWC pubkey and return only public fields for payment usersAdam Soltys2026-10-291-1/+8
| | | | | | | | | The app pubkey names both the app record and its payment list, so a non-key value could point a connection at another account's payments. Reject anything but a 64-character hex key on create and lookup, and trim the user attached to each payment to the public profile fields. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* register: check the reCAPTCHA v3 score, action and hostname; cap signups per ↵Adam Soltys2026-10-291-8/+133
| | | | | | | | | | | | | | | network siteverify answers success for any validly minted v3 token, so success alone let scripted signups through. Signup now needs the register action and a 0.5 score, and login 0.3. A token minted for another site is refused. The web signup page must send a token. Signups are capped per IPv4 /16 or IPv6 /48, hourly and daily, and those keeping the auto-filled animal+NN username are capped site-wide per hour. Turnstile is verified and logged only, on trial. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NfM8zA4DdKvW1316z4zCaD
* users: open pre-NIP-49 nostr keys with the account passwordAdam Soltys2026-10-291-5/+15
| | | | | | | | | Older accounts keep their nostr key as a password-encrypted seed (cipher + salt) rather than a NIP-49 nsec, so the reveal and signing paths treated them as having no key. On a verified password, /login and /nsec now convert it to a NIP-49 nsec, and hasnsec counts it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* users: let a password unlock the encrypted nostr key for any sessionAdam Soltys2026-10-131-0/+33
| | | | | | | | | | /me only reports hasnsec now, so sessions that didn't start with a password login had no way to reveal or sign with their key. POST /nsec returns it after re-checking the password, under the login per-IP failure limit. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UjHzoBmW1iPpEe5qC2LDYB
* login: drop the unused per-username failure counterAdam Soltys2026-10-131-7/+0
| | | | | | | | | The counter was incremented on every failed login and read but never acted on; the per-IP limits do the throttling. Its keys never expired and had grown to most of the keyspace. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UjHzoBmW1iPpEe5qC2LDYB
* users: keep the encrypted nostr key and 2FA seed away from bearer tokensAdam Soltys2026-10-081-3/+14
| | | | | | | | /me and user emits return a hasnsec flag instead of the encrypted key, which is now only sent with a password login or registration. /otpsecret refuses once 2FA is enabled, and disabling 2FA rotates the seed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* me: stop reporting archived balance as locked for frozen accountsAdam Soltys2026-10-081-16/+1
| | | | Co-Authored-By: Claude Opus 5.5 <[email protected]>
* email: escape support form HTML and enforce recaptcha v3 scoreAdam Soltys2026-10-061-37/+56
| | | | | | | | Escape the message body, stop accepting a client-supplied subject, strip control characters from header values, require the expected action and a minimum score from siteverify, and drop the adminpass captcha bypass. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* payments: lowercase payreq before looking up our own invoicesAdam Soltys2026-10-061-0/+5
| | | | | | | | | An uppercase bolt11 for a coinos invoice missed the getInvoice lookup, so it was paid over lightning to our own node instead of internally. The listener then saw the sender's payment pointer for that bolt11 and skipped crediting the recipient. Normalize in POST /payments and nwc pay_invoice. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Evicted accounts can't receive or log in; limit errors say what's happeningAdam Soltys2026-10-042-2/+11
| | | | | | | | | | | An evicted account no longer gets lightning-address invoices (stops a scam page's address from minting new ones) or a login token. A send over the server limit now says withdrawals are temporarily limited instead of a generic "Problem sending payment" that read as a frozen account. (Already live since the 2026-10-01 restart.) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011bvzKaZosXGHkigcGcSzAR
* lnurl: budget unauthenticated invoice generation per recipientAdam Soltys2026-09-291-5/+34
| | | | | | | | | | | | | GET /pay/:user/:amount and the lnurl callback create a CLN invoice and an entry in the recipient's invoice list for anyone holding the link, which a scanner on rotating IPs can do without tripping per-IP limits. Cap fresh invoices at 120 per recipient per hour (reused invoices don't count). Also fail cleanly for unknown usernames and skip invoice ids whose records no longer exist, instead of throwing on the null and breaking the pay page. Throttle the resulting lnurlp warnings per username. Co-Authored-By: Claude Fable 5.1 <[email protected]>
* logging: throttle log lines that clients can trigger at willAdam Soltys2026-09-291-4/+11
| | | | | | | | | | | | Evicted-JWT replays, blocked sends from frozen or limited accounts and failed payment retries each logged one line per request, so a looping client could flood the log, and an evicted token replayed across a proxy pool made atk-autoban.sh block every IP it saw. Add quiet()/suppressed() in lib/logging.ts: the first occurrence per key logs as before, repeats within the window are counted and reported on the next line that gets through. The evicted-auth summary line is worded so the auto-banner ignores it. Co-Authored-By: Claude Fable 5.1 <[email protected]>
* invoices: don't let a supplied id overwrite another user's invoiceAdam Soltys2026-09-291-0/+10
| | | | | | | | | | | | generate() writes invoice:<id> wholesale with the caller's uid, and the old bolt11 pointer keeps resolving to that id, so passing someone else's invoice id re-pointed their invoice at the caller's account. Invoice ids aren't secret (LUD-21 verify URLs, invoice pages, receipts), so refuse an existing id that belongs to a different user, both in generate() and in POST /invoice for anonymous pay-page callers. Both fail with "invoice not found" so ids can't be probed for existence. Co-Authored-By: Claude Fable 5.1 <[email protected]>
* ecash: drop anonymous token storage in favour of a stateless status lookupAdam Soltys2026-09-271-6/+8
| | | | | | | | | POST /cash stored any submitted string under a fresh id with no auth, no validation and no expiry. Replace it with POST /ecash/status, which checks a token the client already holds and returns its total, spent amount and mint. GET /cash/:id/:version stays so previously shared ids keep resolving. Co-Authored-By: Claude Fable 5.1 <[email protected]>
* lightning: don't wedge the listener on an already-credited preimageAdam Soltys2026-09-231-0/+7
| | | | | | | | Skip settlements whose preimage was already credited instead of retrying until the process exits, and reject previously used preimages when they are queued. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* parse: cache node aliases as a small map with a working timestampAdam Soltys2026-09-211-9/+13
| | | | | | | | | | The alias cache stored the full listnodes output as an array and hung its `last` stamp on that array, which JSON.stringify drops, and the refresh condition was inverted besides. Net effect: every lightning send page view refetched all ~16k nodes and rewrote ~10MB to the db. Keep only the id→alias map with a real timestamp and refresh it hourly. Co-Authored-By: Claude Fable 5.1 <[email protected]>
* lightning: log quote outcomesAdam Soltys2026-09-211-0/+2
| | | | | | | | The quote endpoint only logged failures, so a "send everything" that went wrong somewhere after the quote left nothing to correlate against. Log the solved amount and fees for max quotes and the fee for plain ones. Co-Authored-By: Claude Fable 5.1 <[email protected]>
* funds: close deposits, withdrawals and authorizationsAdam Soltys2026-09-211-17/+16
| | | | | | | | | | | | | | | | The fund mechanism is retired. Deposits (POST /payments with `fund`), withdrawals (POST /take) and pre-authorizations (POST /authorize) now refuse unconditionally instead of consulting the `fund:disabled` flag, so the door cannot be reopened by clearing a key. The deposit path never had a kill-switch of its own, so with the flag set users could still pay into funds they were unable to withdraw from. Read paths are left intact: GET /fund/:id and the manager endpoints still serve existing funds so balances stay visible and can be settled out of band. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
* users: reserve service names on registration and renameAdam Soltys2026-09-211-2/+2
| | | | | | | | | | | | A username is also a lightning address, so a name that reads as the service collects payments meant for it. "mint" was registered days after the ecash redesign freed it and received payments addressed to [email protected]; the reserved list held only "ecash", and was duplicated in two places. One shared list now, checked on both paths, covering the service-sounding names an account should never be able to take. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
* lightning: quote the routing fee up front and add a max-send quote endpointAdam Soltys2026-09-211-0/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Users trying to empty their balance over lightning had to guess a maxfee that covered both an unknown routing fee and the platform fee, and the 0.5% floor we imposed on that guess made an exact "send everything" impossible. xpay routes with askrene's getroutes, so ask askrene the same question before we debit and the fee is known exactly. lib/lnquote.ts mirrors what xpay does in plugins/xpay/xpay.c (v26.06): a throwaway private layer carrying the invoice's route hints (bolt11) or blinded paths via xpay's fake destination node (bolt12), then getroutes over the same layer stack in the same order. The fee is the sum of what leaves our node minus what the destination receives, rounded up to a whole sat since that is what xpay's maxfee reserves. POST /lightning/quote returns the routing fee, the platform fee exactly as debit() charges it (free-tier credit, ln:nofree rate, none on sub-accounts) and the total. With `max` it iterates quote / subtract fees / requote so amount + both fees lands exactly on the balance; an offer gets a probe invoice then the real one for the solved amount, and an LNURL caller can pass `ceiling` and a probe invoice the same way. sendLightning now quotes for every send. With no explicit fee the quote becomes the maxfee; an explicit fee below the quote is rejected before any debit instead of failing inside xpay after one; the old 0.5% floor on explicit fees is gone. If the quote itself fails we fall back to the heuristic and let xpay try. finalize rounds the settled fee up to the whole sat that was quoted and reserved; rounding a 301 msat fee to 0 refunded a sat that the quote had already accounted for and stranded it in the account. The prefer-kappa layer is only passed to xpay when it exists on the node; getroutes rejects unknown layers outright, which broke every regtest send. Co-Authored-By: Claude Fable 5.1 <[email protected]>
* lnurl: expire payRequest callback ids after seven daysAdam Soltys2026-09-161-3/+8
| | | | | | | | | A callback id is read once, minutes after the metadata request, and never again, but the pointer keys were written without an expiry and had grown to roughly 45% of all keys in the main database. Let the set helper take a TTL and apply one to both lnurl pointer keys. Co-Authored-By: Claude Fable 5.1 <[email protected]>
* ecash: redeem tokens by melting to the user's own invoiceAdam Soltys2026-09-163-128/+21
| | | | | | | | | | | Redeeming ecash is now a plain NUT-05 melt into a Lightning invoice owned by the redeeming user, credited by the regular lightning listener. Drop the house proof pool and its lock, the /mint and /melt routes, and the special-casing of a mint account in NWC and payment routing. Tokens are decoded against the mint's keyset list so short v1 ids resolve, and an empty keyset list is never cached. Co-Authored-By: Claude Fable 5.1 <[email protected]>
* printer: publish receipts at QoS 1 and clean LNURL metadata memosAdam Soltys2026-09-141-0/+1
| | | | | | | | | | | | Receipts were published at QoS 0, so a printer that was briefly offline (WiFi blip, keepalive timeout) never received them. QoS 1 lets the broker queue them for printers that hold a persistent session. LNURL-pay invoices carry the raw metadata array as their memo when the payer leaves no comment; unwrap the text/plain entry before printing. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_011cCouc5ASRXHDp5esLciEK
* ecash: make claims work against the v1 keyset mintAdam Soltys2026-09-141-6/+3
| | | | | | | | | | | | | | | cashu-ts 2.9.0 only derives v0 keyset ids, so CashuWallet rejected the mint's current keyset and receive() could never run. Build the wallet from keys preloaded off our own mint instead of verifying, decode tokens with the keysets (2.9.0 shortens v1 ids in the tokens it encodes, and won't expand them otherwise), and treat an unreadable house-pool value as empty rather than throwing — the pool key had been found holding a bare integer, which surfaced as "n.startsWith is not a function" on every redeem. The pool write is awaited so a dropped set can't strand freshly swapped proofs. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_0166Ci2XdCair1B9ych7w8dq
* security: drop the admin endpoint surface and land pending hardeningAdam Soltys2026-09-134-60/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removes the admin-gated endpoints and the account flags they set, plus a batch of hardening that had accumulated uncommitted in the tree. These were deployed and verified together, so they land as one change. admin surface: - drop POST /hidepay, POST /unlimit and GET /users, their handlers, and the now-unused admin preValidation export - `unlimited` was only ever written, never read; `hidepay` only appeared in output projections. Both flags go, along with their whitelist, public-fields and type entries. request log: - redactBody now recurses. It only masked top-level keys, so a body that nests credentials one level down wrote them to the log in plaintext, and pin fields were not on the list at all. payments: - sendOnchain/build gate `aid` through requireAccount, so a caller can only spend from an account it owns - sendOnchain signs only a tx we composed, matched against a short-lived per-account build receipt - raise xpay retry_for to 60s; route-finding preferred a drained zero-fee hop and burned the whole budget on it. check()'s reversal window keeps its 2x margin. ecash / invoices / webhooks: - resolve a token's mint through the IP-pinning fetcher instead of plain fetch, closing an unauthenticated SSRF path into the internal network - reject non-positive amounts before the balance write - /sign requires the caller to own the address, rather than signing under any address the hot wallet controls - webhook delivery no longer disables TLS verification; the body carries the merchant's shared secret registration: - refuse a username the v3 registrar holds unless the caller's own nostr key is the holder (lib/names.ts) liquid: - honour the deposit kill switch at invoice generation and at credit elements image: - pin 23.3.4 and verify the release tarball checksum Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0112TGi9GGNWqji1XQ5jZRzc
* flash: build each config image in its own temp dirAdam Soltys2026-09-041-6/+16
| | | | | | | | | | The handler wrote every request's config.txt and littlefs.img to the same paths, so two overlapping requests could hand one user the other's wifi key and API token. Use a per-request mkdtemp dir, read the image into memory, and remove the dir when done. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMi2Y1oKPZ3TeeFmLej47y
* flash: create printer dir and return errors instead of unhandled 500Adam Soltys2026-09-041-7/+13
| | | | | | | | | | The web flasher config endpoint wrote ./printer/config.txt without creating the directory, so on a fresh deploy it threw ENOENT and the JSON error body was flashed to devices as the LittleFS partition. Create the directory, validate inputs, and route errors through bail. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_014gVYGi29FjTeLdNTiutkZx
* fund: authenticated recovery of a rotated fund's old linkAdam Soltys2026-08-281-4/+29
| | | | | | | | | | | | | | | When a fund's secret id has been rotated (invalidating an exfiltrated id list), its old id 404s. Let a legit owner who bookmarked the old link find the fund again — but reveal the new id ONLY to an authenticated manager of the new fund, via a `fund:rotated:<oldid>` -> newid map. An anonymous caller or a non-owner gets the same "fund not found" as before, so an attacker replaying a leaked old id learns nothing (an open old->new redirect would defeat the rotation). The /fund/:id route now runs `optional` auth so req.user is available without requiring it; bearer funds with no managers are intentionally not recoverable this way. rotate-funds.ts records the mapping on any future rotation. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01DKkev76U4YRnRAqM6jqbae
* login: fail-open recaptcha verify on infrastructure errorsAdam Soltys2026-08-251-2/+17
| | | | | | | | | | | | | | | | | | verifyRecaptcha failed closed on ANY error from the Google siteverify call, so a transient coinos<->Google network blip (or a Google slowdown) turned every non-admin login into a "failed captcha" 401 until connectivity recovered — a self-inflicted login outage from an external dependency. Distinguish a real verdict from an infrastructure failure: fail CLOSED only on a genuine success:false from Google; on a thrown error (network, timeout, 5xx) fail OPEN and log it. Reaching Google is not part of authentication — the password and the per-IP login rate limits still gate the request, and captcha is only bot-mitigation, so allowing a login through when the verifier is unreachable is the safer failure mode. Also bound the call with a 6s timeout so a slow verifier can't hang the login. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01XiwgmQKwKnRxUmVDd4xSf7