// docs / security guides / lovable checklist
Lovable security checklist: 25 items before launch
Lovable is a fast path from idea to a published full-stack app on Supabase and Vite. This checklist targets the risks that come with that stack: RLS that must be enabled and tightened on every table Lovable creates, test keys from integrations, import.meta.env leaking env vars into the Vite bundle, GitHub sync exposing secrets, and missing security headers. 25 items across secrets, database, auth, headers, deployment, and Lovable-specific gotchas.
PRE = pre-deploy (audit your source). DEPLOY = at deploy time. POST = post-deploy verification.
Secrets and API keys (5 items)
Lovable's marketplace integrations and Vite build can leak env vars into the client bundle if not careful.
- PRE — Audit
import.meta.envreferences. Vite exposes allVITE_prefixed vars asimport.meta.env.VITE_*in the client. Never useVITE_SUPABASE_SERVICE_KEYorVITE_STRIPE_SECRET. Route through a server-only endpoint instead. - PRE — Replace Lovable marketplace test keys with live restricted keys. Lovable's Stripe / Resend / etc. integrations sometimes ship with
sk_test_*orpk_test_*keys. Before going live, swap them with live restricted keys that limit damage if compromised. - PRE — Check the
.envfile is not committed. Lovable scaffolds an.envfile with integration keys. Rungit ls-files .env. If it's tracked, remove it immediately:git rm --cached .envand add to.gitignore. - PRE — Verify GitHub sync doesn't expose service keys. If Lovable syncs to GitHub, confirm the GitHub Actions workflow or Vercel settings don't echo secrets into build logs. Check your Actions → Workflow runs → click a run → see if any secret is printed.
- POST — Run Secrets in JavaScript Bundles on the deployed app. Lovable's Vite build can leak keys into
import.meta.env. A passive scan will find them.
Database access control (5 items)
Every table Lovable creates needs RLS enabled and tightened before production.
- PRE — Enable RLS on every public table. In Supabase Studio, Tables → for each
public.*table → the RLS toggle must be ON, with policies for each command. - PRE — Write explicit policies per table and role. Minimum: SELECT allows user to read only rows where
user_id = auth.uid(). Lovable sometimes generates tables without policies; you must add them. - PRE — Check Lovable's generated policies, not just the toggle. A policy such as
USING (true)keeps RLS "on" while letting every caller through. Scope each policy toauth.uid(). (FORCE ROW LEVEL SECURITYonly affects the table owner; it does not fix an open policy.) - DEPLOY — Re-verify RLS is enforced after deploy. Open Supabase Studio post-deploy. Each table's RLS toggle should be ON. If not, your migration didn't apply.
- POST — Run a FixVibe scan on the deployed app. Check the Supabase Row-Level Security result: it shows any table an anonymous visitor can read with your public key.
Authentication and sessions (4 items)
Lovable's auth is Supabase Auth. The risk is in how Lovable wires it together.
- PRE — Ensure all API routes use
getUser(), notgetSession().getSession()reads an unverified cookie;getUser()validates with Supabase. Search forgetSession()in API handlers and replace it. - PRE — Check Lovable's generated auth handlers for token expiry. Magic-link tokens need server-enforced expiry. Default is 1 hour — don't override unless essential.
- PRE — Audit the sign-in redirect guard. The
nextquery param must start with/, never//. If missing, add the guard manually. - POST — Test logout destroys the session. Sign in, sign out, inspect cookies (DevTools → Application → Cookies). The session cookie must be cleared.
HTTP headers and CSP (3 items)
Lovable's Vite scaffold doesn't add CSP by default. Static hosts require explicit header configuration.
- PRE — Add security headers via your host's config. Vercel:
vercel.jsonheadersarray. Netlify:_headersfile. Include CSP, HSTS, X-Frame-Options, X-Content-Type-Options. - PRE — CSP must not have
'unsafe-inline'inscript-src. Use nonces or hashes. Lovable's Vite build will work with strict CSP. - POST — Run HTTP Security Headers on the deployed URL. The check reports missing headers and provides platform-specific fix guidance.
Deployment hygiene (5 items)
Lovable hosts published apps itself (Lovable docs). If you export the code and deploy it to Vercel, Netlify or Cloudflare Pages instead, each host handles headers and env vars differently.
- DEPLOY — Scope env vars to Production only. Vercel: Settings → Environment Variables → scope each to Production. Never share test Stripe keys with Preview.
- DEPLOY — Verify build logs don't echo secrets. Check your deployment provider's build logs. If any secret is printed, it's compromised.
- DEPLOY — Add security headers to
vercel.jsonor_headers. For Vercel, useheadersconfig. For Netlify / Cloudflare, use_headersfile in the public dir. - POST — Test a Vercel Preview link in a private browser window. Ensure CSP nonce is fresh on each request and headers are present.
- POST — Rotate any test key that ever shipped to production. Even if it's a
sk_test_*key, rotate it after you've seen it in production.
Lovable-specific gotchas (3 items)
Patterns unique to Lovable's scaffold and deployment flow:
import.meta.envis Vite-specific and all-or-nothing. Vite exposesVITE_*vars in the client bundle by design. There's no server-only env concept in Vite without a separate API boundary. Lovable's default is client-heavy; you must add API routes for sensitive operations.- GitHub sync can auto-commit without review. If Lovable syncs changes back to GitHub, confirm the workflow isn't auto-pushing without your approval. Otherwise, a malicious update could land in main.
- Static-host headers are a different beast than middleware. Vercel, Netlify, and Cloudflare Pages all handle headers differently. If you switch hosts, re-check your header config is applied — the platform may not give you an error if a header is unsupported.
Next steps
Review the general vibe coding security checklist for 51 cross-tool items. Then see step-by-step hardening for deeper patterns on CSP, RLS, and auth.
