# Vibe-Coded Apps Are Easy to Build. Hardening Them Is the Real Work.

> Source: <https://zyvop.com/vibe-coded-apps-are-easy-to-build-hardening-them-is-the-real-work-3k1l5>
> Published: 2026-11-27 05:02:32+00:00

**Recommendation:** Enable row-level security on every Supabase table and test each endpoint with the public anon key before launch; 24,664 of 34,545 scanned Lovable projects leaked data without any exploit.
More in the playbook "Securing agents and AI tools": <https://wpnews.pro/playbooks/agent-security>

**TL;DR:** AI tools made it cheap to build an app that *works*. They did not make it cheap to build one that is *safe*. The 2026 breaches were rarely clever: open databases, secrets in the browser, missing authorization, and agents holding credentials they never needed. The fix is a short list of boring controls, applied before real users arrive.

## The demo works. That's the trap.

A prompt, a few iterations, a login screen, a database, a deploy button. The app does exactly what you asked.

The trouble is everything you didn't ask for:

- Who may read this row?
- What happens if a stranger calls this endpoint directly?
- Where does the API key live?
- What can the agent delete?

Models optimize for "it runs." Attackers test everything else.

## What went wrong in 2026

```
timeline
    title Vibe-coding security incidents, 2026
    section Early warnings
        Feb : Moltbook database exposes about 1.5M auth tokens
        Mar 24 : UK NCSC warns about vibe-coding risk at RSAC
    section Agents and defaults
        Apr 24 : Coding agent deletes PocketOS production data and backups
        May : RedAccess finds about 5,000 exposed AI-built apps
        May 30 : Supabase makes new tables opt-in to its Data API
    section The scale shows
        Sep 25 : UpGuard finds about 16,000 exposed Supabase databases
        Nov 2 : Crissy Field and Handelsblatt report on open Lovable apps
```

**Lovable apps (November).** German security firm Crissy Field, working with Handelsblatt, scanned 159,041 Lovable projects. Of the 34,545 that used Supabase, 24,664 returned database records to a visitor with no login.

What was readable:

- Email addresses on 7,403 sites
- 1,000+ passport records in one provider's database
- 200,000+ chat messages from a single forum

The researchers used only read requests and the key every page already hands to the browser. The cause was missing row-level security, not a hack of the platform.

**Fair caveat:** the sample isn't representative of all Lovable apps, and some of the exposed data was meant to be public. Lovable calls it an industry-wide Supabase configuration problem. Its head of security later confirmed the root cause was insufficient row-level security, which he said the platform's scanner is built to catch.

**Supabase at large (September).** UpGuard found around 16,000 Supabase-hosted databases exposing some personal data. Supabase says security is a shared responsibility.

**Public by default (May).** RedAccess found about 5,000 apps built with tools like Lovable, Replit, Base44 and Netlify exposing corporate or personal data. Roughly 2,000 held sensitive data with no authentication.

Some tools made apps public unless the builder switched them to private. The platforms argued that a reachable app isn't automatically a breach. Fair, but it means the builder has to decide.

**Moltbook (February).** Wiz found a misconfigured database behind a vibe-coded social network for AI agents. It exposed about 1.5 million authentication tokens and 35,000 email addresses.

**PocketOS (April).** A Cursor agent running Claude Opus 4.6 hit a credential mismatch on a staging task, found an infrastructure token with broad permissions, and deleted a Railway volume.

The production database and its backups went with it in about nine seconds. Railway later restored the data. The agent had ignored the project's rule against destructive commands.

None of these needed an exploit. They needed a browser, a `curl`, or a token lying around.

## Why it keeps happening

### 1. Models are good at rules and bad at context

Tenzai had five coding agents (Cursor, Claude Code, Codex, Replit, Devin) build the same three apps. It found 69 vulnerabilities across the 15 apps.

