Security: Tokens pasted into web/mobile sessions are exposed in the LLM context window

Status Fixed / completed
Maintainer reply None cached
Activity 4 comments · opened Mar 24, 2026 · closed Mar 24, 2026

Problem

When using Claude Code on web or mobile (not the local CLI), there is no way to provide API tokens (e.g., GITHUB_TOKEN) without pasting them directly into the chat. This means secrets land in the LLM context window — visible in conversation history, potentially included in training data, and exposed to anyone with account access.

The local CLI solves this correctly: tokens live in environment variables or OS keychains (e.g., Docker MCP reads credentials from the OS keychain, never touching the chat). Web/mobile sessions have no equivalent mechanism.

Proposed solution

A secrets/environment injection mechanism for web and mobile sessions:

  1. Users configure secrets in their Anthropic account settings (or a project-level config).
  2. At session start, these are injected as environment variables into the container — the same way ANTHROPIC_API_KEY is already provided.
  3. Secrets never appear in the LLM context window, conversation history, or logs.

This mirrors how CI systems (GitHub Actions secrets, AWS Parameter Store) handle credentials: configured out-of-band, injected at runtime.

Why this matters

  • Current workaround is insecure by design. Users who need GitHub/AWS/etc. access on mobile must paste tokens into chat. No amount of short-TTL scoping fully mitigates context-window exposure.
  • The local CLI already has the right pattern. Docker MCP uses OS keychain credentials. GITHUB_TOKEN is read from the environment. The web/mobile experience should match.
  • Adoption blocker for teams. Security-conscious teams won't use Claude Code on mobile/web for real work if it requires pasting secrets.

Alternatives considered

  • Short-TTL, minimal-scope tokens: Reduces blast radius but doesn't solve the exposure problem. We do this as mitigation, not a fix.
  • OAuth device flow in-session: Still surfaces the token in the context window after the flow completes.

View original on GitHub ↗

4 Comments

haalfi · 6 months ago

This issue replaces original Feature request #29885.
Thanks for considering it!

github-actions[bot] · 6 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/32733
  2. https://github.com/anthropics/claude-code/issues/29910
  3. https://github.com/anthropics/claude-code/issues/23088

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

haalfi · 6 months ago

Still open issues cover this issue here: #32733 and #29910.

github-actions[bot] · 6 months ago

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.