OxyPages

The Vibe Coding Security Checklist Before You Deploy

The Vibe Coding Security Checklist Before You Deploy

A vibe coding security checklist for the minute before your agent deploys: leaked .env files, bundled keys, source maps and test data, with a fix for each.

The OxyPages Team · · 7 min read

Your agent just said "Deployed!" and handed you a link. The site looks right. What you haven't checked is what else went up with it.

A static host publishes every file in the folder it's given. Not just the pages: every file, and anyone with the address can request any of them by name. The agent doesn't know which ones you meant to keep private, because you never told it, and it was never going to ask.

So a vibe coding security problem is rarely a hacker breaking in. It's you, or your agent, publishing something that should have stayed on your laptop. A .env file. A key baked into the JavaScript. A test page with real customer emails on it.

All of that is checkable before the deploy, in about two minutes, with commands you can paste. This post is that checklist: what slips out, how to spot each one, and what to do if a key has already gone public.

TL;DR: Before any agent deploys, check the build output folder (usually dist, build or out), not your project. Look for six things: .env files, secret keys inside the JavaScript, source maps (.map files), admin or test pages, data exports and backups, and a .git folder. Any variable starting with VITE_, NEXT_PUBLIC_, PUBLIC_ or REACT_APP_ is copied into the browser bundle, so it must never hold a secret. If a secret has already been deployed, deleting it isn't enough: rotate it at the provider.

What Can An Agent Publish By Accident?

Anything sitting in the folder it deploys. These six are the usual suspects:

  1. A .env file. Where your keys live during development. If one ends up in the output folder, it's a public text file.
  2. Secret keys inside the JavaScript. The sneaky one, because no file looks wrong. The key is pasted into the bundle at build time.
  3. Source maps. Files ending in .map that rebuild your original, readable source code in anyone's browser tools.
  4. Admin, debug or test pages. The admin.html or /test page the agent made while building, still linked from nowhere but still there.
  5. Data exports and backups. A customers.csv, a backup.zip, a database dump the agent used as sample data.
  6. A .git folder. Your whole project history, including anything you committed and later deleted.

None of these are exotic. They're the normal leftovers of building something fast, the security cousins of the content mistakes an AI leaves in a page, like invented testimonials. The fix is a habit you build once.

Why Do Public Prefixes Leak Your Keys?

Because that's their job. Build tools use a name prefix to decide which environment variables get copied into the code that runs in the browser, and anything copied there is readable by every visitor.

Vite's docs are blunt about it: variables prefixed with VITE_ "will be exposed in client-side source code after Vite bundling", and they "should not contain sensitive information such as API keys." The same rule applies to NEXT_PUBLIC_ in Next.js, PUBLIC_ in Astro and SvelteKit, NUXT_PUBLIC_ in Nuxt and REACT_APP_ in Create React App.

Vite's documentation on environment variables and what gets exposed

AI agents walk into this constantly. You ask for a feature that calls an API, the agent needs the key somewhere the browser can see it, and the obvious place is a VITE_ variable. The app works. The key is now public.

Some keys are fine to expose and some never are. Supabase is a clean example: its publishable key (the old "anon" key) is designed to sit in a browser, and Row Level Security decides what it can reach. Its secret key (the old "service_role" key) bypasses every one of those rules, and Supabase's docs say it must never be in a browser. Payment keys, AI provider keys and email-sending keys belong in the "never" group too.

How each prefix works, and how to name things so this can't happen, is its own topic. How Vite environment variables actually work goes through it properly.

The Vibe Coding Security Checklist

The Vibe Coding Security Checklist - OxyPages

Run these against the build output folder, after the build and before the deploy. The examples assume dist; swap in build or out if that's where yours goes. On Windows, run them in Git Bash or WSL, or ask your agent to run them for you.

CheckCommandWhat a bad result looks likeFix
Hidden filesls -a dist.env, .git or .DS_Store in the listDelete them, and work out why the build copied them
Source mapsfind dist -name "*.map"Any resultsTurn source maps off for production builds
Secret-looking stringsgrep -rIl -E "sk_live_|sk-proj-|service_role|sb_secret_|PRIVATE KEY" distAny file name printedMove the call to a server, rotate the key
Stray pagesfind dist -name "*.html"admin.html, test.html, debug.htmlDelete them from the source, rebuild
Data filesfind dist -name "*.csv" -o -name "*.sql" -o -name "*.zip"Anything you didn't put there on purposeRemove it from public/ or wherever it came from
File countfind dist -type f | wc -lFar more files than you expectedLook at what's in there before sending it

