Deutsch
GuideSecurity · Overview

The complete security guide for AI-built apps

The eight risk families in apps built with Lovable, Bolt, Cursor and Supabase, ranked by real-world impact, with how to check each one and where to fix it.

By Tim GeithnerPublished 17 min read

Short answer

Most security problems in AI-built apps come from one fact: the browser talks to your backend directly, so every rule that only lives in the frontend can be skipped. Fix them in this order: who can read and change data (RLS), which keys ship to the browser, whether server functions check the caller, sign-in flows, payments, AI features, dependencies and finally web basics like headers and CORS. This guide explains each family in a few paragraphs and links to the detailed checks and fixes.

Ask an AI about this page:ChatGPTClaude

On this page

Key takeaways

  • In a typical AI-built app the browser talks to the database and APIs directly. Anything enforced only in the frontend is a suggestion, not a rule.
  • The biggest risk by far is data access: one user reading or changing another user’s rows. Check row level security first.
  • Second come keys: the publishable key belongs in the browser, the secret key and every AI or Stripe secret never do.
  • Server functions, sign-in flows and payments each fail in a few well-known ways, and each has a short check.
  • AI features add two new risks: prompt injection and a bill without an upper limit.
  • Fix in order of impact, then make the checks repeatable so the next generated migration can’t undo them.

Apps built with Lovable, Bolt, Cursor or Claude Code on top of Supabase share one architecture: a React frontend that calls the database, edge functions and third-party APIs straight from the browser. That design is fast to build and perfectly safe if the backend enforces every rule on its own. Most real incidents in these apps happen where it doesn’t: a table without row level security, a secret key in a VITE_ variable, an edge function that believes the user_id in the request body.

This page is the map. It walks through the eight risk families in the order we would fix them, explains each in plain words and links to the detailed guide, the fix page and the glossary entry for every problem. If you only have an hour before launch, use the pre-launch security checklist instead and come back here for the why.

What are the biggest security risks in an AI-built app?

The table ranks the families by how much damage one mistake typically does: how many users it exposes, whether an attacker needs an account, and whether it costs you money directly. This ranking is our judgement, based on how these apps are built, not a survey.

#Risk familyWhat goes wrongStart here
1Data accessUsers read or change each other’s data, or visitors read everythingSupabase RLS guide
2Keys and secretsA key that bypasses all rules ships to the browser or to gitAPI keys in the frontend
3Server functionsEdge functions run with admin rights for whoever calls themEdge Functions security
4Sign-in flowsUnconfirmed accounts, open redirects, reset links to any URLSupabase Auth pitfalls
5PaymentsFree upgrades, fake webhooks, credits granted twiceStripe security
6AI featuresLeaked AI keys, runaway bills, prompt injectionCalling AI APIs safely
7DependenciesA vulnerable or look-alike package in your buildSupply chain attack
8Web basicsXSS, permissive CORS, missing headers, exposed source mapsSecurity headers for Vite

The order matters because the families build on each other. Perfect security headers don’t help if the documents table answers every visitor in full, and a well-guarded paywall doesn’t help if the secret key is in the bundle.

Why do AI-built apps end up with these gaps?

Three habits of the way we build with AI explain most of what follows.

The frontend does the filtering. Generated code usually asks the database for “my rows” with a filter such as .eq("user_id", userId). In the app, everything looks right. But that filter runs because your code asks for it; anyone holding your public key can send the same query without it. The same goes for hiding the admin button, greying out paid features or checking a plan before calling an API.

The AI optimises for “it works”. When a request fails because of a missing permission, the fastest fix that makes the error disappear is to open things up: a policy of using (true), a function with admin rights, a secret key that “just works”. The app runs, and the hole is invisible.

We test as ourselves. A single developer account sees its own data and pays nothing. The bugs above only show when a second user, a signed-out visitor or someone with a script tries something your UI never offers.

None of this is special to one tool. In the data behind the OWASP Top 10:2025, broken access control is ranked first, and OWASP writes that “100% of the applications tested were found to have some form of broken access control”. The OWASP Top 10 is a good mental model for any web app; this guide translates it to the AI-built stack, which some call vibe coding.

Who can read and change your data?

In a Supabase app, your project URL and the publishable (or older anon) key are in the browser code on purpose. Supabase’s own documentation calls the publishable key safe to expose and says it can only reach what row level security allows. That makes row level security (RLS) the lock on every table: a rule in Postgres, checked on every row of every query, that decides which rows the caller may see or change.

The common failures, from most to least frequent in our experience:

Here is the one-minute check. Run it in the Supabase SQL Editor; every row it returns is a table that the Data API serves without any row check:

Tables in public without RLS
select n.nspname as schema, c.relname as table_name
from pg_class c
join pg_namespace n on n.oid = c.relnamespace
where c.relkind in ('r', 'p')
  and n.nspname = 'public'
  and not c.relrowsecurity;

