Abbi Labs

Breach breakdowns

Breakdown: a coding agent needed one token, read the whole .env file 10 times in three weeks, and sent it to its AI provider each time

By Abbi Labs · Published 1 December 2026

Did a key from your .env end up in your live site?

The Abbi Labs quick check opens your live, public site as a signed-out visitor and looks for secret-looking keys in its JavaScript (OpenAI, Anthropic, Stripe, Supabase service_role and others), exposed .env and .git files, and Supabase tables readable with your public key. It can't see your laptop, your agent's sessions or what your AI provider received, so do the local checks below yourself. No sign-up.

No app handy?

Example result · our deliberately broken demo app

6 issues found: 3 critical, 1 high, 1 medium, 1 low

  • Critical: Stripe live secret key in public JavaScript
  • Critical: /.env file readable by anyone
  • High: Git repository exposed (/.git/HEAD)

The demo's problems are planted on purpose. Paste your own URL above to see yours.

No sign-up. Read-only public-resource and protocol metadata checks. No model prompts or tool execution. Scan only sites you own or are allowed to test.

Run on every deploy or use from Cursor / Claude Code via MCP →

Weekly AI-app security checklist

One short email a week: a practical check for apps built with Supabase, Next.js and AI tools (RLS, leaked keys, headers and more). Unsubscribe anytime.

A QA engineer asked an AI coding agent to review merge requests. The project's instructions said the GitLab token it needed was in the .env file. So the agent read the .env file. All of it. That file also held production passwords for an internal admin tool, an API token for the company's HR system and a client secret for its BI service.

NordLayer, which sells the monitoring product that spotted it, says the agent did this in 10 sessions over three weeks, and that each time the full file went to a third-party AI service. In one session the file wasn't there, so the agent printed the machine's whole shell environment instead. Then it told the engineer: "I leaked secrets into this session's tool output… I'd rotate them."

No attacker, no zero-day, no malicious repo. Just the most common setup in vibe coding: secrets in a .env file, and an agent that can open it.

Everything below comes from NordLayer's report unless I say otherwise. Where something isn't public, I say so.

What happened

What's confirmed and what we don't know

Why this matters if you build with AI

Look at a typical vibe-coded project's .env. A Supabase service_role key that skips every RLS policy. A Stripe secret key. An OpenAI or Anthropic key with no spend cap. Often a production database URL. One file, everything that matters, in the folder your agent works in all day.

Three things make this worse than it sounds:

  1. "Read" means "sent". Whatever the agent reads goes into the conversation, and the conversation goes to the model provider. Many tools also keep a local transcript. If the agent printed your .env, treat every value in it as exposed, even if nothing was ever committed.
  2. It repeats. Once the agent learns "the token is in .env", it does it every session. NordLayer counted 10.
  3. Missing file, bigger leak. The fallback when .env wasn't there was the whole shell environment. If you export real keys in ~/.zshrc or ~/.bashrc, every project you open with an agent can see them.

It also connects to earlier breakdowns. In the Cursor incident, old agent traces with unredacted credentials leaked from a vendor and gave the attacker a way in. Backslash Security's 25 November 2026 research found 708 secrets in public repos holding AI coding-tool chat logs and says about 7 in 10 got there through the agent's own actions, like reading .env. A secret your agent read is a secret sitting in more places than you think.

