// From Lovable, Bolt or Replit to production
What are the security risks of vibe coding, and how do you check for them?
The main risks in vibe-coded apps are database tables readable with the public key, secret API keys in the browser, permissions checked only in the interface, payments granted by the client, AI endpoints anyone can call, and unreviewed packages. AI tools build what works when you click through it, not what an attacker would try. Each has a quick test.
Want it done for you? Vibe-code to Production: from €1,500, fixed quote in 24h →

By Gabriel Cazaciuc, Founder & lead developer, Netcraft Digital
Last updated
Key facts
- Lovable's own security checks
- “Can't guarantee that your app is secure or replace a full security review”
- Source: Lovable docs, Nov 2026
- VITE_ environment variables
- Embedded in the browser bundle at build time
- Source: Lovable docs, Nov 2026
- Supabase secret key
- Bypasses row-level security
- Source: Supabase docs, Nov 2026
- Stripe webhook events
- Can arrive more than once and in any order
- Source: Stripe docs, Nov 2026
- Security audit and fixes with us
- From €1,500, 3–4 days
- Source: Our fixed-price offer, Nov 2026
Why are vibe-coded apps less secure?
Because the feedback loop only checks what you can see. You prompt, the preview works, you move on. Security failures do not show up in the preview: a table anyone can read looks exactly like a table only you can read when you are the one logged in.
The code itself is often reasonable. The gaps are in decisions nobody made: who may read this row, where this key lives, who may call this function, what happens if the same payment event arrives twice. AI tools fill those gaps with whatever makes the error go away.
What are the most common risks?
These seven patterns are the ones to check first. Each one has a test you can run without reading the whole codebase.
| Risk | How it happens | How to test |
|---|---|---|
| Open database tables | Missing or too-wide row-level security policies | Query each table with the public key and no login |
| Secret keys in the browser | The AI adds VITE_OPENAI_API_KEY or a Stripe secret to make a call work from the frontend | Search the built JavaScript for sk-, sk_live, sb_secret, service_role |
| Checks only in the interface | The admin page is hidden for normal users, but its API calls are not protected | Call the admin endpoints or tables while logged in as a normal user |
| Payments granted by the client | The app sets “paid” after the redirect to /success | Open /success directly, or update your own plan column from the console |
| Open AI endpoints | A function calls the AI model for anyone, with no login, rate limit or size limit | Call the function in a loop from a script and watch the bill |
| Unreviewed packages | The AI installs packages that are outdated, abandoned or not the ones you meant | Run npm audit and check each new dependency's name and publisher |
| Regressions after prompts | A fix for one error removes a check somewhere else | Re-run all of the tests above after every large change |
How do secret keys end up in the browser?
Through environment variables with a public prefix. In Vite apps, which includes most Lovable and Bolt projects, any variable whose name starts with VITE_ is copied into the JavaScript bundle at build time. A typical way it happens: a server function that calls the AI provider fails, and the fix that makes the error go away is to move the call to the browser with a VITE_ variable for the key. The feature works, and the key is now public.
Anyone who opens the developer tools can copy it and spend your credits with the AI provider, or, with a Stripe secret key, issue refunds and read customer data. Test it after every build:
npm run build
grep -rEo "sk-[A-Za-z0-9_-]{20,}|sk_live_[A-Za-z0-9]+|rk_live_[A-Za-z0-9]+|sb_secret_[A-Za-z0-9_-]+|service_role" dist/ | headAny match means the key must be rotated at the provider and the call moved to server code. The only Supabase key that may appear is the publishable or anon key.
Why is the database the biggest risk?
Because it holds everything, and in Supabase-based builders the browser talks to it directly. Row-level security is the only barrier, and a single table without correct policies exposes all its rows to anyone with the public key. The step-by-step check, with SQL, is in the Lovable + Supabase security checklist.
What about payments and AI features?
Both are places where an attacker gains money or costs you money, so they need checks on the server. For payments, access must come from a Stripe webhook verified on your server, and the handler must ignore duplicates, because Stripe can send the same event more than once and in any order. Details in how to add Stripe to a Lovable app.
For AI features, every endpoint that calls a model needs a logged-in user, a rate limit per user, a maximum input size and a daily budget. Without them, one script can run up a bill in a night. We cover limits and budgets in how to control AI costs.
Do AI security scanners solve this?
They help with the mechanical part. Lovable runs automatic checks before publishing for missing row-level security, rules that let everyone in, public tool access and vulnerable dependencies. Those findings do not block publishing unless a workspace admin turns that on, and Lovable states that the checks cannot guarantee security or replace a review.
A scanner can tell that a policy exists. It cannot tell that users should only see their own team's invoices, or that the plan column must not be editable. That part needs someone who knows what the app is supposed to allow.
What should I check before launch?
Pre-launch security check for vibe-coded apps
- Every table returns nothing to an anonymous request with the public key
- A logged-in user cannot read or change another user's rows
- Users cannot write their own role, plan, credits or payment status
- No secret keys in the built JavaScript or in the git history
- Admin actions are checked on the server, not only hidden in the interface
- Access after payment comes from a verified Stripe webhook; duplicate events are ignored
- AI endpoints require login and have rate limits, size limits and a budget
- Private files are in private storage, served with signed URLs
- npm audit has no high or critical findings you have not reviewed
- Errors and failed payments reach you, not only the user
- You re-ran this list after the last large prompt
If AI generates content that users rely on, add a check on the output too: how to verify AI output before users see it. Security is one of five areas on the production checklist for AI-built apps. When the app will hold payments or private data, it is also the point where hiring a developer makes sense.
