ReviewOS

stacks/ts-analytics

CRITICAL: process-random daily salt inflates unique visitors per instance/restart

#165
Closed glennmichael123 opened this 9 days ago ·
9 days ago

Daily salt = HMAC(secret, date) with a process-random secret when ANALYTICS_SALT_SECRET is unset (src/lib/salt.ts) — and no deploy artifact sets the env var. Live-proven: a server restart turned 1 visitor into 2. On Lambda every concurrent instance mints its own salt, so uniques scale with instance count. Fix: persist SALT#DAY#{date} in DynamoDB via conditional put (first writer wins, cache in-process for the day); wire ANALYTICS_SALT_SECRET into every deploy generator; hard-fail in production when unset.

From the production-readiness audit (docs/research/production-readiness.md, eacf996). Verified with live probes where stated.

Sign in to comment on this issue.