How to check what your agent has already seen (10 minutes)

  1. Search your agent's local transcripts for keys. Claude Code keeps each session as a .jsonl file under ~/.claude/projects/, including tool results. A rough first pass for common prefixes (GitLab glpat-, GitHub, OpenAI/Anthropic sk-, Stripe, AWS, Supabase):
    grep -rlE 'glpat-|ghp_|github_pat_|sk-[A-Za-z0-9_-]{20,}|sk_live_|AKIA[0-9A-Z]{16}|service_role' ~/.claude/projects/ | head -20
    Other tools keep their own histories. Look for the folder your tool writes to and run the same grep.
  2. Search for the moment it read the file. If you see your .env contents, or a full env/printenv dump, in a transcript, every value in it has been sent to the model provider.
    grep -lE 'SUPABASE_SERVICE_ROLE_KEY|STRIPE_SECRET_KEY|DATABASE_URL' ~/.claude/projects/*/*.jsonl
  3. Check your shell profile. Real keys exported here are visible to every agent in every project:
    grep -nE 'export .*(KEY|TOKEN|SECRET|PASSWORD)' ~/.zshrc ~/.bashrc ~/.profile 2>/dev/null
  4. Look at what's actually in the project's .env. Anything production (live Stripe key, service_role, prod database URL) doesn't need to be on your laptop for most day-to-day work.

If you find a real key in a transcript: rotate it in the provider's dashboard first, then check its usage logs for the time since. Deleting the transcript doesn't un-send it. More on the rotate-first order in Supabase service_role key exposed.

The agent's session is one place a key leaks. Your live site is another.

An agent that reads every key in .env will also happily wire one into frontend code with a NEXT_PUBLIC_ or VITE_ prefix. Paste your URL and Abbi Labs checks what a signed-out visitor can see: secret-looking keys in your JavaScript, exposed .env and .git, open Supabase tables. Read-only, no sign-up.

Run a free scan

How to keep your agent out of your .env

  1. Never tell the agent "the token is in .env". That instruction is the whole incident. Let a CLI hold the token instead. For GitLab and GitHub, sign the CLI in once yourself and tell the agent to use it:
    glab auth login   # GitLab
    gh auth login     # GitHub
    Then in CLAUDE.md or your rules file: "Use glab/gh for GitLab/GitHub. Never open, print or grep .env files or the environment." A rule isn't a wall (NordLayer's point is that agents don't always follow them), so do the next steps too.
  2. Block the reads you can. In Claude Code, deny rules in .claude/settings.json stop its file tools and recognised commands like cat from opening env files. Add the env dumps too:
    {
      "permissions": {
        "deny": [
          "Read(.env)",
          "Read(.env.*)",
          "Bash(env)",
          "Bash(printenv)",
          "Bash(printenv *)"
        ]
      }
    }
    Anthropic's docs are clear about the limit: these rules don't cover a command that reads files without naming them (like grep -r from the folder) or a Python or Node script that opens the file itself. For an OS-level block, turn on Claude Code's sandbox. Other tools have their own ignore files. Treat all of them as a seatbelt.
  3. Split the file. NordLayer's own advice: keep task-specific tokens separate from production secrets. Your project .env should hold test keys (Stripe test mode, a dev Supabase project). Production keys live in your host's environment settings (Vercel, Netlify, Supabase secrets), not on your laptop.
  4. Nothing real in your shell profile. Move exported keys out of ~/.zshrc. If a tool needs one, pass it for that one command, or load it from a password manager when you need it.
  5. When an agent asks for "just a token", make it a small one. The Confluence case was a personal token that quietly reopened access the company had blocked. If you hand your agent a token, make it read-only, for one project, with an expiry date. GitLab, GitHub, Supabase and most AI providers let you scope tokens.
  6. Rotate what it already read. If any of the checks above found a real key, that key has been sent somewhere you don't control. Rotate it.

My take

The line that sticks is "I leaked secrets". The agent knew, eventually. By then it had done it in 10 sessions, because the instruction said the token was in that file and nobody was watching what it read. Most of us build exactly like that QA engineer: one .env, every key in it, an agent with the run of the folder. You won't out-prompt this. Keep the real keys somewhere the agent can't open, give it the one narrow token it needs, and assume anything it already read is gone.

Scan your live app free

Sources

Know someone shipping with AI tools? Send them this.

Related

Weekly AI-app security checklist

One short email a week: a practical check for apps built with Supabase, Next.js and AI tools (RLS, leaked keys, headers and more). Unsubscribe anytime.