claude-code - 💡(How to fix) Fix Security: IDE extension silently captures selected text, including secrets from .env files

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

The Claude Code VS Code extension automatically includes any selected editor text as context in every message sent to the API — with no warning, confirmation, or filtering.

Error Message

  • Warn before sending content from files matching sensitive patterns (.env, *.key, *secret*, *config*, etc.)

Root Cause

The Claude Code VS Code extension automatically includes any selected editor text as context in every message sent to the API — with no warning, confirmation, or filtering.

Fix Action

Workaround

Deselect all text before sending any message when working in or near credentials files.

RAW_BUFFERClick to expand / collapse

Summary

The Claude Code VS Code extension automatically includes any selected editor text as context in every message sent to the API — with no warning, confirmation, or filtering.

Steps to Reproduce

  1. Open a .env file in VS Code with the Claude Code extension active
  2. Highlight any line containing a secret (API key, password, token)
  3. Click into the Claude Code chat panel and send any message
  4. The selected text is transmitted to Anthropic's API as context

Expected Behaviour

Either: the extension does not capture selected text from sensitive files, OR the user is warned before transmission and can cancel.

Actual Behaviour

The value is silently sent with no indication it was included.

Impact

Developers routinely select text to inspect values visually. This workflow silently leaks secrets to a third-party API. The exposure is non-obvious and leaves no local trace.

A real example: a line from a .env file appeared in Claude's context unprompted — it had been selected in the editor while the user typed an unrelated message in the chat panel.

Suggested Fixes

  • Warn before sending content from files matching sensitive patterns (.env, *.key, *secret*, *config*, etc.)
  • Allow users to configure a file-pattern blocklist for selected-text capture
  • Make selected-text capture opt-in rather than opt-out
  • Add a UI indicator when a selection is actively being captured as context

Workaround

Deselect all text before sending any message when working in or near credentials files.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Security: IDE extension silently captures selected text, including secrets from .env files