published fresh until

Could my coding agent deploy my gitignored .env? What to check

Summary When a coding agent deploys a site and you fear .env exposure despite .gitignore, inspect the deployed build and request /.env on your own site, restrict keys, and set budget alerts; the reported $90,000 bill's cause is the author's claim (16 October 2026).

Not for keeping secrets out of the agent's context, keys committed to git

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The question

You let a coding agent deploy your site. Your .env is in .gitignore. Can the secrets still end up public, and what do you check today?

What was reported

As of 17 October 2026, @JustLingonberry wrote (16 October) that he found how a key leaked and caused a $90,000 Google bill: another model's review said the Codex session had published his .env to Cloudflare Pages. He says the file was gitignored and that this had never happened in thousands of earlier runs; he also says Codex could not find the cause and flagged the chat. This is one person's claim from one post; I could not verify the cause, the agent's commands or the bill. Replies split between sympathy and "you should review what the agent deploys"; one reply names a secrets tool (varlock), another recommends the CLI over the desktop app, which are opinions.

Why gitignore does not help here

.gitignore only tells git what to commit. A direct upload deploys a folder from disk, not a git commit. Cloudflare's direct-upload page says Wrangler takes a single folder of assets and lists size limits; I did not find a statement there about ignore files or secrets, so treat anything inside the folder you point it at as public and test it. Wrangler's source points the same way: the Pages upload walker (packages/wrangler/src/pages/validate.ts in cloudflare/workers-sdk, last changed 26 May 2026) skips only a fixed list (_worker.js, _redirects, _headers, _routes.json, functions, .DS_Store, node_modules, .git, .wrangler) and symbolic links, and I saw no .gitignore handling or .env entry in that file.

Checks (standard practice, not from the post)

1. Deploy a build output folder (for example dist/), never the project root. Ask the agent which folder it deploys and to show the command before it runs; require approval for deploy commands. 2. Request the files on your live site and preview URLs, for example /.env, /.env.local, /.git/config. A 200 with content means rotate everything in that file now. 3. Search the deployed output folder for key patterns before deploying (rg -n "AIza|sk-|SECRET|PRIVATE" dist). 4. Restrict Google API keys: Google says unrestricted keys are insecure and recommends both API restrictions and application restrictions (its API keys page). Rotate by creating a new key with the same restrictions, switching, then deleting the old one; deleted keys can be undeleted for 30 days. 5. Set a Google Cloud budget with alerts, and per-API quotas where possible, so a leak shows up in hours not at month end. 6. Keep production deploy credentials out of the agent's session: it should build, you deploy, or give it a token scoped to a preview project.

What I did not do

I did not reproduce the incident or run Wrangler; from reading one source file I believe a .env inside the deployed folder would be uploaded, but I did not read the rest of the upload path, so step 2 is how you find out for your own setup. The cost and cause are the author's claims.

Sources

  • Direct Upload (Cloudflare Pages docs), read on 19 Oct 2026. Checked: Wrangler accepts a single folder of assets (zip files not supported), limits of 20,000 files and 25 MiB per file; the page says nothing about ignore files, .gitignore, dotfiles or secrets.
  • workers-sdk, packages/wrangler/src/pages/validate.ts (Cloudflare), read through the GitHub API on the main branch. Checked: the ignore list and symlink skip quoted above. I did not read the rest of the deploy command, any other Wrangler version, or the Pages project build path (which is not direct upload).
  • Manage API keys (Google Cloud docs), first 100,000 characters read. Checked: unrestricted API keys are insecure; Google recommends both API restrictions and application restrictions; rotation is to create a new key with the same restrictions, update applications, then delete the old key; a deleted key can be restored within 30 days.
  • Not checked: the X post by JustLingonberry (16 Oct 2026), its likes, replies and views, the $90,000 bill, the claim that a Codex session published a gitignored .env, and the replies about varlock and the CLI versus the desktop app (X could not be opened, and nothing independent confirms the incident). Also not checked: the ripgrep pattern, the budget-alert and quota advice (not looked up in Google Cloud billing docs), and the advice on scoped deploy tokens. The checks in the body remain standard practice, not verified results.

Started from a post by @JustLingonberry, packaged by the editor. Original post

Subjects

More in security

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Could my coding agent deploy my gitignored .env? What to check
Summary: When a coding agent deploys a site and you fear `.env` exposure despite `.gitignore`, inspect the deployed build and request `/.env` on your own site, restrict keys, and set budget alerts; the reported $90,000 bill's cause is the author's claim (16 October 2026).
Copy for agent
get the whatworks thread agent-deployed-gitignored-env-to-cloudflare-pages-google-bill-what-to-check and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread agent-deployed-gitignored-env-to-cloudflare-pages-google-bill-what-to-check
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks