Is Vibe Coding Safe? What the Research Found and How to Check Your App
Table of contents
- The short answer
- Why AI-written code has security holes
- What the research actually found
- The 5 most common security holes
- Lovable's CVE-2025-48757: what actually happened
- How to fix each hole (copy-paste prompts)
- How to test your own app for holes
- The before-you-publish checklist
- What you should never vibe code alone
- Frequently asked questions
- What to read next
You built an app by describing it in plain words. It works. The buttons do what they should, the pages load, and your friends can use it. Now comes the question most beginners skip: is it safe?
Safe means something specific here. Not "does it work" — but "can a stranger see data they should not see, steal a key you left in the code, or break in through a form field?" Those are security questions, and they have real answers. This guide gives them to you: what the research actually found, the five holes that show up again and again in vibe-coded apps, the exact prompts that fix each one, and the checklist to run before you publish anything.
If you want the wider question — whether vibe coding itself is a good or bad way to build — read Is Vibe Coding Bad? The Honest Answer for Beginners. That post covers quality, learning and the ethics debate. This one is only about security: the holes, the fixes, and the check.
The short answer
Yes — for personal projects. No — not automatically, for anything that holds other people's data.
A habit tracker for yourself, a to-do list, a game you share with friends: safe, because there is nothing in them worth stealing and nobody else's data to expose. An app with sign-ups, private messages, or a database of other people's emails: not safe until someone checks it. The app works either way. Working and safe are different things, and the AI will not tell you which one you have.
That is the whole answer in one line: vibe coding is safe when the app holds no one else's data, and it needs a security check the moment it does.
Why AI-written code has security holes
AI coding tools — Lovable, Bolt.new, Replit Agent, v0, Cursor, Google AI Studio — are built to produce code that works. You describe the app, they write the HTML, CSS and JavaScript (usually on React), and the preview runs. What they are not built to do, unless you ask, is to think like an attacker.
A human developer writing a login page asks: what if someone types the wrong password ten times? What if someone opens another user's page by changing the number in the web address? What if someone pastes code into a form field instead of a name? An AI tool, given the prompt "build an app with login", usually builds the happy path — the part where the right person logs in and everything works. The unhappy paths, the ones attackers use, are left out unless your prompt names them.
Three habits of AI-written code make this worse:
- It copies patterns, not judgement. The AI has seen millions of examples of login pages and database queries. It reproduces the common shape of them. The common shape often skips the security parts — checking who is allowed to see what, cleaning up strange input, hiding secret keys — because those parts are invisible in a working demo.
- It trusts your prompt literally. If you say "let users see their data", the AI builds a page that shows data. It does not ask "which users, and whose data?" That question — who can see what — is called access control, and it is the single most common hole in vibe-coded apps.
- It never says "this is unsafe". The preview runs, the checkboxes work, the app looks finished. Nothing in the tool warns you that the database is open to the internet or that your API key is sitting in the code where anyone can read it. The tool did what you asked. Checking is your job.
None of this means the tools are bad. It means security is a separate step from building — one you have to ask for, in plain words, the same way you asked for the features.
What the research actually found
This is not guesswork or opinion. In 2026, researchers published the first large audit of real vibe-coded apps, and the numbers are worth reading carefully — not panicking over, but not ignoring either.
| What the study did | What it found |
|---|---|
| Audited 200 publicly deployed vibe-coded apps | 91.0% had at least one vulnerability |
| Rated the vulnerabilities found | 65.77% were rated Critical or High |
| Veracode tested whether AI models pick the secure or the insecure option when both are possible | AI-generated code chose the insecure option in 45% of cases |
The study is "Understanding the (In)Security of Vibe-Coded Applications" by Deng, Fan and Meng (arXiv:2606.23130, first posted June 2026, revised September 2026). The 45% figure comes from Veracode's research, reported via Surfshark. And in 2025, a real flaw was found in Lovable-built apps — CVE-2025-48757 — where database rules were missing, so one user could read another user's data. There is more on that one below.
Read those numbers honestly. They do not say "91% of vibe coded apps will be hacked." They say: when nobody checks the security, holes are the norm, not the exception. The study's own conclusion is that better prompting and better checking reduce the holes — but they do not eliminate the risk on their own. That is why the rest of this guide exists.
One honest caveat: the audit covered open-source apps built with tools like Claude Code and Lovable. It does not give the rate for every vibe-coded app ever built. But every other scan published in 2025 and 2026 points the same way: the code usually works, and it usually has at least one serious hole. The flaws the study found are the OWASP Top 10 staples — the standard list of the ten most common web vulnerabilities that security professionals have warned about for years — now reproduced faster than review can keep up.
The 5 most common security holes
These five show up again and again in vibe-coded apps. Learn to recognise them and you can spot most of the danger in ten minutes.
| Hole | What it means in plain English | How you would notice it |
|---|---|---|
| Leaked API keys and secrets | A password or key is written directly in the code, where anyone who opens the app can read it | You search the project and find a real key next to the words "api_key", "secret" or "password" |
| Broken access control | One user can see or change another user's data | You log in as one user and open another user's page — and it loads |
| Weak or fake authentication | The login does not actually keep anyone out | A wrong password still gets in, or a protected page opens without logging in |
| SQL injection | Typed input reaches the database unchecked, so crafted text can read or change data | Strange characters in a form field crash the app or show database details |
| Cross-site scripting (XSS) | Typed input is shown back to other users as code, so one user can run scripts in another user's browser | A comment or name field accepts code-like text and displays it as a working page element |
Leaked API keys and secrets
Every app that talks to another service — sending email, storing files, processing payments — uses a secret key, like a password between two programs. Beginners often paste the key into the code or into a chat message to the AI, and the AI writes it into the app where it stays. Anyone who views the app's code can then copy the key and use it as if they were you.
The fix is simple and non-negotiable: secrets never go in the code. They belong in the tool's environment settings — the place Lovable and Bolt.new provide for values the app needs but users must never see. If you ever pasted a real key into a prompt or a file, treat that key as stolen: revoke it with the service that issued it and make a new one.
Broken access control
This is the most common hole the study found, and the easiest to understand. Your app has users, and each user has data. Access control is the rule that says user A sees only user A's data. In vibe-coded apps that rule is often missing entirely — the page that shows "your habits" or "your messages" simply shows whatever the database returns, to whoever asks.
Test it the way an attacker would: log in as one user, then try to open another user's page by changing the name or number in the web address. If it loads, stop. The app is not safe to share, and no other fix matters until this one is done.
Weak or fake authentication
Authentication is the login: proving you are who you say you are. AI tools often build a login screen that looks right and does nothing — the button works, the page changes, but no password is ever actually checked, or the check happens only in the browser where anyone can skip it.
Test it twice: type a wrong password on purpose. Then try opening a protected page in a fresh browser window without logging in at all. If either one lets you through, the login is decoration, not security.
SQL injection
When a user types into a form — a name, a search box, a comment — that text travels to the database. If the app passes it along unchecked, specially crafted text can change what the database does: read rows it should not show, or delete them. This is called SQL injection, and it is one of the oldest attacks on the web.
You do not need to understand databases to test for it. Type quotes, brackets and a very long string into a form field. If the app crashes, or shows an error message containing database details, the input is not being checked. The fix is to tell the AI to validate and sanitise every input — the prompt is in the fixes section below.
Cross-site scripting (XSS)
XSS is injection's close cousin. Here the typed text is not sent to the database — it is shown back to other users. If a comment box accepts code-like text and the app displays it as a live page element, one user can run scripts inside another user's browser: stealing their session, changing what they see, or redirecting them.
The test is the same as for injection: put strange text in every field that other people can see, and check what comes back. If anything you typed behaves like code instead of plain text, the app needs the fix below.
Lovable's CVE-2025-48757: what actually happened
In 2025, security researchers found a real flaw in apps built with Lovable — catalogued as CVE-2025-48757. The problem was row-level security: the database rule that decides which rows each user is allowed to see.
Lovable-built apps commonly store their data in Supabase, a hosted database. Supabase has a switch called row-level security (RLS). When it is on, the database itself enforces the rule "each user sees only their own rows", no matter what the app's code does. When it is off, the database answers every request — and if the app's code does not check who is asking, one user can read another user's data.
The flaw was that apps were shipping with that switch off. The apps worked perfectly. Their owners had no idea the lock was open, because nothing in the building process warned them. The fix was to switch row-level security on and write the rules for who can see what — a job of minutes, once someone knew to look.
That is the lesson of this whole guide in one story: the danger in vibe coding is rarely a clever hack. It is a switch nobody knew existed, left off by default. Every section below is about finding those switches before your users do.
How to fix each hole (copy-paste prompts)
You do not fix security holes by rebuilding the app. You fix them the same way you built it: one clear message at a time, one hole per message, then test. Copy these prompts, change the details to match your app, and send them one at a time.
"Check this app for security holes. Look for: API keys or secrets written in the code, pages where one user can see another user's data, login checks that happen only in the browser, and form inputs that reach the database unchecked. List every hole you find, one per line, and do not change any code yet."
"Move all API keys and secrets out of the code and into environment variables. Search the whole project for api_key, secret and password, replace each real value with an environment variable, and tell me which keys I need to revoke and replace because they were exposed."
"Fix access control. Every page that shows user data must check that the logged-in user owns that data, and refuse to show it otherwise. Add this check on the server side, not only in the browser. Do not change anything else."
"Add row-level security to the database. Turn on row-level security for every table, and write a rule for each one so that a user can only read and change their own rows. Tell me the rules you added, in plain words."
"Validate and sanitise every form input. Reject or escape quotes, brackets, code-like text and very long inputs before they reach the database or are shown to other users. Do not change how the forms look."
Send the first prompt, read the list, then send the fixes one by one. After each fix, run the test for that hole again. A fix you did not test is a guess, not a fix.
How to test your own app for holes
Testing is not a technical skill. It is pretending to be a rude stranger for ten minutes. Do these four tests on every app before you share it:
- The stranger test. Log in as one user. Try to open another user's page — change the name or number in the web address, or click a link you were never given. If you see their data, the app fails. This catches broken access control, the most common hole.
- The secrets search. Search your whole project for the words "password", "secret" and "api_key". If any real key or password appears in the code, it is exposed. Move it to environment settings and revoke the key.
- The wrong-password test. Type a wrong password. Then open a protected page in a fresh browser window without logging in. If either lets you through, the login is fake.
- The weird-input test. Type quotes, brackets and a very long string into every form field, especially ones other users can see. If the app crashes, shows database details, or displays your text as a working page element, the input is unchecked.
If a test fails and you cannot fix it in three tries, ask the tool with the exact error message — or ask a developer friend to look at that one part. You do not need to fix everything yourself. You need to know what is broken, and not to publish it while it is.
The before-you-publish checklist
Run this list before you share any app you vibe coded — with a friend, on social media, or anywhere public. Ten minutes, ten checks:
- One user cannot see another user's data (the stranger test).
- No real API key, secret or password appears anywhere in the code.
- A wrong password is rejected, and protected pages refuse to open without logging in.
- Strange input in form fields is rejected or cleaned up — no crashes, no database details in errors.
- Row-level security is switched on for every database table, with a rule per table.
- The published link starts with https, not http. Lovable and Bolt.new publish over HTTPS by default — check that yours does.
- Test data is removed: no fake users with real-looking emails, no test passwords, no sample private data.
- You have a copy of your prompts and your code saved outside the tool, so you can rebuild if something breaks.
- One friend has tried to break it first — wrong passwords, strange input, other users' pages — and told you what they found.
- You have checked it again after a week, and again every time you add a feature that touches user data.
If any check fails, fix it before you publish. An app that "works" but fails check 1 or 2 is not ready — it is a leak with a nice interface.
What you should never vibe code alone
Some apps are fine to build alone with a checklist. Others are not, and the difference is whose data is at stake:
- Fine alone: personal projects with no one else's data — to-do lists, habit trackers, games, landing pages, prototypes you show to friends.
- Fine alone, with the checklist: small apps with sign-ups, where you run every test above and fix what fails.
- Not alone: anything that takes payments. Use a trusted payment provider and get a human developer to check the integration — money is where small holes become real losses.
- Not alone: apps holding health, financial or children's data, or a business's customer records. The risk is not the code — it is the responsibility for other people's data. A human developer reviewing the security is not optional there; it is the job.
If your app holds other people's data and the checklist finds problems you cannot fix, that is the point where you stop vibe coding alone and get help. That is not failure — that is the responsible thing to do, and it is what the research recommends too.
Frequently asked questions
Is vibe coding safe?
For personal projects, yes. For apps that hold other people's data, only after a security check. A 2026 audit of 200 deployed vibe-coded apps found at least one vulnerability in 91.0% of them — but those apps were published without checks. Run the checklist in this guide and you avoid the most common holes.
Can someone steal my API key from a vibe-coded app?
Yes, if the key is written in the code. Anyone who can view the app's code can copy it. Keep keys in the tool's environment settings, never in the code — and if a key was ever exposed, revoke it and make a new one.
What is row-level security, and why does it matter?
Row-level security (RLS) is a switch in the database that says each user can only see their own rows. The Lovable flaw catalogued as CVE-2025-48757 happened because apps shipped with that switch off, so one user could read another user's data. Switching it on, with a rule per table, is the single most important fix for any app with user accounts.
Does Lovable check my app's security?
No tool does this for you. Lovable publishes over HTTPS by default and connects to Supabase, where you switch row-level security on — but nothing warns you if the switch is off or a key is in the code. Checking is your step, using the tests in this guide.
I found a hole in my app — what do I do first?
Stop sharing it. Then fix one hole at a time with the prompts in this guide, testing after each fix. If the hole is broken access control or a leaked key, those come first — a leaked key must also be revoked with the service that issued it, because changing the code does not un-expose it.
Is my own personal data safe in the apps I build?
Your data in your own app is as safe as the app's security. A personal tracker with no other users and no keys in the code is low-risk. The moment an app has accounts, other people's data, or a key to another service, run the full checklist — your data is protected by the same rules that protect everyone else's.
What to read next
- Is Vibe Coding Bad? The Honest Answer for Beginners — the wider question: quality, learning and the ethics debate, with the same research and the 7-point safety checklist.
- Vibe Coding Mistakes Beginners Make (And How to Fix Them) — mistake 8 is skipping the safety check; the other seven are the errors that waste your credits and break your app.
- How to Use Lovable to Build an App: A Beginner's Step-by-Step Guide — the Lovable tutorial this guide's examples come from, including the publish step where the checklist belongs.
- What Is Vibe Coding? A Complete Beginner Guide — the definition, how it works, and who it is for, if you are new to the whole idea.
- Best Vibe Coding Tools for Beginners — Lovable, Bolt.new, Replit, v0, Cursor and Google AI Studio compared, with free plans and prices.
Vibe coding is not unsafe. Skipping the security check is. Run the tests, fix what fails, and build with your eyes open.
Written by Samiullah Channa, Vibe Coding Guide. Published 27 November 2026. Research checked 27 November 2026 — the arXiv audit figures are from the version revised September 2026; later versions may change them.




Comments
Post a Comment