We ran this query against a test database with Supabase’s roles and default grants: the table it listed answered a signed-out visitor in full, while the table next to it with RLS and an owner policy returned only each user’s own row. Then open Advisors → Security Advisor in the dashboard; it flags missing RLS (lint 0013), permissive policies (0024), views that bypass RLS (0010) and several more. The complete walk-through, with the owner-only policy pattern and a fix prompt, is in the Supabase row level security guide. To prove your policies work, follow how to test your RLS policies with SQL.

Which keys are safe in the frontend?

Keys come in two kinds, and mixing them up undoes everything in the previous section.

KeyWhere it may liveWhat it can do
Supabase publishable or anon keyBrowser, mobile app, public repoOnly what your grants and RLS allow
Supabase secret or service_role keyEdge functions and servers onlyEverything; bypasses every RLS policy
Stripe secret key, webhook secret (whsec_…)Server onlyCharges, refunds, customer data
OpenAI, Anthropic and other AI keysServer onlySpending your money

Supabase’s key documentation is blunt about the secret key: it “bypasses every Row Level Security policy you have”. Supabase even rejects secret keys sent from a browser, but the same page warns that this is no real safeguard, because a leaked key works from any other tool.

The ways secrets reach the browser in AI-built apps are predictable:

  • A VITE_ prefix. Vite’s docs say variables starting with VITE_ are exposed in client-side code after bundling, and warn against putting API keys in them. An environment variable is only secret if it stays on the server. Fix: secret in a VITE_ variable.
  • The admin client in frontend code. Generated code sometimes creates a Supabase client with the secret key “to fix a permission error”. Fix: service_role key in the frontend.
  • AI keys in the client or returned by a function to the client. Fix: AI key in client code.
  • Git history. A key that was committed once stays in the history after you delete it. See secrets in git history.
  • Source maps and stray files. Public source maps or a deployed .env give away more than you think. Fix: exposed source maps or .env files.

If a secret did leak, deleting it from the code is not enough: create a new one, deploy it, then revoke the old one. That process is called secret rotation, and for the worst case there is a step-by-step plan: leaked service_role key, the first 60 minutes. The full picture of what is safe where is in API keys in AI-built apps.

Do your server functions check who is calling?

Anything that needs a secret runs in an edge function or another server function. These functions usually create an admin client, so they become the place where access is decided, and RLS no longer helps.

Supabase’s Edge Functions docs describe the safe default: a signed-in user’s request carries their session JWT in the Authorization header, the platform verifies it before your code runs (verify_jwt = true), and you should leave that on for user-facing functions. Inside the function, a client created with the caller’s token keeps their RLS policies in force; the admin client bypasses them and should only do work that must cross users, filtered by the verified user ID.

Three mistakes cover most real problems:

Functions that send e-mails, call AI models or create records also need rate limiting, or a single script can drain your quota or your wallet. See rate limiting for AI-built apps. The complete guide for this family is securing Supabase Edge Functions.

Can someone get around your sign-in?

Supabase Auth does the hard parts for you: password hashing, tokens and sessions. The risks sit in the settings around it and in the redirects your app builds.

  • E-mail confirmation off. Supabase’s production security checklist tells you to enable e-mail confirmations; without them, anyone can sign up with an address they don’t own. It also recommends an OTP expiry of one hour or less and a custom SMTP server for auth e-mails.
  • Redirects to anywhere. After login or a password reset, your app sends the user to a URL. If that URL comes from a query parameter and is not checked against a list, it becomes a phishing tool. Fixes: open redirect after login and password reset link that redirects to any URL.
  • Telling attackers which e-mails exist. Different messages for “unknown e-mail” and “wrong password” let anyone test a list of addresses. Fix: e-mail enumeration.
  • No limit on login attempts. Lists of leaked passwords are tried against many sites at once, called credential stuffing. Fix: no rate limit on login or AI endpoints.
  • Admin checks in the UI only. Hiding the admin page is not access control. Fix: admin check only in the frontend.

If you use social login or passwordless sign-in, the glossary explains OAuth, PKCE and the magic link and what each protects against. All Supabase-specific traps are collected in Supabase Auth pitfalls.

Can users get paid features for free?

Payment bugs are rarely about stolen card numbers; Stripe handles those. They are about your app believing something it shouldn’t.

  • The paywall lives in the frontend. If the plan check only decides what the UI shows, the API still serves paid features to everyone. Read how users bypass paywalls and the fix subscription check only in the frontend.
  • The client sets prices, credits or paid status. A user who can write credits or plan on their own row can upgrade themselves. Fix: credits granted client-side.
  • Unsigned webhooks. Stripe tells your app about payments through a webhook. Stripe signs each event in the Stripe-Signature header, and its docs say to verify that signature, ideally with the official library and the raw request body, before trusting anything in it. Without a webhook signature check, anyone can post a fake “payment succeeded”. Fix: Stripe webhook without signature check.
  • Events processed twice. Stripe’s docs note that an endpoint occasionally receives the same event more than once and suggest logging processed event IDs. Without that idempotency, a retry grants credits twice. Fix: non-idempotent Stripe webhook.