| Agents usually handle | Agents usually miss | 
|---|---|
| Well-known pitfalls with a clear fix, like SQL injection and XSS (none exploitable in Tenzai's tests) | Authorization on every API endpoint | 
| Code that compiles and runs (near-100% in Veracode's tests) | SSRF: all five agents introduced it in a test built to tempt it | 
|  | Business rules: four of five accepted negative order quantities | 
|  | Security controls nobody asked for | 

The last row matters most. In almost all cases the agents didn't implement those controls badly. They skipped them.

Raw-model benchmarks still show XSS failures, so results depend on the setup. The pattern holds either way: familiar mistakes get avoided, app-specific ones don't.

### 2. Security is improving, slowly

Veracode's October 2026 report put AI code at a 62% security pass rate, up from a stalled 56%. The best models hit 73%, the weakest 44-50%.

That still means roughly four in ten test tasks produce vulnerable code on average. It's a vendor benchmark, not a verdict on your app.

Georgia Tech's Vibe Security Radar tracks CVEs traceable to AI-authored code. It counted 6 in January 2026, 15 in February and 35 in March, for 74 in total since May 2025. That is the latest public tally I could find.

The researchers call these counts a floor, because most AI code carries no attribution.

### 3. Defaults and permissions set the blast radius

Supabase's anon key is public by design. Policies and grants decide what it can reach.

```
flowchart TB
    subgraph sgOpen["Without row-level security"]
        direction LR
        A1["Visitor copies the public<br/>anon key from the JS bundle"] --> A2["Calls the Data API<br/>directly"] --> A3["Table has no policy"] --> A4["Every row returned"]
    end
    subgraph sgLocked["With deny-by-default policies"]
        direction LR
        B1["Same visitor,<br/>same key"] --> B2["Calls the Data API<br/>directly"] --> B3["Policy checks<br/>auth.uid() = user_id"] --> B4["Own rows only,<br/>or nothing"]
    end
    sgOpen ~~~ sgLocked
    classDef danger fill:#fee2e2,stroke:#ef4444,color:#7f1d1d
    classDef safe fill:#dcfce7,stroke:#22c55e,color:#14532d
    class A1,A2,A3,A4 danger
    class B1,B2,B3,B4 safe
```

Supabase has since made new tables in `public` opt-in to the Data API. That became the default for new projects on May 30, 2026, and was scheduled to reach existing projects on October 30, 2026.

It covers new tables only. Tables you already have keep their grants, so audit them yourself.

The PocketOS token had the same shape of problem: far more power than the task needed.

### 4. Nobody owns the review

The UK's NCSC said at RSAC in March that vibe coding is a chance to make software more secure, but only if safeguards are built in from the start. It described the current risk as intolerable for many organizations.

## The hardening checklist

```
flowchart LR
    D["<b>Design</b><br/>Threat model<br/>Who reads, writes<br/>and deletes what"] --> B["<b>Build</b><br/>Deny-by-default access<br/>Secrets server-side<br/>Vetted auth"]
    B --> G["<b>Gate</b><br/>SAST and secret scans<br/>Dependency audit<br/>Human review"]
    G --> T["<b>Test</b><br/>Smoke tests on staging<br/>Cross-user checks"]
    T --> O["<b>Operate</b><br/>Logs and alerts<br/>Tested backups<br/>Security contact"]
    classDef d fill:#dbeafe,stroke:#3b82f6,color:#1e3a8a
    classDef b fill:#ede9fe,stroke:#8b5cf6,color:#4c1d95
    classDef g fill:#fef3c7,stroke:#f59e0b,color:#78350f
    classDef t fill:#ffedd5,stroke:#f97316,color:#7c2d12
    classDef o fill:#dcfce7,stroke:#22c55e,color:#14532d
    class D d
    class B b
    class G g
    class T t
    class O o
```

### 1. Authorization first

This is where most of the damage is. Deny by default, then open up deliberately.

```
-- Lock the table down
alter table public.orders enable row level security;

-- Expose only what the app needs, only to the roles that need it
grant select, insert on public.orders to authenticated;

-- Users see and create only their own rows
create policy "orders: read own"
  on public.orders for select to authenticated
  using ((select auth.uid()) = user_id);

create policy "orders: insert own"
  on public.orders for insert to authenticated
  with check ((select auth.uid()) = user_id);
```

- No `anon` grants unless logged-out access is the point of that table.
- Check ownership on every server endpoint, not only in the UI. IDOR/BOLA is the classic miss.
- Enforce business rules on the server: positive quantities, prices from your database, not the request.
- Keep storage buckets private by default. The `service_role` key never ships to a client.

### 2. Keep secrets off the client

- Anything in the JS bundle is public. Call paid APIs (LLMs, email, payments) from the server, with rate limits and spend caps.
- Turn on secret scanning and push protection. GitGuardian counted 28.65 million new hardcoded secrets in public GitHub commits in 2025, up 34%.
- Rotate any key that ever touched a repo, a screenshot or a chat.

### 3. Don't let the model hand-roll auth

- Use a vetted provider or framework for sessions, password reset, OAuth and MFA.
- Rate-limit and lock out login and reset endpoints.
- Require MFA on admin accounts.

### 4. Validate input and outbound requests

- Validate every request body against a schema (Zod, Pydantic) and use parameterized queries.
- Guard server-side fetches: allowlist destinations and block private and metadata IP ranges.
- Add the controls agents tend to skip: security headers (Helmet for Express, for example), CORS limited to your origins, CSRF protection for cookie sessions, upload type and size checks.

### 5. Verify your dependencies

Models invent package names. One 2025 study found about one in five AI-suggested packages didn't exist. Attackers register those names ("slopsquatting").

- Confirm every new package is real and maintained.
- Commit lockfiles and pin versions.
- Run an audit in CI.

### 6. Constrain agents and infrastructure

```
flowchart TB
    subgraph sgBefore["PocketOS: what happened"]
        direction LR
        P1["Agent works on<br/>a staging task"] --> P2["Hits a credential<br/>mismatch"] --> P3["Finds a token with<br/>broad API permissions"] --> P4["One call deletes the volume<br/>and its backups"]
    end
    subgraph sgAfter["What limits the blast radius"]
        direction LR
        Q1["Agent gets a<br/>staging-only token"] --> Q2["Destructive call on<br/>production is denied"] --> Q3["Deletes need<br/>human confirmation"] --> Q4["Backups live in a<br/>separate account"]
    end
    sgBefore ~~~ sgAfter
    classDef danger fill:#fee2e2,stroke:#ef4444,color:#7f1d1d
    classDef safe fill:#dcfce7,stroke:#22c55e,color:#14532d
    class P1,P2,P3,P4 danger
    class Q1,Q2,Q3,Q4 safe
```

- Give agents least-privilege, environment-scoped tokens. Never hand a coding agent production credentials.
- Require human confirmation for destructive actions.
- Keep backups outside the blast radius and test a restore.

**Rule of thumb:** a rule in a prompt is a request. A permission is a control.

### 7. Put gates in the pipeline

- Run SAST, secret scanning and dependency scanning on every pull request.
- Run a dynamic scan or quick pentest against staging before launch.
- Keep AI-generated PRs small enough for a human to actually read.
- Treat built-in platform scanners as a floor, not a sign-off.

### 8. Operate like it's real

- Log auth events and access to sensitive tables, and alert on anomalies.
- Know what personal data you hold. If you store passports or health records, you carry the obligations however the app was built.
- Publish a security contact ( `/.well-known/security.txt` ) and answer reports.

## A 15-minute pre-launch smoke test

1. **Anonymous read.** Request your tables with only the public key. You want an error or an empty array, never rows.
2. **Cross-user access.** Log in as user B and request user A's record IDs. Expect denial.
3. **Bundle search.** Search your built assets for secrets.
4. **Abuse paths.** Submit a negative quantity and a zero price. Point any URL-fetching feature at`http://169.254.169.254/` .
5. **Blast radius.** List every token your agent or CI can reach. Remove what it doesn't need.

Commands for steps 1 and 3:

```
# Step 1: anonymous read with the public anon key
curl "https://<project>.supabase.co/rest/v1/<table>?select=*&limit=5" \
  -H "apikey: <ANON_KEY>" -H "Authorization: Bearer <ANON_KEY>"

# Step 3: look for secrets in the built bundle
grep -rEi "sk-[a-z0-9]|service_role|secret" dist/
```

## The takeaway

Building got cheap. Being responsible for what you built didn't.

A vibe-coded app is a first draft from a fast, confident junior engineer who has never seen your threat model. Write that threat model down. Put the controls in code and permissions, not in prompts. Make "safe enough to hold other people's data" part of your definition of done.

## Sources

- Crissy Field research on Lovable apps: [https://www.crissyfield.de/research/lovable-en/](https://www.crissyfield.de/research/lovable-en/) and[Cybernews coverage](https://cybernews.com/security/lovable-ai-apps-expose-personal-information/)
- Lovable's security response: [Hacker News thread](https://news.ycombinator.com/item?id=50502105)
- UpGuard Supabase findings, via [TechCrunch](https://techcrunch.com/2026/09/25/some-supabase-customers-are-publicly-exposing-reams-of-peoples-data-to-the-web/)
- Supabase [changelog on Data API exposure](https://supabase.com/changelog/45329-breaking-change-tables-not-exposed-to-data-and-graphql-api-automatically)
- RedAccess report, via [Security Boulevard](https://securityboulevard.com/2026/05/thousands-of-vibe-coded-apps-exposing-corporate-personal-data-redaccess/) and[Axios](https://www.axios.com/2026/05/07/loveable-replit-vibe-coding-privacy)
- Moltbook exposure: [Wiz](https://www.wiz.io/blog/exposed-moltbook-database-reveals-millions-of-api-keys) and[Infosecurity Magazine](https://www.infosecurity-magazine.com/news/moltbook-exposes-user-data-api/)
- PocketOS incident: [IBM](https://www.ibm.com/think/news/how-to-manage-AI-agents) and[Tom's Hardware](https://www.tomshardware.com/tech-industry/artificial-intelligence/victim-of-ai-agent-that-deleted-companys-entire-database-gets-their-data-back-cloud-provider-recovers-critical-files-and-broadens-its-48-hour-delayed-delete-policy)
- Tenzai agent test: [SecurityWeek](https://www.securityweek.com/vibe-coding-tested-ai-agents-nail-sqli-but-fail-miserably-on-security-controls/)
- Veracode GenAI Code Security Report, [October 2026 update](https://www.veracode.com/?p=33104)
- Georgia Tech Vibe Security Radar: [The Register](https://www.theregister.com/2026/03/26/ai_coding_assistant_not_more_secure/)
- NCSC at RSAC 2026: [NCSC](https://www.ncsc.gov.uk/news/ncsc-ceo-seize-disruptive-vibe-coding-opportunity-to-make-software-more-secure)
- GitGuardian State of Secrets Sprawl 2026 and slopsquatting figures, as summarized by the [Cloud Security Alliance](https://labs.cloudsecurityalliance.org/research/csa-research-note-ai-generated-code-security-vibe-coding-202)
