Skip to main content

SandboxCredentials

Struct SandboxCredentials 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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 path and a mode of "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 mask entries from project .claude/settings.json and 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 name and a mode of "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 mask entries from project .claude/settings.json and 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 allows mask substitution on plain HTTP requests as well as TLS-terminated HTTPS
    • false: Claude Code allows mask substitution 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 optionally sessionTokenVar, naming sandbox.credentials.envVars entries
  • 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, and sigv4a, 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: Extra

Keys Claude Code accepts here that this crate doesn’t model (newer or undocumented ones), kept as written so the document round-trips.

Trait Implementations§

Source§

impl Clone for SandboxCredentials

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SandboxCredentials

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SandboxCredentials

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for SandboxCredentials

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for SandboxCredentials

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for SandboxCredentials

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for SandboxCredentials

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.