Why Every Lovable Project Needs Security Testing
Building with AI is incredibly fast, but are your Lovable projects secure? Here's everything you need to know about protecting your AI-generated applications.
The Hidden Risk in AI-Powered Development
Lovable builds working apps in hours, and security checks often get skipped along the way. Generic CVE scanners look for known library issues. A Lovable app can have zero vulnerable dependencies and a fully open invoices table. The scanner has to understand Supabase, anon keys, Edge Functions, and the six flows below, not only npm audit.
What Makes Lovable Projects Different?
Traditional scanners miss several risks specific to AI-generated apps:
- Working but flawed code: generated patterns run correctly but skip a security check
- Integration gaps: the AI connects services and APIs without securing the seams
- Fast iteration: each prompt can add tables and endpoints faster than anyone reviews them
Real Security Issues We’ve Found in Lovable Projects
Four issue types show up most in Lovable scans:
AUTHENTICATION BYPASSES
Incomplete authentication flows that allow unauthorized access to protected routes.
API KEY EXPOSURE
Sensitive credentials accidentally exposed in client-side code or public repositories.
DATA LEAKAGE
User data or internal information unintentionally exposed through API responses.
INPUT VALIDATION GAPS
Missing validation allowing malicious input to reach your backend.
The 6 Vibe Coding Flows That Break Most Often
“Vibe coding” means shipping an app by prompting an AI without reading all the generated code. In our Lovable scans, the same six flows produce most critical findings.
01 / SIGNUP + SESSION
Anon key used for signed-in calls. JWT stored in localStorage with no refresh. Password reset that emails to attacker-controlled addresses because the update endpoint trusts the client.
02 / FILE UPLOAD
Supabase Storage bucket set to public. No MIME validation. No per-user path prefix. Result: any user uploads into any other user's folder, or uploads executable content to an "images" bucket.
03 / PAID-FEATURE GATE
Stripe plan check lives only in the React component. The underlying `/api/generate` or table read has no `WHERE plan = 'pro'` clause. Every free user can hit every paid endpoint directly.
04 / ADMIN DASHBOARD
Route guarded by `if (user.email === 'me@x.com') showAdmin()`. The `admin_audit_logs` table has no RLS. Anyone who guesses the route or calls the REST endpoint is admin.
05 / EDGE FUNCTIONS
Service-role key hardcoded into a function callable from the browser. Or function trusts a `user_id` parameter instead of deriving it from the JWT. Full privilege escalation in one request.
06 / PROFILE UPDATE
UPDATE policy reads `USING (auth.uid() = user_id)` but has no `WITH CHECK`. Users can change their own `role` to `admin`, their `plan` to `enterprise`, or their `user_id` to someone else's. Test: try `PATCH /profiles?id=eq.me { role: "admin" }`.
In each case the UI looks fine and the app works, but the endpoint behind it is a critical finding. The scanner tests all six automatically. For why these patterns appear in AI-generated code, see Vibe Coding Security Checks and the beauty-blogger RLS baseline.
RLS Misconfigurations: The #1 Vulnerability
After scanning 1,430+ Lovable applications, the most common vulnerability is missing or misconfigured Row Level Security (RLS) policies.
Lovable uses Supabase as its database layer. Supabase exposes a public API endpoint anyone can call directly. Without RLS policies, nothing stops an attacker from reading every row in your database, modifying other users’ data, or deleting records entirely.
- Supabase defaults: New tables are created with RLS disabled by default. Lovable’s AI doesn’t always enable it.
- Complexity gap: Writing correct RLS policies requires understanding PostgreSQL policies, which AI-generated code frequently gets wrong.
- Silent failure: Everything works perfectly without RLS during development. The vulnerability only matters when real users are on the platform.
- Multiple tables: Each new table needs its own RLS policies. As projects grow, tables get missed.
The Four RLS Checks Every Table Needs
RLS needs a policy per operation, per table. The scanner runs all four against every public table it discovers:
| Operation | What the scanner sends | What passes | What fails |
|---|---|---|---|
| SELECT | anon GET /rest/v1/<table>?select=* |
401 or scoped rows |
Full table dump |
| INSERT | anon POST /rest/v1/<table> with probe row |
401 or policy rejection |
Row written |
| UPDATE | anon PATCH /rest/v1/<table>?id=eq.<row> |
401 or zero rows affected |
Row modified |
| DELETE | anon DELETE /rest/v1/<table>?id=eq.<row> |
401 or zero rows affected |
Row deleted |
A common mistake: SELECT is locked down, so the developer ships, and writes stay open. About 30% of apps that “enabled RLS” in our scans had this.
Broken Policies That Look Correct
These policies compile and the app works, but the table is still exposed:
-- BAD: no WITH CHECK means user can INSERT rows owned by anyone
CREATE POLICY "insert own" ON posts
FOR INSERT USING (auth.uid() = user_id);
-- BAD: UPDATE with only USING; user can update their row
-- and simultaneously change user_id to someone else
CREATE POLICY "update own" ON posts
FOR UPDATE USING (auth.uid() = user_id);
-- BAD: reads your own + everyone marked public, but no column
-- filter - sensitive fields on "public" rows leak
CREATE POLICY "read public or own" ON posts
FOR SELECT USING (is_public OR auth.uid() = user_id);
-- BAD: the classic "make it work" fix
CREATE POLICY "allow all" ON posts FOR ALL USING (true);
Corrected versions:
-- GOOD: INSERT with WITH CHECK binds the new row to the caller
CREATE POLICY "insert own" ON posts
FOR INSERT WITH CHECK (auth.uid() = user_id);
-- GOOD: UPDATE requires the row currently belongs to the caller
-- AND the new version still does (prevents ownership transfer)
CREATE POLICY "update own" ON posts
FOR UPDATE USING (auth.uid() = user_id)
WITH CHECK (auth.uid() = user_id);
-- GOOD: DELETE scoped to owner
CREATE POLICY "delete own" ON posts
FOR DELETE USING (auth.uid() = user_id);
-- GOOD: explicit SELECT, no ambiguity
CREATE POLICY "read own" ON posts
FOR SELECT USING (auth.uid() = user_id);
For PII columns (email, phone, stripe_customer_id), prefer a view with restricted columns over column-level grants - it’s harder to misconfigure and easier to audit.
Test Your RLS in 30 Seconds
Open your deployed Lovable app, grab the Supabase URL and anon key from the network tab, then run:
# Replace with your project + anon key + table
SUPA="https://<project>.supabase.co"
KEY="<anon_key>"
TABLE="profiles"
# Read probe - should be empty or 401 when signed out
curl "$SUPA/rest/v1/$TABLE?select=*&limit=5" \
-H "apikey: $KEY" -H "Authorization: Bearer $KEY"
# Write probe - should be 401 or policy denial
curl -X POST "$SUPA/rest/v1/$TABLE" \
-H "apikey: $KEY" -H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{"id":"rls-probe-delete-me"}'
If rows come back or the write succeeds, you have a critical. Run the free Supabase RLS Checker for the full per-table report, or drop your URL into the scanner at the top of this page for the full Lovable audit (auth, storage, edge functions and keys as well as RLS).
When RLS Is Not Enough
RLS stops the anon key. It does not stop:
- Edge Functions using the service-role key - these bypass RLS entirely. Any logic mistake inside a function is a full database read/write.
- Leaked JWTs - if a logged-in user’s JWT leaks (XSS, a public gist, a screenshot), RLS happily serves the attacker whatever that user could see.
- Storage - Storage has its own RLS-like rules per bucket and per object. They are configured separately and are usually left as “public bucket” on Lovable apps.
- Database views and functions - a
SECURITY DEFINERfunction runs with creator privileges, not the caller’s. If it takes a user-supplied ID and trusts it, RLS is irrelevant.
Our scanner probes all four. For background on the underlying policy model, see the Supabase RLS guide and the Supabase security checklist.
How the Lovable Security Scanner Works
What happens when you scan your project:
- Discovery: crawl the app for routes and functionality
- Testing: 13 AI agents run attack scenarios against the app
- Detection: flag issues from misconfigurations to authentication bypasses
- Report: explain each issue with steps to fix it
Beyond Just Scanning: Complete Security Coverage
Besides finding vulnerabilities, the scanner covers:
- Multi-browser testing
- Supabase RLS verification: per-operation tests of your policies
- Daily monitoring: rescans as your app changes
- Data leak detection: sensitive information exposed in responses
- API token exposure: credentials in client code
- Launch readiness checks: pre-deployment validation
What Developers Are Finding
Across 5,711 vulnerabilities found in 1,430+ scanned apps, here’s how the most common issues rank:
- Missing RLS on SELECT - Critical. Present in 85% of scans.
- Missing RLS on INSERT/UPDATE/DELETE - Critical. Present in 51% of scans. Usually ships alongside a working SELECT policy, which is why devs miss it.
- Exposed API keys - Critical. Present in 62% of scans. OpenAI, Anthropic, Stripe, and Resend are the top four leaked.
- Authentication bypasses - High. Present in 45% of scans. Usually a frontend-only route guard.
- Missing input validation - High. Present in 38% of scans.
- Public Storage bucket - High. Present in 34% of Lovable apps using Storage.
- Frontend-only paid-feature gates - High. Present in 27% of monetized apps.
- Service-role key in client code - Critical. Rare (~4%) but always a full takeover.
How findings map to fix prompts
Fix moves for the most common critical findings:
| Finding class | First fix move | Verify |
|---|---|---|
| RLS off on table T | ALTER TABLE T ENABLE ROW LEVEL SECURITY + owner policies |
Anon select empty; user B cannot read A |
USING (true) policy |
Drop; replace with auth.uid() = user_id |
Same probes |
| Service role in bundle | Remove; rotate key; use Edge Function | Token leak checker clean |
| Public Storage | Private bucket + path policies | Anonymous list/download fails |
| Client-only admin | Server role claim + RLS | Direct REST to admin tables fails |
| Edge Function no JWT | Enable verify; derive user from token | Unauthed invoke 401 |
| Paid gate UI-only | Check plan server-side / in policy | Free user API 402/403 |
Paste structured findings back into Lovable chat carefully: ask for minimal policy diffs, then rescan. AI “fixes” that add USING (true) to silence errors are regressions, and the scanner flags them.
What the 13 agents prioritize on a Lovable target
The 13 agents cover:
- Stack fingerprint - confirm Supabase / hosting class.
- Secret harvest - JWTs and third-party keys in JS.
- PostgREST surface - table discovery and per-op RLS.
- Auth flows - signup, session storage, reset paths.
- Storage - bucket publicity and path traversal-ish layouts.
- Functions - unauthenticated and confused-deputy invokes.
- BOLA - cross-user ids on REST and custom routes.
- Config / headers - CORS, security headers, source maps.
- Payment trust - client price, webhook-shaped endpoints.
- Input / XSS sinks - HTML rendering paths when exposed.
- Admin surfaces - route and table naming heuristics.
- Regression hotspots - tables added without policies.
- Evidence packaging - repro requests for the report.
Business-logic abuse that needs domain knowledge (for example, “invoice paid makes chapter 7 available”) still needs a human.
Interpreting rates from 1,430+ apps
These rates do not predict your app, but they help you prioritize:
- If you have not touched RLS, assume SELECT is open until proven otherwise (85% in our scans).
- If SELECT works and you “enabled RLS,” still test writes (~51% still open on write ops).
- If you integrated OpenAI/Stripe in a hurry, assume key in client until the bundle grep is clean (~62% key issues of some kind).
Agencies scanning many client apps should fix open RLS everywhere before polishing CSP.
Agency and multi-project workflow
Teams shipping many Lovable clients should:
- Run detector + full scan on every handoff URL.
- Keep a shared policy SQL template (owner CRUD + org membership).
- Block go-live on any Critical.
- Retest after client “just added one feature” prompts.
- Document Supabase project ref ↔ client mapping for IR.
Treat the scanner as a release gate.
False positives and how we reduce them
Dynamic testing can flag:
- Intentionally public marketing tables
- Read-only reference data meant for anon
- Rate limits that look like auth failures
Mark accepted risks explicitly in your report process. Name public-by-design tables clearly (public_posts) and expose only non-PII columns. Never put USING (true) on users.
Continuous scanning vs one-shot
Lovable apps change when someone opens chat and says “add teams.” That prompt can create three tables with RLS off. Scan at launch, then weekly or per deploy. Pair with CI/CD security when you export to GitHub.
How to read a Lovable scan report
Prioritize: anonymous data access, service_role exposure, BOLA, public storage with sensitive objects, then headers and hygiene. Fix prompts should be applied one critical at a time with a rescan between to avoid masking regressions.
Cadence recommendation
Scan on every production deploy and after any prompt that mentions database, auth, storage, or payments. Weekly full scans catch drift from dashboard clicks outside git.
Dual-user BOLA walkthrough the scanner automates
Enabling RLS does not rule out object-level failures. The scanner’s dual-user test:
- Create or reuse two test identities (or reuse sessions you provide).
- As user A, create a resource (invoice, post, project) via the same REST surface that the SPA uses.
- As user B, request that resource by ID:
GET /rest/v1/<table>?id=eq.<A's id>with B’s JWT. - Attempt
PATCHandDELETEas B against A’s row. - Flag any 200 that returns A’s PII or mutates A’s row.
To reproduce it manually:
# After signup as A and B, capture access tokens from the network tab
# A creates a row; then:
curl -s "$SUPA/rest/v1/invoices?id=eq.$A_INVOICE_ID&select=*" \
-H "apikey: $ANON" -H "Authorization: Bearer $B_JWT"
# Expect: empty array or 401/403 - never A's line items and amounts
If B sees A’s invoices, you have BOLA even when a naive “SELECT works for me” test passed. Pair with Lovable BOLA for the disclosure context.
Storage path prefixes that look private but are not
Lovable upload flows often write to paths like avatars/{user_id}/photo.jpg while the bucket is public. Path structure is not access control. Attackers enumerate UUIDs or scrape listing endpoints.
Scanner checks that matter:
- Bucket public vs private flag
- Ability to
listanother user’s prefix with the anon key - Ability to download by constructed URL without a signed token
- MIME and size - less critical than confidentiality, still abuse surface
Fix pattern:
-- storage.objects policies (bucket private)
create policy "read own avatar objects"
on storage.objects for select
using (
bucket_id = 'avatars'
and auth.uid()::text = (storage.foldername(name))[1]
);
create policy "insert own avatar objects"
on storage.objects for insert
with check (
bucket_id = 'avatars'
and auth.uid()::text = (storage.foldername(name))[1]
);
Then regenerate filenames server-side (UUID) so enumeration of original upload names fails even if a policy slips.
Edge Function probe matrix
For every discovered /functions/v1/<name>:
| Probe | Expected if hardened |
|---|---|
No Authorization header |
401 |
| Valid user JWT, wrong resource id in body | 403/404, not other users’ data |
Body field user_id overridden to another UUID |
Still scoped to JWT subject |
| OPTIONS / CORS preflight from random origin | No * with credentials |
Functions that embed service_role and trust body fields are full-database gadgets. Prefer user-scoped clients:
const supabase = createClient(url, anonKey, {
global: { headers: { Authorization: req.headers.get("Authorization")! } },
});
const { data: { user } } = await supabase.auth.getUser();
if (!user) return new Response("Unauthorized", { status: 401 });
Use service role only for admin jobs with fixed queries and no client-supplied table/path names.
Anon key extraction is reconnaissance, not the vuln
Finding eyJ... JWTs labeled anon in the Vite bundle is expected for Supabase. Hiding the anon key does not help. What matters:
- Which tables respond to that key with rows
- Whether the key is actually a service_role JWT mislabeled (rare but Critical)
- Whether third-party secrets (
sk_live_, OpenAIsk-) appear in the same chunks
The scanner separates “anon present” (info) from “anon can dump profiles” (Critical). Use that split to point teams at policies instead of key obfuscation.
Prompt-induced regressions the scanner is built to catch
A typical chat after launch:
“Add a teams feature with shared invoices”
Generator adds teams, team_members, invoices.team_id - often without RLS or with USING (true) so the UI works. Next:
“Let anyone with the link view the invoice”
Public read policy lands on the whole table, not a tokenized share row.
Operational rule: any prompt that mentions database, auth, storage, payments, admin, or share links triggers a rescan before the marketing tweet. The six flows and RLS four-ops matrix above are the regression suite.
Lovable Cloud vs export-to-GitHub: same probes
Whether the app lives on *.lovable.app or was exported to Vercel, PostgREST and Storage still answer on *.supabase.co. Hosting does not change the probes. After export:
- Confirm env mapping did not promote service role to
VITE_/NEXT_PUBLIC_. - Re-run token leak on the new bundle (chunking differs).
- Re-check Auth redirect URLs for the new domain.
- Keep the same dual-user and anon probes.
See Lovable tech stack for the architecture map and CI/CD security guide for preview gates.
Report severity vs business severity
A Medium “missing CSP” on a marketing landing page is not the same as a Medium “partial RLS - writes open on waitlist.” For Lovable SaaS with invoices:
| Finding | Business read |
|---|---|
Anon SELECT on invoices |
Stop ship / incident |
| Public Storage with contracts | Stop ship |
| Service role in bundle | Stop ship + rotate + audit logs |
| Missing HSTS | Fix this sprint |
| Verbose PostgREST error | Fix this sprint |
Use the appendix rubric, then re-rank by data class (PII, payments, health). The scanner ranks technically; you rank by customer and regulatory impact.
Paste-ready Lovable prompts after a scan
Use one prompt per critical. Rescan between prompts.
RLS baseline:
Enable RLS on every public table. For each user-owned table, add policies:
SELECT/UPDATE/DELETE using auth.uid() = user_id;
INSERT with check auth.uid() = user_id;
UPDATE also with check auth.uid() = user_id.
Do not use USING (true). Do not put service_role in the client.
Storage:
Make the avatars bucket private. Add storage.objects policies so users can only read/write objects under a folder named with their auth.uid(). Reject non-image MIME types over 5MB.
Edge Function:
Require a valid user JWT on this function. Create the Supabase client with the caller's Authorization header and anon key so RLS applies. Remove service_role from this function unless you justify a fixed admin query with no client-supplied table names.
Bad follow-ups to avoid: “just make the error go away,” “allow all authenticated users,” “disable RLS temporarily.”
What “1,430+ apps” means methodologically
The corpus is live public URLs scanned with the same probes over time, not a random sample of Lovable projects. It is biased toward public deploys and people who paste URLs. Treat the rates as priors for prioritization, not predictions for your staging app. Use the rank order (RLS, keys, auth bypass, storage) to order your fixes.
Related research and deeper dives
- Lovable Security Report Feb 2026 - mass open databases
- Lovable BOLA - object-level auth failures
- Is Lovable Safe? - platform vs app gap model
- Supabase safety - RLS deep context
- Vibe hacking - how attackers industrialize the same probes
Get started
Paste your deployed app URL above to get a security report with fix steps. The 14-day free trial needs no setup.
Appendix: severity rubric we use on Lovable apps
| Severity | Examples |
|---|---|
| Critical | Anon readable user PII; service_role in client; auth bypass to admin data |
| High | Authenticated BOLA; public Storage with private files; unsigned billing webhook |
| Medium | Verbose errors; missing rate limits; partial RLS (writes open) |
| Low | Missing security headers; informative server banners |
Use the rubric in tickets so a High write-path gap is not mislabeled Medium.
SCAN YOUR LOVABLE APP NOW
Paste your Lovable URL - the same probe we use in Lovable security research, on your project.
Common questions
Is Lovable safe to use?
What security issues are common in Lovable apps?
How do I scan my Lovable app for vulnerabilities?
What is the most common vulnerability in Lovable apps?
How many Lovable apps have been scanned for security?
How do I check if my Supabase RLS is actually working?
Does RLS enabled mean my table is secure?
What are the Vibe Coding flows that break most often?
Can Lovable itself fix these vulnerabilities if I prompt it?
Does this work for Lovable apps that don't use Supabase?
Is it safe to run this scan against my production Lovable app?
Run the lovable security scan
Same failure modes we publish about: missing RLS, exposed keys, broken auth. Get the report for your app in under 60 seconds.
14-day free trial · Cancel anytime
See VibeEval more often in Google Top Stories.