Skip to content
BENIBIX Learn

CLAUDE_CODE_SUBPROCESS_ENV_SCRUB

AI⌨️ Claude CodeConfiguration

Also known as CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1

Set to 1, it hides your secrets from the commands Claude Code runs.

Think of it like

It is like you take things out of your pockets. Then you lend your coat.

Example

Jack's shell holds a cloud key. A web page could trick Claude into printing it. With this set, the commands never see it.

Why it matters

If a command cannot see a key, a tricked command cannot leak it.

Definition

CLAUDE_CODE_SUBPROCESS_ENV_SCRUB set to 1 hides secrets from Bash commands, hooks and local MCP servers. It spots a secret by its name or by the look of its value. GitHub tokens and proxy settings stay. It cuts what a prompt injection could read. But it is one layer, not the whole fix.

Example code

bash
export CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1
claude
Keep API keys out of command environments.

Common mistake

Using it as the only guard. Narrow permission rules still matter.

Key takeaways

  1. 1
    Secrets removed. From commands.
  2. 2
    GitHub and proxy stay. Kept on purpose.
  3. 3
    One layer. Plus permissions.