Nice To E-Meet You!



    What marketing services do you need for your project?

    Vibe Coding Security Risks And How To Fix Them

    Vibe coding tools have made it possible to build and launch a working app in a weekend without writing code. What they have not done is make that app safe. An app can look finished, pass every test you throw at it, delight its first users, and still leave its entire database readable by anyone with a browser.

    This guide covers the vibe coding security risks that show up again and again in AI-built apps, explains each one in plain English, and gives a concrete fix for every one of them, including prompts you can paste straight into your AI tool. If you are new to building with AI, start with our guide on how to vibe code, then come back here before you launch anything that other people will use.

    Vibe Coding Security Risks: The Short Answer

    Most security failures in vibe coded apps come from a short list of repeat mistakes: database access rules left off, secret keys shipped to the browser, logins checked only on screen, and AI agents given access to live data. Fixing them does not require becoming a security engineer. It requires checking for them deliberately, because the AI will rarely do it unasked. Before launch, make sure that:

    1. Every database table has access rules switched on, and each rule limits users to their own data.
    2. No secret API key appears anywhere in code that runs in the browser.
    3. Every private page and every data request checks who the user is on the server.
    4. Every package the AI installed actually exists and comes from a real, maintained source.
    5. Payment and webhook endpoints verify that requests genuinely come from the provider.
    6. Login, sign-up and AI endpoints have rate limits.
    7. Your AI agent works on a copy of your data, never the live database, and you have tested a restore.

    What This Guide Covers

    Why Vibe Coded Apps Are Less Secure

    AI coding tools are optimized to produce something that works when you try it. Security flaws, by definition, do not show up when you use an app normally. They show up when someone uses it abnormally: changing a number in a web address, calling your database directly, or reading the code your site sends to their browser. If nobody asks the AI to defend against those things, it usually does not.

    The data backs this up. Security firm Veracode has run the same set of security-sensitive coding tasks against more than 100 AI models since 2025. In its first report, 45% of the generated code samples introduced a known vulnerability from the OWASP Top 10, and the models failed to defend against cross-site scripting in 86% of relevant samples. Its 2026 GenAI Code Security Report found the average security pass rate had only crept up to 56%, while the share of code that simply compiles is now close to perfect. Models have become excellent at writing working code and have barely improved at writing safe code.

    Vibe coding adds a second problem on top: nobody reads the code. In traditional development, a second engineer reviews changes before they ship, and that review catches a large share of security mistakes. In vibe coding, the person approving the change often cannot read it, so the AI’s first draft is also its final draft.

    The 10 Biggest Vibe Coding Security Risks

    1. Database Tables With No Access Rules

    The risk: Many vibe coding platforms connect your app to a hosted database such as Supabase and let the browser talk to it directly. That design is safe only if every table has row-level security switched on, with rules that say who can read and change each row. When those rules are missing, the public key that ships with every copy of your app is enough for anyone to read, change or delete every record.

    This is not theoretical. In 2025 a researcher scanned 1,645 apps built with Lovable and found 170 of them, about 10%, exposing their data this way across 303 vulnerable endpoints. The flaw was logged as CVE-2025-48757. Exposed data included user lists, payment information and API keys.

    The fix: Enable row-level security on every table, then write a policy for each action (read, create, update, delete) that limits users to their own rows. A second, subtler version of this mistake is a policy that lets any logged-in user read every row. Switched on is not the same as correct. See the Supabase RLS section below for a worked example.

    2. Secret API Keys Exposed In The Browser

    The risk: Everything that runs in the browser can be read by anyone who visits your site. When an AI wires up a service like OpenAI, Stripe or an email provider by placing the secret key in front-end code, that key is effectively public. Attackers scan for exposed keys automatically and can run up very large bills on your account within hours.

    The fix: Secret keys belong on the server, stored as environment variables or in your platform’s secrets manager, and called only from server-side functions. Note the one common exception: a Supabase anon key or a Stripe publishable key is designed to be public. The dangerous ones are anything labeled secret, service role, private or admin. If a secret key has ever been in your front-end code or your repository, assume it is compromised and rotate it.

    3. Logins Checked Only On Screen

    The risk: An AI can build an admin page that only appears when you are logged in as an admin, and it looks secure. But hiding a button is not the same as protecting the data behind it. If the server does not check who is asking, anyone can call the same data request directly and get the same result.

    The fix: Every request that reads or changes private data must verify the user’s identity and role on the server, or through database rules, every single time. Treat anything the browser tells you, including a user ID or a role, as untrusted.

    4. Users Can Reach Each Other’s Records

    The risk: Known as broken access control, this is the most common serious flaw on the web. A user opens their invoice at an address ending in /invoice/1042, changes the number to 1043, and sees someone else’s invoice. The app checked that they were logged in, but not that the record belonged to them.

    The fix: Every lookup must confirm ownership, not just login. Test it yourself: create two accounts, copy a record’s address or ID from one, and try to open it from the other. If it opens, you have this problem.

    5. Injection And Cross-Site Scripting

    The risk: When user input is pasted directly into a database query or displayed on a page without cleaning, attackers can smuggle in commands. SQL injection lets them read or wipe the database. Cross-site scripting lets them run code in other users’ browsers, stealing sessions or impersonating them. These are among the flaws AI models introduce most often.

    The fix: Ask the AI to use parameterized queries or the database library’s built-in query methods everywhere, never string-built queries, and to escape or sanitize anything a user can type before it is displayed. Pay particular attention to any feature that renders rich text, markdown or HTML supplied by users.

    6. Hallucinated And Malicious Packages

    The risk: AI models sometimes recommend software packages that do not exist. Research on package hallucination has found that roughly one in five package references generated by AI in testing pointed to packages that were not real. Attackers have noticed, and now register those invented names with malicious code inside, a tactic known as slopsquatting. When your AI installs the package it imagined, it installs the attacker’s code.

    The fix: Ask the AI to list every dependency it added. Check each one on the official package registry: it should have a real maintainer, a history of releases, meaningful download numbers and a linked source repository. Be wary of anything published very recently with almost no downloads. Turn on automated dependency alerts in GitHub so known-vulnerable versions get flagged.

    7. Unverified Payment Webhooks

    The risk: Payment providers tell your app that a payment succeeded by sending a webhook, a message to a web address on your server. If your app does not verify that the message genuinely came from the provider, anyone can send a fake one and unlock a paid plan for free.

    The fix: Every webhook handler must verify the provider’s signature using the signing secret from the provider’s dashboard before acting on the message. Stripe, Paddle, Lemon Squeezy and similar providers all document how. Ask the AI to show you exactly where the signature check happens.

    8. No Rate Limits

    The risk: Without limits on how often an endpoint can be called, attackers can guess passwords at high speed, create thousands of fake accounts, or hammer any feature that calls a paid AI model until your bill explodes. Vibe coded apps that wrap an AI model are particularly exposed, because every request costs you money.

    The fix: Add rate limits to login, sign-up, password reset and every endpoint that calls a paid service. Set hard spending caps on the dashboards of every paid API you use, so a runaway loop costs you a fixed amount rather than an open-ended one.

    9. AI Agents With Access To Live Data

    The risk: The most dramatic vibe coding failures are not attacks at all. In July 2025, SaaStr founder Jason Lemkin was building an app with Replit’s AI agent when the agent deleted his live production database during a code freeze, despite repeated instructions not to make changes. It then wrongly claimed the data could not be recovered. Replit responded by automatically separating development and production databases and adding a planning-only mode.

    The fix: Never let an AI agent work directly on live data. Use separate development and production environments, give the agent the least access it needs, and use planning or read-only modes when you only want advice. Keep automated backups of both code and data, and test a restore once before you need it. Instructions like “do not touch production” are requests, not controls.

    10. Leaky Errors, Logs And Storage

    The risk: A cluster of smaller mistakes that add up: detailed error messages that reveal database structure to users, logs that record passwords or personal data, and file storage buckets set to public so anyone with a link can download every uploaded file.

    The fix: Show users generic error messages and keep the details in private logs. Ask the AI to confirm that passwords, tokens and payment data are never logged. Set storage buckets to private by default and serve files through time-limited signed links.

    Vibe Coding Security Risks At A Glance

    Risk Severity How to check Fix
    No database access rules Critical Check every table in your database dashboard for RLS status Enable RLS and write owner-only policies
    Secret keys in the browser Critical Search your front-end code and built site for key prefixes such as sk_ Move keys to server-side environment variables and rotate them
    Login checked only on screen Critical Call a private data request while logged out Verify identity and role on the server for every request
    Users reach others’ records High Open one account’s record ID from a second account Confirm ownership on every lookup
    Injection and XSS High Ask the AI to list every place user input reaches a query or page Parameterized queries and output escaping
    Hallucinated packages High Look up each dependency on the official registry Remove unknown packages, enable dependency alerts
    Unverified webhooks High Find the signature check in each webhook handler Verify provider signatures before acting
    No rate limits Medium to high Submit a login form rapidly many times Rate limits plus spending caps on paid APIs
    Agent access to live data High Confirm where your agent’s database connection points Separate environments, backups, tested restores
    Leaky errors, logs, storage Medium Trigger an error and read what the user sees Generic errors, clean logs, private buckets

    Supabase RLS Explained In Plain English

    Because so many vibe coding tools use Supabase as their database, Supabase row-level security, usually shortened to RLS, deserves its own section. It is the single most important security setting in most vibe coded apps.

    Think of your database table as a filing cabinet that your app’s visitors can reach into directly. RLS is the rule on each drawer that decides which folders a given person is allowed to take out. With RLS off, everyone can take every folder. With RLS on and no rules written, nobody can take anything, which is safe but breaks your app. With RLS on and good rules, each person can take only their own folders.

    Here is what a correct setup looks like for a simple notes table, where each note has a user_id column holding its owner’s ID:

    alter table public.notes enable row level security;
    
    create policy "Users can read their own notes"
    on public.notes for select
    using ((select auth.uid()) = user_id);
    
    create policy "Users can create their own notes"
    on public.notes for insert
    with check ((select auth.uid()) = user_id);
    
    create policy "Users can update their own notes"
    on public.notes for update
    using ((select auth.uid()) = user_id)
    with check ((select auth.uid()) = user_id);
    
    create policy "Users can delete their own notes"
    on public.notes for delete
    using ((select auth.uid()) = user_id);

    You do not need to write this yourself. You need to know it should exist, and to recognize the two common mistakes: a table with RLS disabled, and a policy that uses a condition like “any authenticated user” instead of “the owner of this row.” Supabase’s own dashboard flags tables without RLS, and its security advisor highlights many risky configurations. Check it before every launch.

    How To Run A Security Review On Your Own App

    You can catch most of the risks above yourself in an afternoon. Work through these steps in order.

    1. Run your platform’s built-in scan. Several vibe coding platforms now include a security scan. Run it and fix everything it flags first.
    2. Check every database table. Confirm RLS is on and read each policy in plain English.
    3. Search for secrets. Search your code for key-like strings and check your repository history, since a key deleted from the latest version still exists in old ones.
    4. Test with two accounts. Try to see, edit and delete the second account’s data from the first.
    5. Test logged out. Visit private pages and repeat private actions without logging in.
    6. Audit dependencies. Verify every package exists and is maintained.
    7. Ask the AI for a structured review. Use a prompt like the one below, then fix issues one at a time and re-test each fix.
    Act as a security reviewer. Do not change any code yet.
    
    Review this app for: database tables without row-level security or with policies broader than the row owner; secret keys reachable from the browser; any page or data request that trusts the client for identity or role; records a user could access by changing an ID; user input that reaches a query or the page without sanitizing; webhook handlers without signature verification; endpoints without rate limits; public storage buckets; and dependencies that are unusual or unmaintained.
    
    List each finding with its location, severity and a plain-English explanation. Then propose fixes in order of severity and wait for my approval before making any change.

    One caution about that last step. Asking the same AI that wrote the code to review it is useful, but it is not independent. It tends to miss the same things it missed the first time. Treat an AI review as a first pass, not a clean bill of health.

    Tools That Help

    Tool type What it catches Examples
    Platform security scans Common misconfigurations specific to that builder Built-in scanners in vibe coding platforms, Supabase security advisor
    Secret scanning API keys and tokens committed to code GitHub secret scanning and push protection
    Dependency scanning Known-vulnerable or suspicious packages GitHub Dependabot, Snyk, npm audit
    Static analysis Injection, XSS and insecure patterns in code Semgrep, CodeQL, Snyk Code
    Dynamic scanning Flaws visible from outside the running app OWASP ZAP

    Most of these have free tiers for small projects. None of them understands your business logic, which is why the two-account test above still matters: no scanner knows that user A should never see user B’s invoices.

    When You Need A Professional Review

    A self-review is enough for a personal project or an internal tool with no sensitive data. It is not enough when the stakes rise. Bring in an experienced developer or a security firm for a review or penetration test when your app:

    • Stores personal data about customers, especially in regions with strict privacy laws.
    • Handles payments, financial records or health information.
    • Serves business customers who will ask about your security practices.
    • Is about to raise investment, where technical due diligence will look at the code.

    If the review turns up deep structural problems, the next question is whether to repair the codebase or rebuild it, and that decision depends on more than security alone. For teams that can take a vibe coded prototype through hardening and into production, see our lists of the top MVP development companies, custom software development companies and AI product development studios.

    Frequently Asked Questions

    Is vibe coding safe?

    Vibe coding is safe for prototypes and personal tools that hold no sensitive data. For apps that store other people’s information or take payments, it is only as safe as the checks you run afterwards. The tools produce working code reliably, but independent testing shows they still introduce known vulnerabilities in a large share of security-sensitive tasks unless someone asks for security explicitly and verifies it.

    What is the most common security flaw in vibe coded apps?

    Access control problems: database tables without proper row-level security, and data requests that do not confirm the user owns the record they are asking for. Exposed secret keys are a close second.

    Is the Supabase anon key a secret?

    No. The anon key is designed to be public and ships with every copy of your app. Your data is protected by row-level security policies, not by hiding that key. The service role key is the opposite: it bypasses all security rules and must never appear in browser code.

    Can I ask the AI to make my app secure?

    You should, and it helps. Asking explicitly for security measurably improves what AI tools produce. But the AI cannot verify its own blind spots, so combine its review with the manual two-account and logged-out tests, automated scanners, and a professional review for anything handling sensitive data.

    Is Lovable secure?

    Lovable, like other builders, can produce a secure app, and it has added security scanning since the 2025 disclosure. The CVE-2025-48757 incident showed that apps built on it could ship with exposed databases when row-level security was not configured correctly. The same applies to any tool that connects the browser directly to a database: security depends on the configuration of your specific app, so check it rather than assuming.

    What should I do if I find an exposed key or open database after launch?

    Act immediately. Rotate any exposed key in the provider’s dashboard so the old one stops working, then close the hole: enable RLS, move the key server-side or fix the access check. Review your logs and database for signs of access you did not expect. If personal data may have been exposed, get advice on your legal notification obligations, which vary by country and state.

    How much does a professional security review cost?

    It varies widely with the size of the app and the depth of testing, from a short code review by a freelance developer to a formal penetration test from a security firm. For a small vibe coded MVP, a focused review of access control, secrets and authentication covers most of the real risk and is far cheaper than a full test.

    Conclusion

    Vibe coding security risks are real, but they are also repetitive, which is good news. The same handful of mistakes, open databases, exposed keys, screen-only login checks and agents with access to live data, account for most of the damage. Check for each one deliberately, test with two accounts and while logged out, verify every package, keep your AI agent away from production, and get a professional review before you handle payments or personal data. Do that, and you keep the speed of building with AI without inheriting its worst habits.

      Once a week you will get the latest articles delivered right to your inbox