Primary finding
Health endpoint can be abused as a low-cost DoS amplifier against Postgres
lowsecuritymedium
- apps/web/app/api/health/route.ts:33-65
The GET handler is unauthenticated and performs a database round-trip on every call. Because `dynamic = "force-dynamic"` disables caching and there is no rate limiting, an attacker (or a misconfigured external monitor) can drive arbitrary load to Postgres by spamming /api/health. For an application-level health probe this is the conventional trade-off, but it is worth gating with a short in-memory cache (e.g. cache the last result for ~5s) or with the same CRON_SECRET style bearer the cron sweep uses, especially since one of the required env vars is `CRON_SECRET`.
Recommendation
Either (a) memoize the readiness result for a few seconds in-process to bound DB QPS, or (b) require a shared-secret header for the readiness variant and keep an unauthenticated liveness path that does no DB work.