#[non_exhaustive]pub struct SandboxCredentials {
pub files: Option<Vec<CredentialFile>>,
pub env_vars: Option<Vec<CredentialEnvVar>>,
pub allow_plaintext_inject: Option<bool>,
pub aws_pairs: Option<Vec<AwsPair>>,
pub sigv4: Option<Sigv4>,
pub extra: Extra,
}Expand description
sandbox.credentials.
Declare the credential files and environment variables to protect from sandboxed
commands. Each entry names
a file path or a variable name and a mode: deny hides the credential inside the
sandbox, and mask shows sandboxed commands a placeholder while the sandbox
proxy substitutes the real
value on outbound requests.
Docs: sandbox.credentials.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.files: Option<Vec<CredentialFile>>Protect credential files or directories from sandboxed commands. With "mode": "deny",
Claude Code blocks reads of the path inside the sandbox, the same read block as
sandbox.filesystem.denyRead.
With "mode": "mask", sandboxed commands on Linux and WSL2 read a sentinel copy of the
file, and the sandbox proxy substitutes the real value on outbound requests to that
entry’s injectHosts; on macOS the file is unreadable inside the sandbox instead.
- Values: array of objects, each with
pathand amodeof"deny"or"mask", plus the optional mask fields for files - Default: unset, so no credential files are protected
- Scope: any settings file. Claude Code drops
maskentries from project.claude/settings.jsonand local.claude/settings.local.json.
Docs: files.
env_vars: Option<Vec<CredentialEnvVar>>Protect environment variables from sandboxed commands. With "mode": "deny", Claude
Code removes the variable from the environment of sandboxed commands. With "mode": "mask", sandboxed commands see a per-session sentinel value, and the sandbox proxy
substitutes the real value on outbound requests to that entry’s injectHosts, so tools
such as gh and npm keep authenticating without ever holding the real credential.
- Values: array of objects, each with
nameand amodeof"deny"or"mask", plus the optional mask fields for environment variables - Default: unset, so no environment variables are protected
- Scope: any settings file. Claude Code drops
maskentries from project.claude/settings.jsonand local.claude/settings.local.json.
Docs: envVars.
allow_plaintext_inject: Option<bool>Allow mask substitution on plain HTTP requests as well as TLS-terminated HTTPS. On
plain HTTP the upstream identity is unverified and the credential travels in cleartext,
so leave this off outside trusted test networks.
- Values: Boolean
true: Claude Code allowsmasksubstitution on plain HTTP requests as well as TLS-terminated HTTPSfalse: Claude Code allowsmasksubstitution only on TLS-terminated HTTPS
- Default:
false - Scope: user or managed.
Docs: allowPlaintextInject.
aws_pairs: Option<Vec<AwsPair>>Group masked environment variables that form one AWS credential for SigV4
re-signing when your
credential lives in variables with non-standard names. Claude Code links the
conventional AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN trio
automatically when you mask their whole values, so you need this key only for other
names. Requires Claude Code v2.1.224 or later.
- Values: array of objects, each with
accessKeyIdVar,secretAccessKeyVar, and optionallysessionTokenVar, namingsandbox.credentials.envVarsentries - Default: unset, so only the conventional trio is paired
- Scope: user or managed.
Docs: awsPairs.
sigv4: Option<Sigv4>Choose what the sandbox proxy does with AWS request forms it can’t
re-sign: streaming
for aws-chunked streaming uploads, presigned for presigned URLs, and sigv4a for
SigV4A asymmetric signatures. This applies only to requests signed with a masked pair’s
placeholder access key ID. Requires Claude Code v2.1.224 or later.
- Values: object with
streaming,presigned, andsigv4a, each one of:"deny": the proxy fails the request"passthrough": the proxy forwards the request signed with the masked placeholder, so the tool receives AWS’s own rejection
- Default: unset, so every form is
"deny" - Scope: user or managed.
Docs: sigv4.
extra: ExtraKeys Claude Code accepts here that this crate doesn’t model (newer or undocumented ones), kept as written so the document round-trips.