Short answer: where secrets can live depends on your app's framework, not on the builder's name. A Vite app runs almost entirely in the browser; a Next.js app also has server code. Check your project's package.json to see which one you have. In both, anything with a public prefix (VITE_ or NEXT_PUBLIC_) is shipped to visitors, your database rules must hold up against the public key, and your deployed site needs HTTPS, headers and no exposed files. Work through the ten checks below.
Vite app or Next.js app?
| Vite app | Next.js app | |
|---|---|---|
| Public env prefix | VITE_ | NEXT_PUBLIC_ |
| Where secrets can live | Supabase Edge Functions or a separate backend | Route handlers and server actions, using env vars without the public prefix |
| Where headers are set | Your host's config | next.config headers() or your host's config |
| Main risk | Secrets pushed into the browser to "make it work" | Server code that runs for anyone, with no auth check |
The checklist
Secrets
- No secrets behind a public prefix. List every
VITE_orNEXT_PUBLIC_variable. Only public values belong there, such as your Supabase URL and anon / publishable key. A variable likeNEXT_PUBLIC_OPENAI_KEYis a leaked key. - No secrets in the built code. Open the deployed site, open DevTools, and search all sources for
sk-,sk_live_,sb_secret_,service_roleandAKIA. Builders sometimes hardcode a key straight into a component. - Source maps off in production. Vite's
build.sourcemapand Next.js'sproductionBrowserSourceMapsare off by default. If someone turned them on, your original source (and any key in it) is readable.
Data
- RLS on every Supabase table. Run Supabase's Security Advisor and fix every table it reports with RLS disabled. Replace
truepolicies on user data withauth.uid()checks. Full steps: Supabase RLS checker. - Private storage for private files. User uploads go in private buckets with signed URLs.
- Server code checks who's calling (Next.js). Every route handler and server action that reads or changes data should confirm the user is signed in and allowed to touch that record. Server actions can be called directly, not only from your form.
- Edge Functions check who's calling (Vite + Supabase). Same rule. A function that holds a secret key and does whatever it's asked is a public endpoint with admin rights.
Deployment
- No exposed files.
/.env,/.env.localand/.git/configon your live domain should not return file contents, and neither should leftover backups likebackup.zip,db.sqlor.DS_Store. Public API docs (/openapi.json,/swagger.json,/docs) should not list every endpoint either. See Did my .env leak? - HTTPS and headers. HTTPS redirect, HSTS, a Content-Security-Policy, clickjacking protection (
frame-ancestorsorX-Frame-Options),nosniff, and referrer and permissions policies. - Preview deploys aren't leaking. Preview URLs often use the same keys and database as production. Make sure they're not indexed, and don't share them publicly unless the app is ready.
Fix prompts
For a Vite app:
Find every secret API key in this project (anything not meant for the browser). Remove it from VITE_ variables and frontend code. Create a Supabase Edge Function for each operation that needs a secret, store the key as a function secret, and make the function verify the signed-in user before doing anything. Then confirm that RLS is enabled on every table.
For a Next.js app:
Rename any NEXT_PUBLIC_ variable that holds a secret so it no longer has the prefix, and only read it in server code. In every route handler and server action, check the user's session and confirm they own the record before reading or writing. Add security headers (HSTS, CSP, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy) in next.config. List the files you changed.
After any key moves out of the browser, rotate it. Moving it doesn't remove copies people already downloaded.
What CapLeak checks
The free score covers checks 2, 4, 8 and 9 from the outside, and gives a score, a grade and problem counts by severity. It looks for secret keys in your homepage and the JavaScript files it loads. It checks database (Supabase) access using only your public key and a row count, with no rows downloaded. It asks whether .env, .git and source map files are served, without downloading them. And it checks HTTPS and headers. The $12 full report (one time, per app) shows where each issue is, with a plain-English fix and a copy-paste prompt for Lovable, Bolt or Cursor, right after checkout. The deep part (database tables, hidden files like .env and .git, and source maps) is added after a quick ownership check, which takes about a minute. Checks 1, 3, 5–7 and 10 depend on your code and settings, so review those yourself. Using Lovable? Start with Is my Lovable app secure? To keep an app watched every week, Watch is $15 a month per app and Unlimited is $39 a month for up to 25 apps, with no report needed first.
CapLeak runs passive checks only. A passing grade means none of its checks failed; it is not a guarantee of security.