The grep pattern catches the common key shapes: Stripe live keys, OpenAI-style keys, Supabase secret keys and private key files. It won't catch everything, and now and then a match is a false alarm, so open the file and look. A clean result means "nothing obvious", not "safe".

The source map check matters more than it looks. Vite leaves production source maps off by default, but agents sometimes switch them on while debugging and never switch them back. Look for sourcemap: true in vite.config and remove it.

Give The Checklist To Your Agent

You don't have to run this by hand every time. Paste the table into your project's instructions file, such as an AGENTS.md file with a Deploying section, and tell the agent to run every check before deploying and stop if any of them fails. Agents are good at boring, repeatable checks. They're bad at guessing which files you consider private.

Walkthrough: A Waitlist Page With The Wrong Supabase Key

Here's how this goes wrong in a real build. Say you asked an agent for a waitlist page for a pottery class: a heading, a short description and an email box that saves sign-ups to a Supabase table.

It works first time. Emails land in the table. Before deploying, you run the checklist:

  1. ls -a dist shows index.html, an assets folder and nothing hidden. Good.
  2. find dist -name "*.map" finds nothing. Good.
  3. The grep prints one file: assets/index-4b2e91.js. Not good.
  4. You open your .env and find VITE_SUPABASE_KEY set to the secret key, not the publishable one. The agent grabbed the first key on the Supabase settings page.
  5. You swap it for the publishable key and rebuild. The form stops saving, because the table has no policy allowing anonymous inserts.
  6. You ask the agent to turn on Row Level Security for that table and add a policy that lets anyone insert a row but nobody read the list. The form works again, and the key in the browser can now do exactly one thing.
  7. You run the grep again. Nothing prints. Now you deploy.

If that secret key had gone live even once, step 5 isn't enough. You'd also rotate it in Supabase, because someone could have copied it in the minutes it was up.

What Hosts Strip, And Why It's Not Enough

Some hosts clean up the obvious junk for you, and none of them can read your mind. What gets removed depends entirely on the host, so check yours rather than assume.

As one example, OxyPages strips node_modules, .git folders and .map files from a no-account app deploy, refuses project source code outright, and scans the files for pages that try to collect passwords. That's a safety net, not a guarantee. A secret key inside your JavaScript looks like any other text, and no host can tell your private customers.csv from a file you meant to share.

Other hosts strip less, or nothing, and publish exactly what you give them. That's not a flaw. A host's job is to serve your files, and it can't know which ones you'd rather it didn't.

The bigger point is that a static site has nowhere to hide a secret. Every file it serves is public by design. If a feature genuinely needs a secret key, like charging a card or calling an AI model on your bill, that code needs a server you control, and a static host such as ours is the wrong place for it. Vercel, Netlify and Cloudflare Workers can all run that kind of code.

What To Do Next

Build the site, then run the six checks against the output folder before anything gets deployed. If the grep prints a file name, stop and fix it first. Then add the checklist to your agent's instructions so it runs the same checks on every deploy, including the quick throwaway ones.

If you're testing with a temporary link, the same rules apply: how no-account deploys and claim links work explains why even a 30-minute link is public the whole time it's up.

When the folder is clean, drop the build and get a live link to check it on your phone.

FAQ

Is Vibe Coding Secure?

It's as secure as what you let the agent publish. The code an AI writes isn't worse than average, but it moves fast and leaves things lying around. Checking the output folder before every deploy catches most of the real-world leaks.

Is It Safe To Put An API Key In A VITE_ Variable?

Only if the key is designed to be public, like a Supabase publishable key or a map service's browser key restricted to your domain. Anything with a VITE_ prefix ends up in the browser bundle where anyone can read it. A secret key never belongs there.

What Do I Do If I Already Deployed A Secret Key?

Rotate it at the provider straight away, then remove it from the code and redeploy. Deleting the file or redeploying alone doesn't help, because anyone who loaded the site may already have a copy. Check the provider's usage log for anything you didn't do.

Should I Let An Agent Deploy Without Checking?

For a throwaway test with no keys and no real data, it's low risk. For anything with a .env file, a database or real customer details, run the vibe coding security checklist first, or tell the agent to run it and stop on any failure.

Try It Now

Still Here? Drop It In.

The whole pitch fits in one sentence: your HTML, on a link, in seconds.

Drag and drop your HTML files, a folder, a ZIP, your app's build folder, a PDF or an image

or ·

No account needed. Your unclaimed website stays live for 30 minutes on a free subdomain. Claim it to your account to keep it permanently.

  • No Account Needed
  • Free SSL
  • 30-Minute Unclaimed Link, Claim To Keep It