CLAUDE LABJP
SLACK — Claude Tag launches in beta on Slack: tag @Claude into channels to delegate tasks and connect tools, data, and codebasesSECURITY — Claude Code adds a sandbox.credentials setting to block sandboxed commands from reading credential files and secretsFIX — Remote MCP tool calls that once hung for five minutes now abort with an error instead of blockingMCP — Enterprise MCP connectors gain Okta provisioning, giving users zero-touch access on first loginMODEL — Claude Fable 5 offers a 1M-token context, always-on adaptive thinking, and 128K outputLINEUP — Opus 4.8, Sonnet 4.6, and Haiku 4.5 lead the lineup; pick the right one per taskSLACK — Claude Tag launches in beta on Slack: tag @Claude into channels to delegate tasks and connect tools, data, and codebasesSECURITY — Claude Code adds a sandbox.credentials setting to block sandboxed commands from reading credential files and secretsFIX — Remote MCP tool calls that once hung for five minutes now abort with an error instead of blockingMCP — Enterprise MCP connectors gain Okta provisioning, giving users zero-touch access on first loginMODEL — Claude Fable 5 offers a 1M-token context, always-on adaptive thinking, and 128K outputLINEUP — Opus 4.8, Sonnet 4.6, and Haiku 4.5 lead the lineup; pick the right one per task
Articles/Claude Code
Claude Code/2026-06-25Advanced

Your Sandbox Can Run the Code but Shouldn't Read Your Credentials — Shrinking the Secret-Read Surface with sandbox.credentials

Claude Code's sandbox can still read ~/.aws/credentials and token env vars by default. Using sandbox.credentials (v2.1.187+), here is how I tightened the secret-read surface of unattended runs at the OS level, with config and verification you can reuse.

claude-code121sandbox7security10credentialsautomation74secrets2

Premium Article

I run Claude Code unattended on a fixed daily schedule, letting it build and test code inside the sandbox. One day I was idly looking at the sandbox read scope in the /sandbox Config tab, and I stopped. Writes were scoped down to the working directory and a temp area, but reads were still open to the entire machine — and that scope included ~/.aws/credentials and ~/.ssh/. A child process of some npm test the agent piped in could, in principle, read those files.

I had naively assumed the sandbox was a mechanism for "running code safely," but the default read policy was far broader than I imagined. As an indie developer running the Dolice Labs sites unattended, that read scope sat closer to my secrets than I was comfortable with. This article shares the actual work of shrinking that read exposure at the OS-enforcement level using sandbox.credentials, added in v2.1.187. If you don't pin down exactly what it blocks and what it doesn't, you leave a hole while feeling reassured — so I'll center the piece on that boundary.

Why the default read policy is open to the whole machine

The sandbox's default behavior is asymmetric between writes and reads. Writes are scoped to the working directory and its subdirectories, plus the session temp directory that $TMPDIR points to. Reads, by contrast, are open to the "entire machine" except for a few denied directories.

There's a reason for the asymmetry. Builds and tests often can't run unless they can read outside the working directory — tool caches under your home directory, shared system libraries, global config files, and so on. Scoping reads down to only the working directory breaks most toolchains. So the default opens reads wide and closes only writes tightly.

The problem is that this "wide-open read" includes your credentials. The official docs say it plainly: the default read policy still allows reading ~/.aws/credentials and ~/.ssh/. In an unattended pipeline this matters in a quiet but real way. The commands an agent generates and runs aren't always the same, and the moment a command that reads a credential file slips through, the sandbox itself does nothing to stop it.

What sandbox.credentials blocks, and what it doesn't

sandbox.credentials declares the credential files and environment variables that sandboxed commands must not access. Its behavior splits into two channels.

One is files. Paths listed here are denied for reads inside the sandbox — the same read block that filesystem.denyRead applies. The other is envVars. Variables listed here are unset before each sandboxed command runs. The point is that you can write the credential-file read denial and the secret-environment-variable removal together in a single credentials block.

Conversely, you need to know precisely what it does not stop. The table below organizes the scope of sandbox.credentials.

TargetEffect of sandbox.credentials
Sandboxed Bash commands and their child processesfiles are read-denied; envVars are unset before each run
Built-in Read / Edit / Write file toolsOut of scope (governed by the permission system, not the sandbox)
Access via MCP serversOut of scope
Exfiltration over the networkOut of scope (controlled separately by domain allowlist and proxy)
Commands that run with the sandbox disabledOut of scope (they follow the regular permission flow)

So sandbox.credentials is a part that plugs only the "read path of sandboxed Bash." Having the built-in Read tool open a credential file, or having contents shipped out to a broad domain you allowed, must be defended at a different layer. Conflate these and you close one side while feeling safe. If you want to design secret handling end to end, reading Claude Code Secret Management and Trust Boundary Design, which covers how to partition trust boundaries, makes it clearer which layer sandbox.credentials belongs to.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Understand structurally why the sandbox's default read policy is open to the whole machine, credential files included
Reuse a Before/After sandbox.credentials config that separates files (denyRead) from envVars (unset)
Take away the in-sandbox commands that verify the policy and a minimal watchdog that guards against regression
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

Claude Code2026-04-25
Secret Management and Trust Boundaries for Claude Code — A Production Guide for the Agent Era
A field-tested approach to secrets in a Claude Code workflow: trust-boundary modeling, three injection patterns, leak-prevention hooks, and rotation runbooks — with working code for .env, MCP, and OS Keychain integrations.
Claude Code2026-06-18
Claude Code Adds /cd — Carrying Your Warm Cache Across Repositories
Claude Code's new /cd moves a running session to another working directory without rebuilding the prompt cache. Here are the design calls and pitfalls when you sweep across several repositories in one sitting.
Claude Code2026-06-18
Give an Unattended Agent Only the MCP Tools It Needs — Enforcing a Deny-by-Default Policy
An unattended Claude Code agent can't lean on a permission prompt, so whatever a tool can reach becomes the blast radius. Here's how to lock MCP servers and tools down to deny-by-default and hand back only what the job needs, with managed-settings.json examples.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →