On October 29, 2026, Cloudflare merged a fix to Wrangler whose description reads like an incident report. When a static site with an index.html in its root was deployed without a config file, Wrangler's automatic configuration set the project root as the public assets folder. Autoconfig had code to write an ignore file for that case, but a path comparison bug meant it never ran, so the site "uploads .env, .dev.vars, .git, node_modules, .wrangler/tmp and any functions/ source as public assets," in the words of pull request #16367.
That's the exact path an AI agent takes when you say "deploy this to Cloudflare": no config, npx wrangler deploy, done. Cloudflare shipped the fix in a patch release with no security advisory. We reproduced the bug on four Wrangler versions and checked whether the fix reaches sites that already shipped. It doesn't.
TL;DR
If you deployed a plain HTML or static site to Cloudflare Workers by running wrangler deploy or wrangler setup with no config file, between Wrangler 4.68.0 (February 2026) and 4.155.0, open your wrangler.jsonc. If it says "directory": "." and there's no .assetsignore file next to it, your .env and .git folder were probably uploaded as public files. Run curl https://your-site/.env to check. Upgrading Wrangler doesn't repair a project that's already configured: add the .assetsignore yourself, rotate the keys, and redeploy.
What went wrong, in one paragraph
Cloudflare made Wrangler's automatic configuration generally available on February 25, 2026, starting with Wrangler 4.68.0: run wrangler deploy in a project with no config file and it detects your framework, writes a wrangler.jsonc and deploys. For a folder that's just an index.html plus some files, it detects "Static" and sets the assets directory to ., the project root. Every file in the assets directory becomes a public URL unless an .assetsignore file says otherwise. Autoconfig had code to write that file for exactly this case, but according to the 4.156.0 changelog the check compared a relative path with an absolute one, never matched, and so the file was never written.
What we reproduced
We ran the no-config setup in a test folder holding an index.html, a .env with a fake key in it, and a git init'd repo. Here's what each Wrangler version did (tested November 11, 2026):
| Wrangler version | Released | Assets directory | .assetsignore written? |
|---|---|---|---|
| 4.68.0 | Feb 23, 2026 | . | No |
| 4.100.0 | Jun 11, 2026 | . | No |
| 4.130.0 | Sep 8, 2026 | . | No |
| 4.155.0 | Oct 28, 2026 | . | No |
| 4.160.0 (current) | Nov 10, 2026 | . | Yes, with .env*, .git, node_modules, .npmrc |
Then we served the 4.155.0 project with wrangler dev and requested the files a scanner would ask for:
GET / 200 <h1>hi</h1>
GET /.env 200 STRIPE_SECRET_KEY=sk_test_canary123
GET /.git/config 200 [core] repositoryformatversion = 0 ...
GET /.git/HEAD 200 ref: refs/heads/master
GET /wrangler.jsonc 200
The same project served by Wrangler 4.160.0, the version you'd get by upgrading today, still returned /.env with a 200. A fresh setup on 4.160.0 returned 404 for both /.env and /.git/config.
We tested the local dev server, not a live workers.dev deploy. Two things make us confident production behaves the same. Cloudflare's own PR describes these files being uploaded as public assets. And the code that builds the upload list in Wrangler 4.155.0 skips only .assetsignore, _redirects and _headers by default; everything else in the folder goes up. We found nothing in Cloudflare's asset-serving docs that holds back dotfiles once they're uploaded.
One thing narrows who got hit. Workers rejects any single asset over 25 MiB, so a project with a local node_modules (which holds Wrangler's own large runtime binary) usually fails to deploy at all. The clean exposure is the shape our test used: a folder of plain HTML, deployed with npx wrangler deploy and no local install. That's also the shape an agent produces for a quick landing page.
Your .gitignore doesn't help here. Autoconfig added .env* to .gitignore in our test, so the key never reached GitHub. It still got served. Git reads .gitignore; Wrangler's asset upload reads .assetsignore. Two files, two jobs.
Check your site in two minutes
Look at your config
Open wrangler.jsonc (or wrangler.json / wrangler.toml) in your project. You're affected if both are true: the assets directory is "." (or ./), and there's no .assetsignore file in that same folder. If your assets directory is a build folder like dist or public, this bug didn't touch you.
Ask the live site
for p in .env .dev.vars .git/config .npmrc wrangler.jsonc; do
printf "%s -> " "$p"
curl -s -o /dev/null -w "%{http_code}\n" "https://your-site.example.com/$p"
done
Anything other than 404 means the file is public. A 200 on /.git/config usually means the whole repository can be downloaded and rebuilt, history included; our guide to an exposed .git directory covers what that gives away.
Add the ignore file
Create .assetsignore in the root of your assets directory. It uses .gitignore syntax. This mirrors what Wrangler 4.156.0 and later now write:
.env*
.dev.vars*
.git
node_modules
.npmrc
.wrangler
/_worker.js
/_routes.json
/functions
.DS_Store
wrangler.jsonc
Cloudflare's static assets docs describe the file. The wrangler.jsonc line is our addition: the config isn't secret, but there's no reason to publish it. A cleaner long-term fix is to move your site files into a public/ folder and point assets.directory at that, so your project root is never the thing being uploaded.
Rotate, then redeploy
If step 2 returned a 200 for anything holding a secret, rotate every key in it at the provider first. Treat them as read: search engines, scrapers and the people who sweep for /.env don't announce themselves. Then upgrade Wrangler to 4.156.1 or later (that release also fixed a related bug where wrangler pages deploy <dir> could upload the project root instead of <dir>), wrangler deploy, and re-run the curl loop until everything is a 404.
Why this one lands on vibe-coded sites
The people most likely to hit this are the people who never opened a config file. An agent told to "put this on Cloudflare" will happily run npx wrangler deploy in your project root, and since February that just works with no questions about which folder is public. A hand-rolled wrangler.jsonc almost always points at dist or public. The root-as-assets shape is mostly what autoconfig produces for a folder of plain HTML, which is exactly what a lot of AI-built landing pages are.
Our scanner already requests /.env, /.env.production, /.git/HEAD, /.git/config and /.npmrc on every scan and rates a readable .env critical. This bug is a new way to end up in that list, not a new kind of finding.
Have your AI editor check it
Audit a Cloudflare Workers static deploy
Open my Wrangler config. If the assets directory is the project root ("." or "./"), check whether an .assetsignore file exists in that folder. If it doesn't, create one that excludes .env*, .dev.vars*, .git, node_modules, .npmrc, .wrangler, /_worker.js, /_routes.json, /functions, .DS_Store and wrangler.jsonc. Then list every file in the assets directory that would still be uploaded, and flag anything that isn't meant to be public. Don't move or delete my site files.
Which Wrangler versions are affected?
Automatic configuration arrived in Wrangler 4.68.0 in February 2026, and Cloudflare fixed the missing ignore file in 4.156.0 on October 29, 2026. We ran the no-config setup on 4.68.0, 4.100.0, 4.130.0 and 4.155.0, and every one pointed the assets directory at the project root without writing an .assetsignore.
Does upgrading Wrangler fix it?
No. The fix changes what automatic configuration writes when it runs. A project it already configured keeps its wrangler.jsonc and still has no .assetsignore. We served one such project with Wrangler 4.160.0 and /.env still came back with a 200.
My .env is in .gitignore. Am I safe?
No. .gitignore controls what git commits. Wrangler decides what to upload from .assetsignore, which is a separate file. Automatic configuration even added .env* to .gitignore in our test, and the file was still served.
Where does .assetsignore go?
In the root of your assets directory. If your wrangler.jsonc says "directory": ".", that's your project root. It uses the same pattern syntax as .gitignore.
If .env was public, is deleting it from the deploy enough?
No. Assume every key in it was read. Rotate each secret at the provider first, then redeploy with an .assetsignore in place. Removing the file only stops future reads.
Find Out If /.env Answers
A CheckYourVibe scan requests your live site's .env, .git and .npmrc paths from the outside, the same way anyone sweeping for leaked keys does, and tells you which ones came back.