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.

  • 6
    min read
  • Checked

  • From an Instagram video
Sample
  • 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

4/6

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

  1. 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”.
  2. 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.
  3. Secrets aren’t in the code or in the version history. The .env file 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.
  4. Anything with a prefix goes to the browser: VITE_ (Vite projects, for example from Lovable or Bolt) and NEXT_PUBLIC_ (v0). You must not have secrets with names like that. The Supabase secret key (secret or service_role) bypasses the database rules and never belongs in the browser.

Money

  1. 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.
  2. 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.completed event, with the signature checked in the Stripe-Signature header. Open the “thank you” page without paying: the order must not show as paid.
  3. A quick double click on “pay” doesn’t create two orders or two payments.
  4. Refunds and cancellations work all the way through: the money is returned and access is closed.

Data

  1. Someone else’s order won’t open. Change the order or profile number in the address to a neighboring one.
  2. 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.
  3. The admin area is locked down. Open /admin in an incognito window. Did it open without logging in? Then it’s open to everyone.
  4. Personal data: you collect only the fields you need, you know where they’re stored, and your website has a privacy policy (GDPR).

Resilience

  1. 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.
  2. The database backup can be restored. Find it and restore it into a test database at least once.
  3. 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.

  1. Create a server function that receives the website’s request and calls the model.
  2. Put the key in the server’s secrets, not in the code or in a variable with VITE_ or NEXT_PUBLIC_.
  3. Switch the calls on your website to this function.
  4. Set a request limit per user.
  5. 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

ToolKeysSecurity check

Tool

Lovable

Keys

More → Settings → Secrets. Here the .env file holds only public VITE_ values and has to be saved to the history.

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 NEXT_PUBLIC_ on its own.

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

Free estimate

In 30 minutes, you’ll know where to start and roughly what it will cost.

  1. Topic
  2. Company
  3. Contact
What do you need help with?

Tell us about your company
How many people work at your company? (optional)
Where is your company based? (optional)
How did you hear about us? (optional)
Where can we reach you?
How should we contact you

Add a note (optional)

Within one business day, we’ll get back to you and arrange a time.