How a vibe-coded app leaked 1.5 million API keys: the Moltbook case study
In January 2026 a viral "social network for AI agents" called Moltbook hit the top of hacker news. Days later, security researchers showed that anyone on the internet could read and rewrite its entire production database — including 1.5 million agent API tokens and 35,000 user emails. The founder had said publicly he "didn't write a single line of code." This is the most expensive illustration so far of a class of bug that shows up in almost every vibe-coded launch.
What happened
Moltbook presented itself as the "front page of the agent internet" — a Reddit-like forum where AI agents post, comment and vote. OpenAI founding member Andrej Karpathy called it "genuinely the most incredible sci-fi takeoff-adjacent thing I have seen." Then Wiz walked in.
By browsing the site like a normal user and inspecting the production JavaScript bundle, they found a Supabase project URL and the Supabase anon public key hardcoded in _next/static/chunks/18e24eafc444b2b9.js. That alone is normal. The very next request — a plain GET to the Supabase REST endpoint with that key — returned agent API tokens. No login. No cookie. No exploit beyond "use the published key."
From there they enumerated tables through PostgREST error messages and GraphQL introspection, mapped roughly 4.75 million records, and also confirmed full write access — meaning any unauthenticated visitor could edit any post on the platform, inject prompt-injection payloads into content consumed by thousands of agents, or deface the site. The Moltbook team secured it within hours of disclosure and all research data was deleted.
The actual root cause: not the key, the missing policy
The common headline ("Supabase key leaked in JavaScript!") is misleading. Supabase is designed to ship the anon key to the browser. It is a project identifier, not a secret. The security boundary is Row Level Security (RLS): policies on every table that say "an anonymous client may read row X only if condition Y holds." With RLS on, the public key is safe. With RLS off, it is effectively a master key, because PostgREST will happily serve the whole table to whoever holds it.
In Moltbook's case the founders shipped without RLS on the tables that mattered: agents (with api_key, claim_token, verification_code), owners, agent_messages, and an early-access observers table. A single GET returned every credential. Some of those DMs even contained plaintext OpenAI API keys shared between agents.
// This is fine — IF row-level security is on for every table.
const supabase = createClient(
"https://xxx.supabase.co",
"sb_publishable_..." // anon key, meant to be public
)
const { data } = await supabase.from('agents').select('*')
// With RLS off -> returns every agent's api_key.
// With RLS on -> returns [] unless a policy allows it.
Why vibe-coded apps keep shipping this
The founder of Moltbook said it plainly: "I didn't write a single line of code for @moltbook. I just had a vision for the technical architecture, and AI made it a reality." That workflow produces working software fast and insecure software faster, for three reasons:
- AI optimizes for "works", not "safe." A model will happily wire up
select(*)against a table with no policy because that makes the demo pass. Security is not in the prompt unless you put it there. - Supabase defaults are permissive. RLS is off by default on new tables. The dashboard even warns you, but if nobody reads it, nothing breaks until someone pokes the API.
- No pre-launch gate. There is usually no step between "it runs locally" and "it's on the internet." The question that never gets asked is the one on the URL above: is my app safe to launch?
Moltbook is not an outlier. Security teams have been reporting the same pattern weekly since late 2025: committed .env files, service-role keys in client bundles, open storage buckets, missing auth on admin routes, and dependency CVEs nobody patched because the agent never added a lockfile.
The 60-second pre-launch checklist
- Every table in your database has RLS enabled and at least one policy. (
alter table ... enable row level security;) - No secret or service-role key appears in any file under
src/,public/, or your bundler output. Search forsk_,service_role,OPENAI_API_KEY. - Every private route checks authentication server-side, not just hides the link in the UI.
- Storage buckets are private unless a file is intentionally public; signed URLs for private assets.
- Dependencies are pinned;
npm audit/pip-auditclean on high and critical. - Sensitive env vars live only on the server, never in
NEXT_PUBLIC_*(or ViteVITE_*).
If you vibe-coded your app, run this checklist before you share the URL with anyone — not after. Moltbook's exposure window was days, and most apps never get a coordinated disclosure; they just get crawled.
How Vibe-Scan can catch this for you
Vibe-Scan is a one-command pre-launch security scan for vibe-coded apps. Paste a GitHub repo URL; in about 60 seconds you get a verdict — Safe / Needs work / Do not ship — plus every finding with file:line and a copy-paste fix snippet. The checks that would have flagged Moltbook-style issues:
- Leaked secrets in source and tracked config files (API keys, tokens, passwords,
.envcontents). - Insecure defaults: open databases, missing auth on routes, debug mode, CORS
*. - Dependency vulnerabilities from your lockfile.
- PII and privacy leaks in client bundles.
Is your app safe to launch?
Free 3-check scan. Full report with every finding and fix snippet: $29.
Scan your repo now