DEV Community

Cover image for Your Vibe-Coded Site Is Live. Here's What a Stranger Can Read From It in Five Minutes
Vincent for Polydraft

Posted on

Your Vibe-Coded Site Is Live. Here's What a Stranger Can Read From It in Five Minutes

This week on X, two posts about vibe-coded sites landed next to each other. One founder launched a passive pre-launch scanner and claimed that half the people shipping with Cursor, Claude, and Lovable leak keys, expose .env files or source maps, or skip basic security headers. That is their number, not a measured one, and I would not quote it as a statistic. The other post was a warning that coding agents will obey any AGENTS.md they find, including one a random website dropped into your Downloads folder.

Put them together and you get the uncomfortable version of "it works on my machine": it works on the internet, and the internet can read more of it than you think.

You do not need a pentest to find the worst of it. Everything below is passive. It is what a curious stranger, a scraper, or a bored teenager can learn with curl and five minutes, against your own site. Run it before you announce the launch, not after someone else does.

A website seen from outside: a stranger with a magnifying glass reading the files, headers, and scripts a vibe-coded site exposes

Why vibe-coded sites leak in the same places

None of this is new. What is new is how fast a site goes from prompt to public URL. Whether you vibe-code it in Cursor, prompt an app builder, or use an AI website builder, the build step that used to take a week (and gave someone time to ask "wait, is that key public?") now takes an afternoon. The model writes what you asked for. It does not know which environment variable is a secret, which folder gets deployed, or that the static host will happily serve a file named .env if one ends up in the output directory.

So the leaks cluster in five places: files that should not be deployed, secrets compiled into the JavaScript, source maps, missing headers, and a database that trusts the browser.

The five-minute scan

Set one variable and run the blocks in order. Everything here is a plain GET request.

SITE="https://yourdomain.com"   # your own site only
Enter fullscreen mode Exit fullscreen mode

1. Files that should never be public

for p in .env .env.local .env.production .git/HEAD .git/config \
         AGENTS.md CLAUDE.md .cursorrules package.json; do
  code=$(curl -s -o /tmp/probe -w "%{http_code}" "$SITE/$p")
  printf "%s  /%-18s %s\n" "$code" "$p" "$(head -c 60 /tmp/probe | tr '\n' ' ')"
done
Enter fullscreen mode Exit fullscreen mode

Read the third column, not just the status code. Single-page apps often answer every unknown path with 200 and the contents of index.html, so a 200 that starts with <!doctype html> is just the fallback. A 200 that starts with ref: refs/heads/main (a real .git/HEAD) or DATABASE_URL= is the bad kind.

If .git/HEAD is real, assume your full history (including any key you ever committed and "removed") can be reconstructed. Rotate first, clean up second.

2. Secrets compiled into your bundles

Front-end frameworks only expose environment variables you explicitly mark as public: VITE_ in Vite, NEXT_PUBLIC_ in Next.js. The classic vibe-coding mistake is an agent "fixing" an undefined variable by adding that prefix to a secret, which compiles it straight into the JavaScript every visitor downloads.

curl -s "$SITE" | grep -oE 'src="[^"]+\.js"' | cut -d'"' -f2 | sort -u > bundles.txt
while read -r js; do
  case "$js" in http*) url="$js" ;; *) url="$SITE/${js#/}" ;; esac
  curl -s "$url" -o /tmp/b.js
  echo "== $js"
  grep -oE '(sk_live_|rk_live_|sk-proj-|sk-ant-|sb_secret_|AKIA)[A-Za-z0-9_-]{6}' /tmp/b.js | sort -u
  tail -c 300 /tmp/b.js | grep -o 'sourceMappingURL=[^ ]*'
done < bundles.txt
Enter fullscreen mode Exit fullscreen mode

Some keys are meant to be public: a Stripe pk_live_ publishable key, a Supabase publishable or anon key, an analytics site ID. Prefixes like sk_live_ (Stripe secret), sk-proj- and sk-ant- (LLM API keys), sb_secret_, and AKIA (AWS access key IDs) are not. If one shows up, rotate it at the provider today and move the call that needs it behind a server function.

Older Supabase projects use JWTs as keys, and the dangerous one looks exactly like the safe one until you decode it:

