Free guide
Vibe coding security: 15 checks before launch and moving the key to the server in one evening
Fifteen checks we run on every app built with AI before it starts taking money. You can do almost all of them in your browser in a few minutes, and at the end you’ll find where to look for what in Lovable, Bolt and v0.
Model key isn’t in the browser
Hard spending limit on the key
Price is calculated on the server
Someone else’s order won’t open
RLS on for every table
Backup restored as a test
In short
The key must not be in the browser or in the project’s version history, and it must have a hard spending limit. Revoke a leaked key and issue a new one: deleting the saved version doesn’t fix it, the key stays in the history.
Keys
- The model key can’t be seen in the browser. Open the developer tools (F12, on a Mac Cmd+Option+I) and search the Network and Sources tabs for “key”, “sk-” and “secret”.
- The key has a hard spending limit. For OpenAI: Project settings → Limits → Spend → Edit spend limit, and the “Enforce a hard limit” switch. In Claude Console: Billing → Spend limits. An email alert won’t stop the spending, and strangers’ requests would drain your budget in the meantime.
- Secrets aren’t in the code or in the version history. The
.envfile with your keys belongs in.gitignore, the list of files that aren’t saved to the history (the exception for Lovable is in the table below). To check, tell an AI that can see the whole project: “find keys, passwords and .env in the entire git history”. Was a key ever in a saved version (a commit)? Revoke it and issue a new one: deleting that version doesn’t fix it. - Anything with a prefix goes to the browser:
VITE_(Vite projects, for example from Lovable or Bolt) andNEXT_PUBLIC_(v0). You must not have secrets with names like that. The Supabase secret key (secret orservice_role) bypasses the database rules and never belongs in the browser.
Money
- The price is calculated on the server. In the developer tools, find the payment request on the Network tab, change the amount in it and send it again. Did the order go through at your price? That’s a hole.
- The payment gateway confirms the payment, not the “thank you” page. In Stripe, that’s a webhook, a message the gateway sends to your server: the
checkout.session.completedevent, with the signature checked in theStripe-Signatureheader. Open the “thank you” page without paying: the order must not show as paid. - A quick double click on “pay” doesn’t create two orders or two payments.
- Refunds and cancellations work all the way through: the money is returned and access is closed.
Data
- Someone else’s order won’t open. Change the order or profile number in the address to a neighboring one.
- Every table in Supabase has RLS turned on, rules for who may read and change which rows. Tables created with an SQL command don’t get it on their own, and every visitor to the website has the database’s public key. Without RLS, anyone with this key can read and change all the rows.
- The admin area is locked down. Open
/adminin an incognito window. Did it open without logging in? Then it’s open to everyone. - Personal data: you collect only the fields you need, you know where they’re stored, and your website has a privacy policy (GDPR).
Resilience
- Submit the form or the login 20 times in a row. A limit must kick in, otherwise people will spam your form and guess your password.
- The database backup can be restored. Find it and restore it into a test database at least once.
- You see the errors, not the customer. Break the form on purpose: the customer gets a clear message and you get an alert.
Moving the key to the server in one evening
The browser calls your server function, meaning code that runs on the server, and only that function calls the model, with the key from the server’s secrets. The browser no longer sees the key.
- Create a server function that receives the website’s request and calls the model.
- Put the key in the server’s secrets, not in the code or in a variable with
VITE_orNEXT_PUBLIC_. - Switch the calls on your website to this function.
- Set a request limit per user.
- Revoke the old key and issue a new one: the old one has already leaked.
A prompt for your AI tool (Lovable, Bolt, v0). Replace the service name and the number of requests with your own:
Move the OpenAI API calls to the server. Keep the key in the server secrets; it must not be in the code or in variables with the prefix VITE_ or NEXT_PUBLIC_. The browser calls only our server function. Add a limit: at most 10 requests per minute per user. Show me where the key is right now.
Lovable, Bolt and v0: where to find what
| Tool | Keys | Security check |
|---|---|---|
Tool Lovable | Keys More → Settings → Secrets. Here the | Security check More → Security. The Quick scan runs on its own every time you publish; the Deep scan you start by hand. Both are free. |
Tool Bolt | Keys Database icon at the top center → Secrets | Security check Publish → Run security audit, on paid plans. Database check (database icon → Security) on all plans. |
Tool v0 | Keys Project menu (…) → Settings → Environment Variables | Security check v0 doesn’t list a separate app check. But it warns you about variables with |
Built-in checks don’t replace manual tests. Test these yourself: a tampered price, the “thank you” page without paying, double payment, refunds, someone else’s order and restoring a backup. Even Lovable says its checks don’t replace a thorough security review.
Bonus
A prompt to check the whole app
Paste these 15 checks into your tool’s chat, with this task below them. Wherever it can’t find an answer, there’s a hole.
Go through each check in the list above and show me where in the project the answer is: the file and line, or the setting. Don’t fix anything.
Built an app with AI and getting ready to launch?
In a free 30-minute call, we’ll go through what you’ve built and tell you which checks it would fail and what to fix first.
How we check a system that’s already built