You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Claude displayed sensitive .env credentials (API keys, secrets) in output when it should have redacted them. #18223
I have searched existing issues and this hasn't been reported yet
This is a single bug report (please file separate reports for different bugs)
I am using the latest version of Claude Code
What's Wrong?
Description:
When asked to read or verify environment configuration, Claude Code displays full contents of .env files including sensitive API keys and secrets in its output, without any redaction.
Steps to reproduce:
Have a project with .env or .env.local containing API keys (e.g., STRIPE_SECRET_KEY, CLERK_SECRET_KEY)
Ask Claude to check environment configuration or restart a service
Claude runs commands like cat .env or grep on config files and displays full key values in response
Expected behavior:
Sensitive values should be redacted (e.g., sk_live_****)
Or Claude should use quiet checks (grep -q) without displaying values
Warning before displaying any .env content
Actual behavior:
Full credentials displayed in chat output
Keys saved to ~/.claude/projects//tool-results/.txt log files
No warning or redaction
Security impact:
Credentials exposed in terminal history
Credentials persisted in Claude's local cache files
Potential exposure if screen shared or logs accessed
Affected: Claude Code CLI (Opus 4.5)
What Should Happen?
Keys Should not be displayed or logged
Error Messages/Logs
Steps to Reproduce
Description:
Steps to reproduce:
eg.
Create a project with a .env file containing secrets:
STRIPE_SECRET_KEY=sk_live_abc123xyz
CLERK_SECRET_KEY=sk_live_def456
Start Claude Code in that directory:
claude
Ask Claude to check the environment:
"show me what's in .env"
or
"verify the stripe key is configured"
or
"restart the docker service and check env vars"
Observe: Claude runs cat .env or grep and displays full key values in output without redaction
Displays an immediate warning when credentials are detected
Logs detections (without actual secret values) for security review
Warns when accessing sensitive file paths (.env, credentials, etc.)
While this doesn't redact the actual output (which would require core changes), it provides defense-in-depth by alerting users immediately when sensitive data appears.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.
Activity
Bladed3d commentedon Jan 15, 2026
I have reported this 3 times! Fix it!
feat(plugins): Add secrets-scanner plugin for credential exposure det…
stevenelliottjr commentedon Feb 2, 2026
I've created a plugin that addresses this issue: PR #22594
The secrets-scanner plugin provides real-time detection of exposed secrets in Claude Code output:
While this doesn't redact the actual output (which would require core changes), it provides defense-in-depth by alerting users immediately when sensitive data appears.
Happy to iterate based on feedback!
github-actions commentedon Mar 3, 2026
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
github-actions commentedon Mar 12, 2026
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.