grep -oE 'eyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+' /tmp/b.js | sort -u | while read -r t; do
  p=$(echo "$t" | cut -d. -f2 | tr '_-' '/+')
  while [ $(( ${#p} % 4 )) -ne 0 ]; do p="$p="; done
  echo "$p" | base64 -d 2>/dev/null | grep -o '"role":"[^"]*"'
done
Enter fullscreen mode Exit fullscreen mode

"role":"anon" is expected. "role":"service_role" in a browser bundle means anyone can bypass your database rules.

3. Source maps

The last block also printed any sourceMappingURL comments. Vite and Next.js do not ship browser source maps in production by default, but agents turn them on while debugging and nobody turns them off. A public .map file hands over your original source, comments and all, including the // TODO: move this key to the server you meant to act on. Unless you deliberately publish maps, set build.sourcemap: false (Vite) or leave productionBrowserSourceMaps off (Next.js), or upload maps to your error tracker instead of the CDN.

Inside the JavaScript bundle: a public key that is fine, a secret key that is not, and a source map that gives away the original code

4. Headers

curl -sI "$SITE" | grep -iE "strict-transport|content-security|x-content-type|referrer-policy|permissions-policy|x-frame"
Enter fullscreen mode Exit fullscreen mode

For a marketing site, a sensible baseline is:

  • Strict-Transport-Security: max-age=31536000 (add includeSubDomains only once every subdomain is on HTTPS)
  • X-Content-Type-Options: nosniff
  • Referrer-Policy: strict-origin-when-cross-origin
  • Content-Security-Policy with at least frame-ancestors 'self', so nobody can frame your pricing page inside theirs

Most static hosts let you set these in a file next to your build: _headers on Cloudflare and Netlify, a headers block in vercel.json. Start with a CSP in Content-Security-Policy-Report-Only mode, because a strict policy written by an agent that never saw your analytics script will break things quietly.

5. A database that trusts the browser

If your site writes form leads straight to Supabase or Firebase from the client, the key in the bundle is fine only if row-level rules are on. Check it with the same key a stranger would use:

curl -s "$SUPABASE_URL/rest/v1/leads?select=*&limit=1" \
  -H "apikey: $ANON_KEY" -H "Authorization: Bearer $ANON_KEY"
Enter fullscreen mode Exit fullscreen mode

If that returns somebody's email address, so does it for everyone. Turn on Row Level Security for the table and allow insert only. Your contact form needs to write leads, not read them back.

Two things the scan will not catch

Your robots.txt is a map, not a lock. Every Disallow: /admin line advertises a path. Use robots.txt to manage crawlers, not to hide things. (If you are writing one for the first time, here are robots.txt rules for AI crawlers that cover the crawlers that matter now.) Anything private needs authentication, not a polite request.

Your agent instruction files are part of the attack surface in both directions. Outbound: AGENTS.md, CLAUDE.md, and prompt files in public/ get deployed like any other static file and often describe your stack, your API routes, and sometimes your keys. Inbound: as that X post warned, a coding agent will follow instructions from any AGENTS.md in the folder it opens. Do not start an agent in Downloads or in a freshly cloned repo you have not read, and treat instruction files in pull requests like code.

Files you do want public are a different story. An llms.txt is meant to be read by machines, which is exactly why it should contain only what you would put on your homepage. Our llms.txt example and validation steps show what belongs in one.

A pre-launch gate checklist: files, bundles, source maps, headers, database rules, all green before the domain goes live

Make it a gate, not a one-off

A scan you run once is a scan that is out of date after the next prompt. Save the blocks above as prelaunch.sh, make it exit non-zero when it finds a real .git/HEAD, a secret prefix, a map file, or a missing HSTS header, and run it against every preview URL before it is promoted. It sits next to the rest of your launch-day SEO checks: one list checks that search engines can read the right things, this one checks that strangers cannot read the wrong ones.

What we do in PolyDraft, and what we do not claim

PolyDraft is the AI website builder we work on. It publishes server-rendered HTML to your own Cloudflare account, so the deployed files and the edge configuration are in an account you control and can inspect. That makes this scan easy to run and easy to act on. It does not make it unnecessary. We still run checks like these on what we ship, and you should run them on anything with your name on the domain, whoever or whatever built it.

Before you post the launch tweet

  1. Probe for .env, .git/HEAD, and agent files, and read the response bodies.
  2. Grep every bundle for secret prefixes and decode any JWT you find.
  3. Kill public source maps.
  4. Set the four baseline headers.
  5. Prove your database refuses an anonymous read.
  6. Keep your coding agent out of folders you did not write.

Ten minutes, all of it passive, all of it on your own site. Cheaper than finding out from a stranger's screenshot.

Top comments (0)