The pillar for this family is Stripe in vibe-coded apps.

What can go wrong with the AI features themselves?

If your app calls a language model, two new risks appear on top of everything above. The OWASP Top 10 for LLM Applications 2025 lists both: LLM01 Prompt Injection and LLM10 Unbounded Consumption.

Runaway cost. An AI endpoint without limits lets one script spend your monthly budget in an afternoon; OWASP calls this “Denial of Wallet”. The defences are the same as for any expensive API: keep the key on the server, require sign-in, cap requests per user and set a hard spend limit at the provider. Read calling OpenAI or Anthropic safely and the fix no AI spend cap.

Prompt injection. Text from a user, a web page or an uploaded file can contain instructions that change what the model does. There is no filter that stops this reliably, so design around it: give the model only the data and tools the current user may use anyway, require a human click for actions with consequences, and treat the model’s output as untrusted text. OWASP’s prevention list starts the same way, with constraining the model, validating output formats and least privilege. Details: prompt injection in the AI features of your app.

Untrusted output matters for one more reason: rendering model answers as HTML or unsafe Markdown is a classic XSS hole (see XSS via dangerouslySetInnerHTML).

Are your dependencies safe?

Every npm install your AI tool runs adds someone else’s code to your app. OWASP added Software Supply Chain Failures to the 2025 Top 10 as A03. Its advice comes down to knowing what you ship, tracking direct and nested dependencies against vulnerability databases, removing unused packages and installing only from trusted sources.

For a small app that means four habits:

  • Commit the lockfile, so every build installs exactly the versions you tested.
  • Read package names your AI tool adds before you accept them; look-alike names are a known trick called typosquatting, one form of supply chain attack.
  • Run npm audit (or your package manager’s equivalent) and read each CVE it lists. Its CVSS score says how bad the bug is in general, not whether your app uses the affected code.
  • Remove packages you no longer import.

Tools that scan code, running apps and dependencies are grouped as SAST, DAST and SCA; the glossary explains which finds what.

Have you covered the web basics?

These problems are older than AI builders and still show up in generated apps. None of them is usually the first thing an attacker uses against a Supabase app, which is why they come last here, but each one is cheap to fix.

  • XSS. React escapes text by default; the holes are dangerouslySetInnerHTML, Markdown renderers that allow raw HTML and links built from user input. Fix: XSS via dangerouslySetInnerHTML.
  • CORS. CORS tells browsers which other sites may read your API’s responses. Access-Control-Allow-Origin: * together with credentials is the dangerous combination. Read CORS explained for vibe coders and the fix CORS wildcard with credentials.
  • Security headers. A Content Security Policy limits what scripts can run, HSTS keeps browsers on HTTPS, and a few one-line headers stop sniffing and framing. The OWASP HTTP Headers Cheat Sheet lists recommended values; security headers for Vite and Lovable apps shows where to set them.
  • Personal data in logs. Error messages and logs that contain e-mail addresses, tokens or request bodies spread data to every tool that reads them. Fix: personal data in logs.
  • Cross-site requests. CSRF matters mainly when you use cookie sessions; SSRF matters when your server fetches URLs that users supply, for example a “preview this link” feature. Queries through the Supabase client don’t paste your input into SQL text, but database functions that build SQL from strings can still be open to SQL injection; the Security Advisor flags such functions when visitors can call them.

In what order should you fix things?

When an audit or a checklist gives you a long list, work through it like this:

Anything that exposes all users' data without an account

Tables without RLS, using (true) on private data, a secret key in the bundle, an edge function without an auth check. These are critical: one request, no login, every user affected. Fix them before you do anything else, even before launch marketing.

Anything that lets one signed-in user reach another's data or money

Missing ownership checks, functions that trust the body, credits or plans the client can write, unsigned webhooks. These need an account, which every attacker can create in seconds.

Anything that costs money without limits

AI endpoints without per-user limits or a spend cap, e-mail-sending endpoints without rate limits. Not a data leak, but a bill you can’t predict.

Sign-in hardening and web basics

E-mail confirmation, redirect allow-lists, enumeration, headers, CORS, logs. Important, rarely the first door an attacker tries.

Each finding should also tell you how sure the tool or reviewer is. A high-severity issue with low confidence needs a quick manual check before you spend a day on it. How to read a security report explains severity, confidence and the CWE numbers you’ll see next to findings.

A prompt for a first pass with your AI builder

You can ask your AI tool to look for the top families before you run any other check. Paste this into Lovable, Cursor, Claude Code or Bolt, then verify what it says with the SQL check above and a second test account:

First-pass security review of my app

Review this project for security problems and do not change any code yet. Check, and list every finding with the file and line:

  1. Every table in the public schema: is row level security enabled, and does every policy restrict rows to the owner or a team member? List any policy that uses true.
  2. Every place a Supabase client is created: is the secret or service_role key used anywhere that ends up in the browser? List every VITE_ variable that holds a secret.
  3. Every edge function: does it verify the caller’s JWT, and does it take the user ID from the token rather than from the request body?
  4. Every SECURITY DEFINER function: does it check the caller and set search_path?
  5. Every check for admin rights, plan, subscription or credits: is it enforced on the server or in the database, or only in the frontend?
  6. Every webhook handler: does it verify the signature and skip events it has already processed?
  7. Every call to an AI model: is the key server-side, is there a per-user limit, and is the model output rendered as plain text?

Rate each finding as critical, high, medium or low, and say how sure you are.

How do you keep the app secure after launch?

Security in an AI-built app is not a one-time fix, because every new prompt can create a new table, a new function or a new policy. Four habits keep the gains:

  • Run the Security Advisor after every migration and keep it at zero errors.
  • Turn your checks into tests. The SQL in this guide and in how to test your RLS policies runs as a database test, so a future migration can’t quietly reopen a table.
  • Follow the principle of least privilege whenever you add something: the anon role gets nothing by default, functions get the rights they need and no more, AI tools see only the current user’s data.
  • Review against a standard once you grow. The OWASP Application Security Verification Standard, version 5.0.0 since May 2025, turns “secure” into a list of testable requirements you can work through area by area.

For a structured self-check of a Lovable project, use is your Lovable app secure? A 30-minute self-audit. For the day before launch, work through the pre-launch security checklist.

What ShipRely checks today

ShipRely reads your repository through a read-only GitHub App and never runs your code. Today the Security and Database & Supabase audits run on the real engine: data access and RLS, exposed keys, unprotected server functions, privileged database functions and auth logic in your code. The Payments, AI & API integrations and Dependencies audits are in development and only available in the demo, so for those families use the guides above and your own tests for now.

A code audit also has a natural limit: it sees what is in the repository. Settings that only exist in your Supabase dashboard, such as e-mail confirmation or SSL enforcement, need the manual checks from the checklist.

Frequently asked questions

Are apps built with Lovable, Bolt or Cursor less secure than hand-written apps?

Not by nature. The same mistakes happen in hand-written code. AI builders make it very fast to ship an app whose frontend talks straight to the database, and the gaps come from configuration that nobody reviewed: tables without row level security, secret keys in the frontend, server functions that trust the request. All of them can be checked and fixed.

What is the single most important thing to check first?

Whether one user can read or change another user’s data. In a Supabase app that means row level security on every table in the public schema, with policies that compare the row’s owner with auth.uid(). Run the one-minute SQL check in this guide; every table it lists is open to anyone who has your public key.

Is it enough to ask my AI builder to make the app secure?

It is a useful start, but not a check. An AI tool fixes what you point it at and can miss what it doesn’t look for, and it cannot see dashboard settings such as email confirmation. Use the fix prompt in this guide, then verify the result with the SQL checks and a second test account.

Do I need a penetration test before launch?

For most small SaaS apps, a review of data access, keys, server functions and sign-in flows finds the serious problems first and costs far less. A penetration test makes sense later, for example when a customer contract asks for one or when you handle sensitive data such as health or payment details.

Which security standard should a small team follow?

Use the OWASP Top 10 as the map of common risks and the OWASP Application Security Verification Standard (ASVS) as a detailed list of requirements once you need one. For the AI features of your app, the OWASP Top 10 for LLM Applications covers prompt injection and runaway costs.

Sources

  1. 1.A01:2025 Broken Access Control — OWASP Top 10:2025
  2. 2.A03:2025 Software Supply Chain Failures — OWASP Top 10:2025
  3. 3.Application Security Verification Standard — OWASP
  4. 4.LLM01:2025 Prompt Injection — OWASP Top 10 for LLM Applications
  5. 5.LLM10:2025 Unbounded Consumption — OWASP Top 10 for LLM Applications
  6. 6.Understanding API keys — Supabase Docs
  7. 7.Production security checklist — Supabase Docs
  8. 8.Receive Stripe events in your webhook endpoint — Stripe Docs

Find this in your own app

ShipRely reads your repository (read-only), proves each finding with file and line, and gives you a fix prompt to paste into your AI builder.

Run a demo audit
  • Read-only access to your repository
  • Every finding with file and line
  • Fix prompts for Lovable, Cursor, Claude Code and Bolt