Repository navigation
Description
Summary
The signed token metadata edit flow has two compounding bugs in the off-chain server code: an unauthenticated rate-limit DoS that lets anyone freeze a creator's edit budget, and a nonce-ordering bug that burns nonces on RPC errors.
Bug 1: Wallet rate limit keyed on unproven wallet (rate-limit DoS)
app/src/app/api/launch/edit/route.ts and app/src/app/api/launch/edit/nonce/route.ts call rateLimited('edit:wallet:' + wallet, 10) before the signature or creator check. The wallet string is client-supplied and unproven at that point.
Anyone who knows a creator's public wallet address (available on-chain and in bb_launches) can send 10 unauthenticated POSTs with wallet=victim to exhaust the victim's rate-limit bucket. The victim's next real edit or nonce request gets 429 "slow down" until the 60s window resets.
The IP bucket (20 for edit, 30 for nonce) is a separate key, so one IP has headroom for 20-30 requests while spending 10 each against multiple victim wallets.
Bug 2: Nonce consumed before signature verification
app/src/lib/launchpad/editServer.ts applySignedEdit does UPDATE bb_edit_nonces SET used_at = now() before publicClient(chain).verifyMessage. The catch block maps RPC errors to valid = false, returning 401 "signature does not match" after the nonce is already gone.
A creator submitting a valid signed edit during an RPC blip gets their nonce burned and receives 401. They must request a new nonce and re-sign. No transaction wraps the consume + metadata INSERT, so a write failure also burns the nonce.
Combined with bug 1, repeated RPC blips within the 60s window can lock a creator out of metadata edits entirely.
Affected files
app/src/lib/launchpad/editServer.tsapp/src/app/api/launch/edit/route.tsapp/src/app/api/launch/edit/nonce/route.ts
Proposed fix
- Move the wallet rate limit inside
applySignedEditandissueNonce, after the signature/creator check, so only the proven wallet owner can spend their own bucket. - Move
verifyMessagebefore the nonce UPDATE. RPC errors return 503 instead of 401. Invalid signatures return 401 without consuming the nonce. - Wrap the nonce consume + metadata INSERT in
db.begin()so a write failure rolls the nonce back.
Severity
Medium. No funds at risk, no data loss, nothing permanent. Bug 1 is a targeted temporary DoS against a creator. Bug 2 is a reliability issue that compounds with bug 1. Both are exploitable by an unauthenticated caller with curl.
Activity