| Tenant auth & Postgres RLS |
Frontend hides buttons while API routes trust client-supplied user_id or org_id values; Supabase tables leave RLS disabled or call SERVICE_ROLE_KEY on user requests. |
Enforce server-side session and JWT tenant checks on every query, test RLS policies with cross-tenant cases, and isolate service-role keys to background jobs. |
| Stripe webhooks & idempotency |
Webhook routes parse JSON without checking Stripe-Signature against the raw body, trust client plan prices, or omit unique event locks. |
Verify HMAC signatures on raw buffers, add unique event-ID database constraints, and attach idempotency keys to outbound billing calls. |
| Leaked keys & Git history |
OpenAI, Anthropic, Resend, or Stripe secret keys exposed in browser bundles or committed in earlier .env commits. |
Scan built client assets and full Git history, rotate exposed credentials, and move privileged SDK calls behind authenticated server routes. |
| Prompt injection & tool calls |
Uploaded PDFs, scraped pages, or inbound emails concatenated straight into system prompts with broad database or email tool access. |
Filter RAG vector queries by tenant in code, validate model outputs against strict schemas, and require user confirmation before state-changing actions. |
| Rate limits & LLM spend ceilings |
Public or free-tier endpoints firing multi-step model calls with no IP/user throttling, payload limits, or provider spend caps. |
Add sliding-window rate limits, cap input sizes and max_tokens, set per-tenant quotas, and turn on hard provider budget limits. |
| Migrations, pooling & backups |
Dashboard-clicked schema edits with no SQL migrations, serverless spikes exhausting max_connections, and point-in-time recovery turned off. |
Commit repeatable migrations to Git, configure transaction connection pooling, add missing foreign-key indexes, and test off-host database restores. |
| Logging, PII & rollbacks |
Blanket catch blocks that swallow failed orders silently or dump tokens and customer PII into logs, paired with deploys that cannot roll back cleanly. |
Set up scrubbed error alerting, separate staging from production keys and data, add CI checks, and document a 5-minute release rollback procedure. |