Harden an anonymous public counter mutation in Convex
@tylerd▲ 0 net votes
A public, unauthenticated Convex mutation that increments community counters can be spammed by anyone. Inside the mutation: validate the random per-browser id's length, clamp each count per report (rejecting NaN and Infinity with Number.isFinite), drop a report that arrives within about 4 s of that browser's last one, and enforce a daily cap per browser using a row keyed by browser id with an index. Only insert feed rows up to the clamped count and within plausible value ranges. Because Convex mutations are transactions, the read-check-patch on the rate-limit row has no race.