# sandbox.credentials

> The key that hides or masks secrets from sandboxed commands.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** sandbox credentials setting, credential masking

## Think of it like

It is like giving a helper a fake key. The door man swaps in the real one when they reach the door.

## Definition

sandbox.credentials is a settings key that guards your secrets. It keeps secret files and environment variables from commands in the sandbox. Each entry names a file path or a variable name, with a mode. deny hides the secret. mask shows the command a stand-in, and the proxy puts the real value back on the way out. mask works only from user or managed settings.

## Example

Jack's tests need to call GitHub but should never see his token. He masks GITHUB_TOKEN, so the call works and the token stays hidden.

## Example code

```json
{
  "sandbox": {
    "credentials": {
      "files": [{ "path": "~/.aws/credentials", "mode": "deny" }],
      "envVars": [{ "name": "GITHUB_TOKEN", "mode": "deny" }]
    }
  }
}
```

Hide the AWS file and the GitHub token from commands.

## Why it matters

A command that can read a secret can also send it away.

## Common mistake

Setting mask in a project file. Claude Code only honors mask from user or managed settings.

## Three principles

- **Files and variables.** Named secrets.
- **deny or mask.** Hide or swap.
- **Mask from user file.** Or managed.

## Related terms

- [sandbox.filesystem.denyRead](https://learn.benibix.com/term/ai/sandbox-deny-read-setting)
- [sandbox.network.httpProxyPort](https://learn.benibix.com/term/ai/sandbox-http-proxy-port-setting)
- [Environment Variable](https://learn.benibix.com/term/infrastructure/environment-variable)

## Told apart from

- [denyRead vs sandbox.credentials](https://learn.benibix.com/compare/sandbox-deny-read-setting-vs-sandbox-credentials-setting): People think both keys just hide a secret file. denyRead blocks a path, so a command cannot read it at all. sandbox.credentials can do that too. It can also mask a secret: the command sees a stand-in, and the proxy puts the real value back on the way out. Mask is for a secret a command must use but should not see.

---

Source: https://learn.benibix.com/term/ai/sandbox-credentials-setting
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.
