Vibe coding security: 4 leaks to check before you share the link

Vibe coding security: 4 leaks to check before you share the link
Your Supabase key sits in the browser. That's fine. Supabase says it's safe to publish [R1]. The problem is the table behind it, with no rules on who can read it.
That's a vibe coding security problem, and the other three below work the same way. Nothing in the tool is broken. Each leak comes from how these stacks are built. That's the good news, because you can check each one yourself.
Disclosure: yousource publishes this and sells Production Assurance.
Key takeaways
- Supabase calls its publishable key "Safe to expose online"; Row Level Security decides what that key can reach [R1].
- Any variable prefixed
VITE_orNEXT_PUBLIC_ends up in the JavaScript the browser downloads [R10, R11]. - OWASP found broken access control in 100% of the applications it tested for its 2025 Top 10 [R17].
- Invented package names repeat: 43% of hallucinated packages came back in all 10 repeat queries [R19].
- An exposed secret key needs two steps: remove it, then rotate it, because removing it leaves it in git history [R28].
What does vibe coding security actually mean?
Vibe coding security means finding the risks in an AI-built app that you can't see on screen. The app works. The risk sits in the database rules, the browser bundle, the API and the package list.
For the incidents themselves, read our vibe coding horror stories. This post is about the mechanism. Apps built on Supabase or Firebase can talk to the database straight from the browser [R4, R9], and anyone can open the browser's developer tools. OWASP says access checks only work in "trusted server-side code" [R17]. When nobody owns the line between browser and server, the defaults decide.
Leak 1: an open table behind a public key
Supabase gives your app a publishable key, and its docs call it "Safe to expose online" [R1]. Anyone can read it. So the key only reaches what Row Level Security (RLS) allows [R1].
RLS is a set of rules on each table that says which rows a user may read or change. With RLS on and no policies yet, the publishable key gets no data at all [R4]. With RLS off, Supabase's own lint says "anyone with the project's URL can CREATE/READ/UPDATE/DELETE (CRUD) rows" [R7].
The default is where it slips. "For tables created via the dashboard, RLS is enabled by default," Supabase wrote in January 2026 [R5]. Tables created by migrations or external tools that don't switch RLS on fall outside that default [R5]. If your AI tool creates tables in migration code rather than in the dashboard, check every one. Supabase does email project owners when a table has RLS disabled [R5].
Supabase has tightened other defaults this year. Its changelog set 30 October 2026 as the date all projects stop exposing new public tables to the Data API without an explicit GRANT [R6]. Existing tables keep their access. That helps, but RLS still does the row-level work [R6].
Switching RLS on isn't the whole job either. A loose policy can still let everyone in, which Lovable's publish checks now flag [R24].
Firebase has the same shape. When you create a database you pick Locked mode or Test mode, and Test mode rules "allow anyone access" [R8]. Firebase calls its Security Rules "the only safeguard blocking access for malicious users" [R8].
The fix for a Supabase table with RLS off is one line: alter table <schema>.<table> enable row level security; [R7]. Then write policies, because RLS with no policies blocks the publishable key completely [R4].
The check: open the Security Advisor in your Supabase dashboard [R29]. A table flagged rls_disabled_in_public ("Table publicly accessible") is rated ERROR [R7, R29]. Then query every table with only the publishable key and no login: curl 'https://<project>.supabase.co/rest/v1/<table>?select=*' -H 'apikey: <publishable key>' [R31]. An empty result or a permission error is a pass. Private rows are a fail.
Leak 2: secret keys in the browser bundle
Your build tool decides by name which variables reach the browser. Vite exposes anything prefixed VITE_ in client-side code after bundling [R10]. Next.js inlines NEXT_PUBLIC_ values into the bundle at build time [R11]. Vite's docs say it plainly: "VITE_* variables should not contain sensitive information such as API keys" [R10].
An API key in the frontend is fine only when the provider designed it to be public. OpenAI's advice is "Never deploy your key in client-side environments like browsers or mobile apps" [R12]. Stripe says its secret sk_ keys are not safe to expose, while its publishable pk_ keys can go in front-end code [R13]. Supabase's secret key is the worst one to leak: it "bypasses every Row Level Security policy you have" [R2].
AI help doesn't fix this on its own. GitGuardian found commits made with Claude Code's help leaked secrets at a 3.2% rate [R14]. Across all public GitHub commits, the rate was 1.5% [R14].
My rule for an exposed key is very simple: remove it and recycle it. Recycling means rotating. You create a new key, switch the app over and revoke the old one [R30].
Removing the key alone doesn't work. It stays in your git history, which is why gitleaks scans past commits [R28]. It may also sit in copies of builds you've already shipped. And leaked keys last: over 64% of secrets valid in 2022 still worked in January 2026 [R14]. There's more on this in keeping development and production secrets apart.
The check: build the app, then search the output for sk_, rk_, sk- and sb_secret_. On older Supabase projects with legacy keys, make sure the bundle holds the anon key and never the service_role key, the legacy secret key [R2]. For history, gitleaks git -v scans the repo's commits [R28]. TruffleHog's --results=verified option shows which found keys still work against the real service [R27].
Leak 3: login checks that only run in the browser
Broken access control is number one in the OWASP Top 10 for 2025 [R17]. OWASP found some form of it in 100% of the applications tested [R17]. That figure covers software in general, not only AI-built apps.
A check in the browser can hide a button. It can't stop anyone calling the API behind it. In OWASP's own scenario, front-end-only access control is skipped by calling the endpoint directly with curl [R17].
OWASP's rule is that access control "is only effective when implemented in trusted server-side code or serverless APIs, where the attacker cannot modify the access control check or metadata" [R17]. In a Supabase app where the browser talks straight to the database, that server-side check is RLS [R4]. In Firebase, every request from the web client library "is evaluated against your security rules" [R9]. So Leak 1 and Leak 3 are often the same gap seen from two sides.
The check: call each API endpoint while logged out. Then log in as one user and request another user's records by ID. Both should fail. For more ways to test this, see how to test AI-generated code.
Leak 4: packages that don't exist
AI models suggest packages that were never published. Spracklen and colleagues tested 16 models on 576,000 code samples for USENIX Security 2025 [R18]. Commercial models invented package names at an average rate of at least 5.2% [R18]. For open-source models the rate was 21.7% [R18].
The fake names also repeat. 43% of hallucinated packages came back in all 10 repeat queries [R19]. A name that keeps coming back is a name an attacker can register first. That attack is called slopsquatting, a term Socket credits to PSF Developer-in-Residence Seth Larson [R20].
The check: before installing any new dependency, confirm it exists in the registry. Look for a release history and real, named maintainers.
Is AI code getting safer?
A little. In 2025, Veracode found AI-generated code introduced vulnerabilities in 45% of test cases [R21]. Its October 2026 update says the rate fell from 44% to 38% [R22]. That's still more than one in three. Veracode's 2025 study also found bigger models did not do significantly better than smaller ones [R21]. By 2026, large models had pulled slightly ahead [R22].
The platforms scan now too, but the scans advise rather than block. Lovable runs checks in the publish dialog, including for tables without RLS [R24]. Publishing isn't blocked unless a workspace admin or owner turns on "Block publishing with critical issues", except in new Enterprise workspaces [R24]. Lovable's docs say the checks can't promise your app is secure, and add: "You are still responsible for your app's security." [R24] Replit is just as direct: "A scan is not a complete security review." [R25]
There are fair objections. Public keys are meant to be public, so hiding the publishable key fixes nothing [R1, R13]. Supabase keeps tightening its defaults [R5, R6]. People write vulnerable code too, and Veracode found security debt in 82% of organizations [R23]. All of that is true. What AI tools change is speed, and the person building may never see where the browser ends and the server starts.
Before you share the link: a 10-point check
| # | Check (yes/no) | Leak |
|---|---|---|
| 1 | Supabase Security Advisor shows no rls_disabled_in_public ("Table publicly accessible") errors? | 1 |
| 2 | Every table has policies that limit rows to the right users? | 1 |
| 3 | A request to every table with only the publishable key returns no private data? | 1 |
| 4 | Firebase rules are out of Test mode? | 1 |
| 5 | No secret key sits in a VITE_ or NEXT_PUBLIC_ variable? | 2 |
| 6 | A search of the built bundle finds no sk_, rk_, sk- or sb_secret_? | 2 |
| 7 | A gitleaks or TruffleHog scan of git history comes back clean? | 2 |
| 8 | Found a key? Removed it and rotated it, with the old key revoked? | 2 |
| 9 | API calls fail when logged out and when asking for another user's data? | 3 |
| 10 | Every new dependency exists, with a release history and real maintainers? | 4 |
Rather not run it yourself? Production Assurance checks it and ends with a signed verdict: ready, ready with conditions, or not ready yet. It works through 12 questions and 225 checks, and a person checks every result. We sign an NDA before we get access to your code. Either way, run row 3 today: ask your database for data with only the publishable key, and see what comes back.
Frequently asked questions
Is a public Supabase key a leak?
No. Supabase says its publishable key is "Safe to expose online" and only reaches what Row Level Security allows [R1]. The leak is a table with RLS off or a policy that lets everyone in [R7, R24]. The secret key is different: it bypasses every RLS policy and belongs on the server [R2].
Does Lovable's security scan make my app safe?
Not on its own. Lovable's docs say the checks can't promise your app is secure, and "You are still responsible for your app's security." [R24] The scan doesn't block publishing unless a workspace admin or owner turns that on. New Enterprise workspaces start with it on [R24].
What do I do if I find a key in my code?
Remove it and rotate it. Create a new key, switch your app to it and revoke the old one. Deleting the key alone leaves it in git history, which scanners like gitleaks read [R28].
What is slopsquatting?
Slopsquatting is registering a package name that AI models invent, so the next person who installs it gets the attacker's code. Socket credits the term to Seth Larson of the Python Software Foundation [R20]. It works because 43% of hallucinated package names repeat across all 10 repeat queries [R19].
Sources
- [R1] Supabase docs, API keys: publishable key "Safe to expose online"; "Anyone can read it, so it only reaches what Row Level Security allows." — https://supabase.com/
docs/ guides/ api/ api-keys - [R2] Supabase docs, API keys: "Danger: A secret key bypasses every Row Level Security policy you have."; backend only. — https://supabase.com/
docs/ guides/ api/ api-keys - [R4] Supabase docs, Row Level Security: with RLS enabled, no data is accessible through the API with a publishable key until you create policies; "Never use a secret key in the browser." — https://supabase.com/
docs/ guides/ database/ postgres/ row-level-security - [R5] Supabase security retro, 7 Jan 2026: "For tables created via the dashboard, RLS is enabled by default."; migrations/external tools not covered; email alerts for tables with RLS disabled. — https://supabase.com/
blog/ supabase-security-2025-retro - [R6] Supabase changelog, 28 Apr 2026:
publictables not exposed to the Data API by default for new projects from 30 May 2026 and all existing projects on 30 Oct 2026; explicitGRANTneeded; RLS works as before. — https://supabase.com/changelog/ 45329-breaking-change-tables-not-exposed-to-data-and-graphql-api-automatically - [R7] Supabase splinter lint 0013
rls_disabled_in_public, Level: ERROR; "anyone with the project's URL can CREATE/READ/UPDATE/DELETE (CRUD) rows"; fixalter table <schema>.<table> enable row level security;— https://supabase.github.io/splinter/ 0013_rls_disabled_in_public - [R8] Firebase Security Rules basics: Locked mode vs Test mode, Test mode rules "allow anyone access"; "Firebase Security Rules are the only safeguard blocking access for malicious users." — https://firebase.google.com/
docs/ rules/ basics - [R9] Cloud Firestore security: "Every database request from a Cloud Firestore mobile/web client library is evaluated against your security rules." — https://firebase.google.com/
docs/ firestore/ security/ get-started - [R10] Vite docs, env variables:
VITE_variables exposed in client-side code after bundling; "VITE_* variables should not contain sensitive information such as API keys." — https://vite.dev/guide/ env-and-mode - [R11] Next.js docs, environment variables:
NEXT_PUBLIC_values inlined at build time into the client bundle. — https://nextjs.org/docs/ app/ guides/ environment-variables - [R12] OpenAI Help Center, API key safety: "Never deploy your key in client-side environments like browsers or mobile apps." — https://help.openai.com/
en/ articles/ 5112595-best-practices-for-api-key-safety - [R13] Stripe docs, API keys: publishable
pk_keys can go in front-end code; secretsk_keys are not safe to expose (paraphrase). — https://docs.stripe.com/keys - [R14] GitGuardian, State of Secrets Sprawl 2026, 17 Mar 2026: Claude Code-assisted commits 3.2% secret-leak rate vs 1.5% baseline; over 64% of secrets valid in 2022 still valid in Jan 2026. — https://blog.gitguardian.com/
the-state-of-secrets-sprawl-2026/ - [R17] OWASP Top 10 2025, A01 Broken Access Control: #1; found in 100% of applications tested; server-side quote; front-end-only access control scenario bypassed with curl. — https://top10.owasp.org/
2025/ A01_2025-Broken_Access_Control - [R18] Spracklen et al., USENIX Security 2025: 16 LLMs, 576,000 samples; hallucinated packages at least 5.2% (commercial) and 21.7% (open-source). — https://www.usenix.org/
conference/ usenixsecurity25/ presentation/ spracklen - [R19] Spracklen et al., arXiv v3: "43% of hallucinated packages were repeated in all 10 queries". — https://arxiv.org/
html/ 2406.10279v3 - [R20] Socket, 8 Apr 2025: "slopsquatting" coined by PSF Developer-in-Residence Seth Larson. — https://socket.dev/
blog/ slopsquatting-how-ai-hallucinations-are-fueling-a-new-class-of-supply-chain-attacks - [R21] Veracode, 30 Jul 2025: AI-generated code introduced vulnerabilities in 45 percent of test cases; larger models "do not perform significantly better". — https://www.veracode.com/
press-release/ ai-generated-code-poses-major-security-risks-in-nearly-half-of-all-development-tasks-veracode-research-reveals/ - [R22] Veracode, 29 Oct 2026: pass rate 56% to 62%, vulnerable tasks 44% to 38%; large models 55% vs small 51%. — https://veracode.com/
press-release/ veracode-finds-first-meaningful-gain-in-ai-code-security-since-2025-as-average-pass-rate-hits-62 - [R23] Veracode State of Software Security 2026, 24 Feb 2026: "82 percent of organizations now harbor security debt". — https://www.veracode.com/
veracode-2026-state-of-software-security-report-reveals-four-out-of-five-organizations-are-drowning-in-security-debt/ - [R24] Lovable docs, security: publish-dialog checks incl. tables without RLS and "a rule that lets everyone in"; publishing not blocked by default; "Block publishing with critical issues" admin setting, on by default only for new Enterprise workspaces; checks "can't guarantee that your app is secure or replace a full security review"; "You are still responsible for your app's security." — https://docs.lovable.dev/
features/ security - [R25] Replit docs, Agent security scans: "A scan is not a complete security review." — https://docs.replit.com/
features/ security/ agent-security-scans - [R29] Supabase docs, Database Advisors: Studio has a Security Advisor; check
0013_rls_disabled_in_public, Level: ERROR, "Table publicly accessible". — https://supabase.com/docs/ guides/ database/ database-advisors - [R30] OpenAI API keys guide: "To rotate a key, issue a replacement, update the workload, verify that it works, and revoke the previous key." — https://developers.openai.com/
api/ docs/ guides/ api-keys - [R31] Supabase docs, REST API quickstart:
curl 'https://<PROJECT_REF>.supabase.co/rest/v1/leaderboard?select=*&order=score.desc' -H "apikey: <PUBLISHABLE_KEY>". — https://supabase.com/docs/ guides/ api/ quickstart - [R27] TruffleHog README: "A verified result means TruffleHog confirmed the credential is valid by testing it against the service's API.";
--results=verified. — https://github.com/trufflesecurity/ trufflehog - [R28] gitleaks README:
gitleaks git -v <repo>scans git history;gitleaks dir -v <path>scans files. — https://github.com/gitleaks/ gitleaks