[MODEL] sonnet 5 agent echoed sensitive .env.local values into chat output unprompted while debugging a typo

Open 💬 0 comments Opened Jul 8, 2026 by adee98

Preflight Checklist

  • [x] I have searched existing issues for similar behavior reports
  • [x] This report does NOT contain sensitive information (API keys, passwords, etc.)

Type of Behavior Issue

Other unexpected behavior

What You Asked Claude to Do

I was debugging why a "bank details not configured" warning banner
wasn't clearing after I added BANK_HOLDER, BANK_NAME,
and BANK_RIB to my local .env.local file. I asked Claude to
help figure out why the app still thought the values were missing.

What Claude Actually Did

  1. Claude ran grep -n "*****_BANK" .env.local to check the file,

and the tool output — including the full, unredacted values of my
bank account holder name and bank name — was printed directly into
the visible chat transcript.

  1. Claude then used its Read tool to view a range of .env.local to

diagnose a duplicate-line bug, and that tool output printed the
full RIB (bank account number) value into the chat as well, along
with other unrelated secrets present in the same file range
(an API token and an internal shared secret).

  1. When fixing a variable-naming typo, Claude referenced/quoted the

RIB value again in its edit explanation instead of describing the
fix by line number only.

At no point did Claude need to display the actual secret values to
diagnose or fix the problem — the bug was a variable-name mismatch
(duplicate key on one line, missing prefix on another), which is
fully describable by line number and key name alone.

Expected Behavior

Claude should never echo the contents of files that plausibly hold
secrets (.env, .env.local, credentials files, etc.) into visible
chat output/tool-result summaries unless the user explicitly asks to
see a specific value. When diagnosing issues in such files (duplicate
keys, typos, missing variables), Claude should reference line numbers
and variable/key names only, and mask or omit values — e.g. "line 79
duplicates the key from line 78" rather than printing the matched
line's contents. This should apply to grep/read output surfaced in
chat, not just to values Claude generates itself.

Files Affected

Permission Mode

Accept Edits was ON (auto-accepting changes)

Can You Reproduce This?

Yes, every time with the same prompt

Steps to Reproduce

_No response_

Claude Model

Sonnet

Relevant Conversation

That's the bug — line 79 overwrote line 78. You have two ******_BANK_HOLDER lines and no *****_BANK_NAME or ******_BANK_RIB at all. Looks like "BANK OF AFRICA" (the bank name) got typed into the HOLDER variable name instead of NAME, and RIB never made it in.That's the bug — line 79 overwrote line 78. You have two ******_BANK_HOLDER lines and no *****_BANK_NAME or *****_BANK_RIB at all. Looks like "BANK OF ****" (the bank name) got typed into the HOLDER variable name instead of NAME, and RIB never made it in.

Impact

High - Significant unwanted changes

Claude Code Version

2.1.201 (Claude Code)

Platform

Anthropic API

Additional Context

_No response_

View original on GitHub ↗