You described an app to Lovable, Bolt, Replit, Cursor or v0, and a few hours later it worked. People can sign up, save their data, maybe even pay you. That’s a real achievement, and it was impossible for most people a few years ago.
There’s a catch. AI tools are very good at making an app that works. They’re much less reliable at making one that’s safe. When Veracode tested over 100 AI models on coding tasks in 2025, the models introduced a known type of security flaw in 45% of cases. And an app that works perfectly in a demo can still let any stranger read every user’s data.
This guide explains how to secure a vibe-coded app without being a programmer. You won’t need to read code for most of it. You’ll need to know what to check, what to ask your AI tool, and when to bring in a human.
Why vibe-coded apps are easy to break into
When you test your app, you use it the way it was meant to be used: you click the buttons, fill in the forms and see your own data. An attacker doesn’t use the buttons. They talk to your database and your server directly, skipping your screens entirely.
That’s the core problem. AI tools often build the protection into the screens (hiding a button, not showing a page) instead of into the server and database, where it actually counts. Everything looks right from the inside, and the door is still open from the outside.
This isn’t hypothetical. In 2025, a researcher found that many apps built with Lovable had databases that let anyone on the internet read or change their tables, because the database’s access rules were missing or too loose. The apps worked fine. The owners had no idea.
1. Keep your secret keys out of the browser
Your app probably connects to other services: an AI model, a payment processor, an email sender. Each one gives you a key, a long string of characters that works like a password. Some keys are meant to be public; many are not.
The rule is simple: a secret key must never end up in code that runs in the visitor’s browser. Anything in the browser can be read by anyone who opens your site and presses F12.
How to check without coding:
- Open your live site, right-click, choose View page source or open the developer tools, and search for words like
key,secret,sk_,sk-or the name of each service you use. - If your code is on GitHub, make sure the repository is private, and turn on GitHub’s secret scanning, which warns you when a key gets committed.
- Ask your AI tool directly: “List every API key and secret this app uses. For each one, tell me whether it’s exposed to the browser or only used on the server.”
Some keys are designed to be public. Supabase’s “anon” or “publishable” key and Firebase’s config are visible in every app that uses them, and that’s fine, as long as your database rules are right (next section). But a Supabase service role key, a Stripe secret key or an OpenAI key in the browser is an emergency.
If a secret key was ever exposed, deleting it from the code isn’t enough. Go to that service’s dashboard, revoke the key and create a new one. Assume someone already copied the old one.
2. Lock down your database
This is the single most important step, and the one AI tools get wrong most often.
If your app uses Supabase, the protection is called Row Level Security (RLS). It’s a set of rules saying who can read and change each row in each table, for example “a user can only see their own orders”. Without RLS, the public key from section 1 lets anyone read the whole table.
If your app uses Firebase, the equivalent is Security Rules. The classic mistake is leaving them in “test mode”, which allows anyone to read and write everything.
What to do:
- In Supabase, open your project and check that RLS is enabled on every table. Supabase’s dashboard also has a Security Advisor that flags tables without it.
- In Firebase, open the Rules tab for Firestore and Storage and make sure there’s no rule that simply says
allow read, write: if true. - Ask your AI tool: “For every table in my database, explain in plain English who can read it, who can create rows, who can edit them and who can delete them.” If the answer for anything sensitive is “anyone”, fix it before launch.
Then test it like an attacker would, which is easier than it sounds. Create two accounts, A and B. Log in as A and create something private. Log in as B and try to reach it: change the ID in the address bar, guess the link, open it in a private window without logging in. If B can see A’s data, your rules are broken.
3. Don’t build your own login
Logins are hard to get right, and there’s no reason to invent your own. Use the one your platform provides (Supabase Auth, Firebase Authentication, Clerk, Auth0 and similar). They handle password storage, password resets and email verification far better than generated code will.
A few settings worth checking in your login provider’s dashboard:
- Email verification is on, so people can’t sign up with someone else’s address.
- Password rules are reasonable (a minimum length, not just “anything goes”).
- If your app is for a small group, such as your team or paying clients, turn off open sign-ups so strangers can’t create accounts at all.
4. Hiding a button is not security
This is the mistake behind most of the incidents above, so it’s worth its own section.
Say your app has an admin page, and the AI hid the “Admin” link from regular users. That’s not protection. If the page or the data behind it doesn’t check on the server who’s asking, anyone who finds the address can use it.
The same goes for anything a user shouldn’t be able to do: delete someone else’s post, see another company’s invoices, change their own plan to “premium”. Every one of those actions needs a check on the server or in the database rules, not just in the screens.
Ask your AI tool: “List every action in this app that should be restricted to certain users. For each one, show me where the permission is checked on the server or in the database, not in the frontend.” If it can only point to frontend code, that action isn’t protected.
5. Never trust what comes from the browser
Anything a visitor sends can be changed before it reaches you: form fields, prices, user IDs, uploaded files. Your app should treat all of it as suspicious.
Two places where this matters most:
- Payments. The price must come from your server or from your payment provider, never from the page. If the browser tells your server “this order costs $49”, an attacker can make it say “$0.01”. Confirm payments with your provider’s webhooks (a message the payment provider sends straight to your server) rather than trusting a “success” page.
- File uploads. Limit the file types and sizes you accept, and don’t let uploaded files be run or displayed as web pages.
6. Protect yourself from surprise bills
A vibe-coded app often calls an AI model or another paid service on every request. If someone finds that endpoint and calls it in a loop, you pay for every call.
- Set spending limits in every paid service’s dashboard: AI providers, hosting, email, maps. Most offer a monthly budget or usage alerts.
- Require login before anyone can trigger an expensive action.
- Ask your AI tool to add rate limiting: a cap on how many requests one user or one address can make per minute.
7. Keep backups, and keep the AI away from production
In July 2025, a founder testing Replit’s agent watched it delete his production database during a code freeze. At the time, Replit used the same database for testing and for the live app. The company has since separated them, but the lesson applies to every tool.
- Keep a separate copy of the app for testing (often called staging or development), with its own database. Let the AI experiment there.
- Turn on automatic backups for your live database, and try restoring one once, so you know it works before you need it.
- Don’t give an AI agent the keys to your live database unless you’d be comfortable with it deleting everything.
8. Update the pieces your app is built on
Your app is built on hundreds of open-source packages written by other people. When a security problem is found in one, it’s fixed in a new version, but your app only gets the fix if you update.
If your code is on GitHub, turn on Dependabot, which opens updates for you automatically and alerts you to known problems. If you’re comfortable running one command, npm audit lists known problems in a JavaScript project. And ask your AI tool every few weeks: “Check this project’s dependencies for known security vulnerabilities and update them safely.”
9. Check the basics of your site
A few quick, free checks:
- Your site loads only over HTTPS (the padlock in the address bar). Most modern hosts do this for you.
- Run your address through Mozilla Observatory. It grades your security settings and explains what to fix.
- Trigger an error on purpose, such as visiting a page that doesn’t exist or submitting a broken form. The error message should be short and generic, not a page full of code, file paths or database details.
Use the AI as a reviewer, but don’t stop there
AI tools can find a lot of their own mistakes if you ask them to look. After building a feature, start a new conversation and try something like:
Act as a security reviewer. This app will handle real users’ data. Review it for exposed secrets, missing database access rules, permission checks that only happen in the frontend, unvalidated input, and payment logic that trusts the browser. List every problem by severity and explain each one in plain English.
Some platforms, Lovable among them, also include a built-in security scan. Run it before every launch.
It’s a good first pass. But the same tool that wrote the code is reviewing it, and it tends to miss the same things twice. It also can’t tell you what it doesn’t know about your business: which data is sensitive, who should see what, what a customer would sue you over.
A checklist before you launch
- No secret keys in the browser or in a public repository
- Any key that was ever exposed has been revoked and replaced
- Every database table has access rules (RLS or Security Rules), and you tested them with two accounts
- Logins use your platform’s built-in system, with email verification on
- Every restricted action is checked on the server, not just hidden in the screens
- Prices and payment results come from the server or the payment provider
- Spending limits are set on every paid service
- Testing and live data are separate, and backups are on and tested
- Dependency alerts are on
- HTTPS works and error messages don’t reveal details
When to bring in a professional
Not every app needs a security expert. A personal tool or a prototype you show a few friends is fine with the checklist above. But get a human review before launch if:
- you store personal, financial or health information;
- you take payments or move money;
- you’re selling to businesses, who will ask about security sooner or later;
- your app is starting to get real traction, so a breach would cost more than a review;
- or you went through this guide and couldn’t answer some of the questions.
A review doesn’t mean starting over. Most of the time, a vibe-coded app needs a handful of targeted fixes (database rules, permission checks, key handling), not a rewrite.
Built something with AI and want to make sure it’s safe before real users arrive? We’re a team of developers who review and secure apps like yours, and we explain what we find in plain language. Tell us about your app and one of our developers will get back to you.
