--- title: "Vibe-Coded Apps Are Easy to Build. Hardening Them Is the Real Work." author: "Anshu Pathak" published: "2026-11-27T05:02:32.149Z" updated: "2026-11-27T05:02:32.149Z" url: "https://zyvop.com/vibe-coded-apps-are-easy-to-build-hardening-them-is-the-real-work-3k1l5" canonical: "https://zyvop.com/vibe-coded-apps-are-easy-to-build-hardening-them-is-the-real-work-3k1l5" tags: ["secure coding","Application Security","AI agents","vibe coding","supabase"] --- # Vibe-Coded Apps Are Easy to Build. Hardening Them Is the Real Work. AI tools get you to a working demo in an afternoon. The gap between that demo and an app you can trust with real users' data is where the engineering lives. ![Cover image]() > **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 ```mermaid 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. ```mermaid flowchart TB subgraph sgOpen["Without row-level security"] direction LR A1["Visitor copies the public
anon key from the JS bundle"] --> A2["Calls the Data API
directly"] --> A3["Table has no policy"] --> A4["Every row returned"] end subgraph sgLocked["With deny-by-default policies"] direction LR B1["Same visitor,
same key"] --> B2["Calls the Data API
directly"] --> B3["Policy checks
auth.uid() = user_id"] --> B4["Own rows only,
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 ```mermaid flowchart LR D["Design
Threat model
Who reads, writes
and deletes what"] --> B["Build
Deny-by-default access
Secrets server-side
Vetted auth"] B --> G["Gate
SAST and secret scans
Dependency audit
Human review"] G --> T["Test
Smoke tests on staging
Cross-user checks"] T --> O["Operate
Logs and alerts
Tested backups
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. ```sql -- 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 ```mermaid flowchart TB subgraph sgBefore["PocketOS: what happened"] direction LR P1["Agent works on
a staging task"] --> P2["Hits a credential
mismatch"] --> P3["Finds a token with
broad API permissions"] --> P4["One call deletes the volume
and its backups"] end subgraph sgAfter["What limits the blast radius"] direction LR Q1["Agent gets a
staging-only token"] --> Q2["Destructive call on
production is denied"] --> Q3["Deletes need
human confirmation"] --> Q4["Backups live in a
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: ```bash # Step 1: anonymous read with the public anon key curl "https://.supabase.co/rest/v1/?select=*&limit=5" \ -H "apikey: " -H "Authorization: Bearer " # 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/]() and [Cybernews coverage]() - Lovable's security response: [Hacker News thread]() - UpGuard Supabase findings, via [TechCrunch]() - Supabase [changelog on Data API exposure]() - RedAccess report, via [Security Boulevard]() and [Axios]() - Moltbook exposure: [Wiz]() and [Infosecurity Magazine]() - PocketOS incident: [IBM]() and [Tom's Hardware]() - Tenzai agent test: [SecurityWeek]() - Veracode GenAI Code Security Report, [October 2026 update]() - Georgia Tech Vibe Security Radar: [The Register]() - NCSC at RSAC 2026: [NCSC]() - GitGuardian State of Secrets Sprawl 2026 and slopsquatting figures, as summarized by the [Cloud Security Alliance]()