Hire Software Developers 7
Back to blogs

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

December 1, 2026
A public key on a browser window while the data drawer behind it stands open, the gap at the centre of vibe coding security

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_ or NEXT_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.

#Check (yes/no)Leak
1Supabase Security Advisor shows no rls_disabled_in_public ("Table publicly accessible") errors?1
2Every table has policies that limit rows to the right users?1
3A request to every table with only the publishable key returns no private data?1
4Firebase rules are out of Test mode?1
5No secret key sits in a VITE_ or NEXT_PUBLIC_ variable?2
6A search of the built bundle finds no sk_, rk_, sk- or sb_secret_?2
7A gitleaks or TruffleHog scan of git history comes back clean?2
8Found a key? Removed it and rotated it, with the old key revoked?2
9API calls fail when logged out and when asking for another user's data?3
10Every 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

back to top
Book 15 min with Albert
Smiling man with short dark hair and glasses wearing a black suit, white shirt, and black tie against blue background.
Tell Albert what you're shipping.
He'll read this before joining the call. Phone number comes next, on the calendar step.
↳ info@you-source.com
↳ 4-hour response
Please wait while we retrieve meeting schedules.
Oops! There's a problem with your request. We're working on fixing it. Please try again later.