Skip to content
BENIBIX Learn

sandbox.credentials

AI⌨️ Claude CodeConfiguration

Also known as sandbox credentials setting, credential masking

The key that hides or masks secrets from sandboxed commands.

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.

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.

Why it matters

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

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

Common mistake

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

Key takeaways

  1. 1
    Files and variables. Named secrets.
  2. 2
    deny or mask. Hide or swap.
  3. 3
    Mask from user file. Or managed.

Compare