mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 04:32:42 +00:00
The public POST surface lacked an origin gate, a rate-limit, and a schema — a peer could flood the wide-event log with arbitrary text under the `name` slot. Tighten the route: - Same-origin Referer check when `NEXT_PUBLIC_APP_URL` is set. - Per-IP `checkRateLimit` (60/min) matching the deploy-webhook shape. - Zod schema locks `name` to the six documented web-vitals identifiers; `id` capped at 50 chars; `value`/`delta` must be finite. Only validated fields enter the log envelope — the raw payload is never observed by the wide-event pipeline. 204 No Content on a successful enqueue keeps the `sendBeacon` contract intact; 400 on schema reject; 429 on rate-limit overflow.