- LNURLcash: mint single notes directly when the mint rounds fees to whole
sats, recover lost direct-note funding, melt to the callback named in the
note's own withdraw info, and poll for settlement so redeems/reclaims
finish without waiting on the webhook. Read-only lookups use a pooled
client; every mutation stays on the no-keep-alive client.
- Webhook: expire replay markers only for payments without an invoice event,
so an event callback can never run twice.
- Tickets: on restart, enforce tickets that ran out while the bot was down
unless LNbits says the invoice was paid; drop stale ones without a ban.
- Telegram: register translated /faucet and /tipjar command aliases.
- i18n: load translations from one language list and log broken files.
- Config example: one entry per mint; ignore local docs/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Splits and melts went to the withdraw link, but mints such as
mint.600.wtf take mutations at the callback named in the note's own
withdraw info (/w/cb). The mint answered 200 without a status, which
read as an unknown outcome and left minting stuck in recovery. The
fake mint now behaves the same way.
- Count the LNbits routing reserve (max 1 sat, 1%) in the balance check.
- Allow several comma separated mints in one url entry.
- Format the LNURLcash help like the other help menus.
- Fix int64 passed to %s in the claimed, reclaimed, redeem and view
messages.
- Reword the in-progress and insufficient-balance messages in every
language.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A refused split after the funding invoice was paid left the funding or
change note in a bot-held row that nothing melted back. A job now splits off
the whole-sat part if needed and reclaims it to the owner's balance, retrying
hourly and alerting the operator once when it cannot.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The split burns the pasted note before the melt. A failed invoice or melt
used to leave the value in a bot-held split note while a second press
answered 'already claimed'. The retry now melts the split note.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- price map: guard with a RWMutex (fatal concurrent map access)
- InvoiceStream: stop on client disconnect, unsubscribe once, cap streams per wallet
- join tickets: key the ticket event per joiner; enforce tickets that
expired while the bot was down
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The bot signs the receipt for whatever p tag the request carries, so the
request must name the paid user, be kind 9734, carry one p tag and match the
amount. A zap request that fails to decode is rejected instead of continuing
with the fields read before the error. Users without a registered nostr
pubkey no longer get zap receipts.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- /group ticket del: only the chat creator may remove a group registration
- /node: always dial user-supplied node hosts through the netguard client;
drop the https://127.0.0.1 prefix exemption
- /app/@{username}: accept only username characters, render the greeting as
text, add basic security headers
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
All 78 note keys now exist in cs, de, es, fi, fr, id, it, pl, pt-br, ru
and tr as well as en and nl, with indexed verbs where a language orders
the arguments differently. The mint fee line goes through a key instead
of the library's English text. A test localizes every key in every
language and formats it with the English argument list.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
/note, /notes (list and batch), /redeem and /lnurlmints with confirm
dialogs, group posting with private receipts, claim notifications,
batch export as PDF/JSON/CSV, and LNURLcash notes detected inside the
existing /lnurl, paste and QR-photo flows. Plain withdraw links behave
as before. Two /lnurl log lines no longer print k1.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claim watcher, pending recovery (funding, carving, reclaims, redeems),
mint health and auto reclaim, with tests for lost webhooks, failed melts
and carving resumed after a crash.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Every secret is written encrypted before the first request leaves. Notes
are carved out of one funding note by split so each is a whole number of
sats, which LUD-25's exact-amount melt needs against LNbits' whole-sat
invoices. Tested against an in-memory LUD-25 mint and ledger, including
a dropped connection after an applied split and fractional external notes.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Pin btcec/v2 at v2.3.3: v2.3.4 changed ecdsa.SignCompact's signature and
lnd/keychain (via ln-decodepay) no longer compiles against it. The
lnurlcash package gets its Config with validation and an AES-256-GCM
cipher for note secrets at rest.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
internal/config.go panicked in init without a config.yaml and the i18n
loader only found translations/ from the repository root, so no test in
a package importing them could run. Config checks are skipped in a test
binary, the translation directory is located by walking up, GetAmount
no longer dereferences a nil price watcher, and the tooltip test expects
the text the code actually produces. Adds tests for amount validation.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sixteen log and error calls used a message, an LNURL string or callback
data as the format string. Go vet (printf check, Go 1.24+) fails the
test build on these.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A five-character domain was treated as an onion address (strings.Index
returned -1 == len-6) and the lnurlp:// scheme check tested an empty
string. Also: wrong format verb in the AnonID migration log, an error
that was built but never logged, an unreachable return, and the message
log line was passed as a format string.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
go run with the host's Go 1.21.6 reached 13 known net/http, crypto/tls
and crypto/x509 vulnerabilities, and golang.org/x/net was from 2021. The
module now asks for go1.26.11 through the toolchain directive (Go 1.21+
downloads it on first run) and uses x/net v0.62.0 and gorilla/websocket
v1.5.3. govulncheck is down to two findings in dependencies with no fix
(imroc/req v0.3.0, lnd v0.15 zpay32) that the bot's code paths do not
exercise.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Transaction.Send dereferenced a nil error when logging a failed DB save
after a successful transfer. satdress.SetupHttpClient type-asserted a
nil Transport for local nodes. The /node command shadowed the cert
variable, so a supplied certificate was never used and TLS verification
was always disabled for LND nodes.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The message interceptor logged every private text at Info, which put
bolt11 invoices, LNURLs, Cashu tokens and '/node add lnd <host>
<macaroon>' into journald. The API middleware logged the submitted key
of banned users. Both are redacted now.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The k and fiat branches returned the float conversion unchecked, so
non-positive, NaN or Inf inputs reached callers that have no guard of
their own (faucet total, ticket price, shop price, satdress amount).
Every branch now rejects non-positive and non-finite amounts and anything
above 10,000,000 sat. A faucet can have at most 1000 slots.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The group ticket event was stored under ticket:<groupID>, so a later
/join by another user overwrote the payer and the invite link went to
whoever joined last. The id now includes the payer.
The pay, LNURL-withdraw and group-ticket confirm handlers left their
object Active after success, so a second press repeated the request.
They now deactivate it.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Lock did a get-then-set on the map without holding mutexMapSync, and
Unlock removed the entry before unlocking it. Two handlers that arrived
for a name not yet in the map each got their own mutex, and a waiter
could end up holding a mutex that later callers could not see. Both let
two button presses run the same faucet or inline object at once.
Entries are now created and looked up under one lock and reference
counted, so they are only removed when the last holder unlocks. Tests
run 200 goroutines through Lock and LockWithContext under -race.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The webhook listener accepted any POST as proof of payment and fired the
invoice callbacks (inline receive, group tickets, satdress payout, DALL-E
refund) for whatever payment hash the body named. It now:
- limits the body to 1 MB and only accepts a 64-hex payment hash,
- asks LNbits whether the named wallet really received a settled
incoming payment for that hash, and uses the amount LNbits reports,
- handles every payment hash once (bunt key "webhook:<hash>"),
- refuses to dispatch an invoice event registered for another wallet,
- runs the callback with a recover, so a panic can't take the bot down.
The pure checks live in internal/lnbits/webhook/verify, which does not
depend on the bot configuration and is unit tested.
Port of kravens/BitTipBot b7e56da and 27eb079 onto our simpler handler.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
UpdateUserRecord wrote every column of the user it was given, so saving
a copy taken before a ban (cached user, stored inline object, invoice
event) lifted the ban. The banned flag and the admin key now always come
from the database row and are left out of the save; only the new
UpdateUserBan changes them, and the admin API uses it.
Manual port of kravens/BitTipBot 05c0a4e and dfc8d13.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Relay URLs come from the zap request. Keep at most 10 of them, only
wss://, and make the websocket dialer refuse non-public addresses.
Manual port of kravens/BitTipBot efe2fa2 (the only conflict was the
hard-coded default relay list, which is kept as is).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The confirm handler signed the stored challenge with the key of whoever pressed the button. Check the owner like the cancel handler does.
(cherry picked from commit 547568cadcfd28d5ae94a1eb30f25dd0cfa03f91)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Check the recipient where the money moves, so reaction tips, /send and inline sends to an existing placeholder wallet are covered too. The reply check in loadReplyToInterceptor is no longer needed and blocked /send with an explicit recipient.
(cherry picked from commit c8ea81d58aed2f288d0aee9fe63c3da08a97867c)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Telegram uses one shared fake user for all anonymous group admins and for messages sent as a channel. Such a sender must not own a wallet: reject its updates, do not tip it and do not create a wallet for it.
(cherry picked from commit 1b7478fc505b9ed388474192541185bc40569184)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
On nodes where the bot's public hostname resolves to loopback (hosts file,
split DNS), the public address check refused every payment to a lightning
address on the bot's own domain. The LNURL host and the LNbits host from
the config are now exempt from the check; literal internal addresses stay
refused.
Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qy4RRoDyYEWTZWESFHp7dp
(cherry picked from commit ba6c6a36293adf000c495cc81fdd18ecc96a69f6)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
satdress.SetupHttpClient changes the TLS settings of the transport it gets from network.GetClient. With one shared transport that switched certificate checks off for all later LNURL requests.
(cherry picked from commit 864cc7b3e7d6b4cd9b57ae84b5d2646f8ba3177f)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Add the benchmarking, reserved, NAT64 and 6to4 ranges, and refuse numeric host names such as 2130706433 or 127.1 when a proxy resolves the name.
(cherry picked from commit a802a59627acdc6400ac2ecf19c8e5cbcc2868e8)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The clients from network.GetClient fetch URLs that come from users and from remote LNURL servers. Without a proxy they now only connect to public addresses. The check runs at connect time on the resolved address, so it also covers redirects and hostnames that resolve to an internal address. With a SOCKS proxy, literal internal addresses and localhost names are refused.
(cherry picked from commit c3bcae870ec6018e8809d96f86b0d091ab124a5a)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The admin API (ban, unban, mutex, DALL-E toggles, pprof) had no authentication. Every request now needs 'Authorization: Bearer <bot.admin_api_token>'. Without a configured token all requests are rejected.
(cherry picked from commit 3fb544687d8cd8563f1e4e1720de1ef832653457)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>