# CLAUDE_CODE_SUBPROCESS_ENV_SCRUB

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

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1

## Think of it like

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

## 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

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

## Example code

```bash
export CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1
claude
```

Keep API keys out of command environments.

## Why it matters

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

## Common mistake

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

## Three principles

- **Secrets removed.** From commands.
- **GitHub and proxy stay.** Kept on purpose.
- **One layer.** Plus permissions.

## Related terms

- [Prompt Injection](https://learn.benibix.com/term/ai/prompt-injection)
- [API Key](https://learn.benibix.com/term/development/api-key)
- [Bash Tool](https://learn.benibix.com/term/ai/bash-tool)

---

Source: https://learn.benibix.com/term/ai/claude-code-subprocess-env-scrub-variable
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
