2026-06-26 · engineering
open-threads audit: 123 findings closed in a day
v2.0 shipped on the 21st. between then and the founder cohort opening up, we wanted the repo at a state where every TODO in code, every gap in a runbook, and every loose security thread was either closed or explicitly deferred with a reason. so we audited.
12 parallel discovery passes across the whole tree: code todos, disabled tests, architecture-doc gaps, stale state, brand-firewall residue, broken builds, incomplete features mentioned in commits, mock placeholders, instrumentation gaps, migration consistency, dependency drift, README open items. one completeness critic on top. adversarial verify against every finding.
252 confirmed findings. 129 already documented as post- launch (no action). 123 actionable. closed in one push.
security tier (15 items)
open redirect on the discord oauth callback fixed —?next=//evil.com was being concatenated without validation. new safeNext() helper parses through URL with origin as base + requires same-origin before returning the path. applied to both callback and login routes.
rate limiting across 15 endpoints via upstash redis — per-IP on the unauthenticated launcher surfaces, per-user for auth'd ones, per-code/per-token for the bits where brute-force defense matters (auth poll, activation submit). fail-open by design: missing env vars warn once on cold-start, requests pass through. local dev unblocked, missing-in-prod surfaces loudly.
CSRF middleware extended from the proven origin-allowlist pattern on logout out to every state-changing browser POST: ideas/vote, ideas/submit, /me/email, checkout, billing portal, admin/ideas. webhooks (stripe sig verified) and crons (Vercel auth header) keep their own auth model. launcher routes use CORS + JWT and aren't browser-origin — rate-limit there, not CSRF.
RLS made explicit on three tables that had it enabled but zero policies (launcher_sessions, drop_host_versions, founder_slot_reservations) — default-deny was doing the right thing, but the schema-reader couldn't tell intentional from half-finished. explicit deny + COMMENT ON TABLE so the next maintainer doesn't have to dig.
info-disclosure scrub
new safeError() wraps every Supabase / R2 / crypto failure so the client gets a generic message while the real one still hits console.error for Sentry pickup. IP + UA on forensic columns now trim to the network prefix and 80 chars — enough to spot "same machine, two installs" without storing per-user identifying data we don't need.
Sentry beforeSend hook recursively scrubspayment_intent, customer_email, cookies, authorization headers — caps every string at 500 chars before anything reaches the dashboard. sendDefaultPii: false on both runtimes.
discord webhook URL was logging the first 60 chars of its bearer-token-bearing URL on bot bootstrap. now logs the webhook id only.
ops floor: runbooks
five runbooks. secret rotation (per-secret procedure for every rotatable credential). incident response (stabilize → triage → communicate → fix → postmortem). backup + restore (supabase snapshots, weekly pg_dump to R2, R2 mirror plan, monthly drill template). R2 outage (detect → comms → mitigate → failover). signing-worker recovery (queue diagnosis, cert/prov rotation, re-queue rules, capacity).
weekly postgres dump to R2 lives as a systemd timer on the production box. ran for the first time this morning, 95KB compressed, restored cleanly into a throwaway postgres container. next sunday it ships itself.
commerce edge cases
webhook idempotency bug — the stripe_events insert was happening BEFORE the handler ran, so a handler that threw left a "seen" row behind and stripe's retry hit the replay branch without re-running. fixed: insert after handler succeeds. failed events now actually retry.
missing customer.subscription.created handler added — stripe can deliver .created before or after checkout.session.completed. routing both through the same handler keeps state convergent regardless of arrival order.
past-due grace window extracted to a shared constant. it was duplicated across the webhook handler, the past-due-sweep cron, and the layout banner — bump one number, the other two silently disagreed about when a card becomes delinquent.
quieter wins
audit log writer used across 12 newly-instrumented endpoints. iOS install timeout moved from a hardcoded 120s to a 5-min default + Info.plist override. android release keystore wired to env-backed signing config (the debug keystore was a play-protect warning waiting to happen). upstream-mirror integrity check on audio++ patch — signer cert fingerprint pinned, fail-closed on drift. db hygiene migration drops the unused license_tokens table, adds two missing indexes, wires a daily cleanup cron for expired launcher_auth_codes.
what stays deferred
test infrastructure (still zero tests — explicit decision for v1.0). native iOS CI for the launcher. windows .lnk shortcut creation. tier 3 encrypted drops on windows. off-provider R2 mirror — revenue-first call; binaries are reproducible from git anyway. all documented in the architecture status table.