CopybookSearch

Config

Claude Code settings that block .env and key reads

Claude Code opened in your home folder can read every key: .env, ~/.ssh and ~/.aws reads denied, bypass mode off, sandbox on.

Saves
133 on X, as of
Works in
Claude Code
Topics
Codebase

FreePro skills, $15 for 30 days

FreePro skills, $15 for 30 days

Posted
Views on X
7.6K
Star on GitHub
~/.claude/settings.json
{
  "permissions": {
    "deny": [
      "Read(**/.env)",
      "Read(**/.env.*)",
      "Read(~/.ssh/**)",
      "Read(~/.aws/**)"
    ],
    "blockReadsOutsideWorkingDirectories": true,
    "disableBypassPermissionsMode": "disable"
  },
  "sandbox": {
    "enabled": true
  }
}

Use it

Merge it into ~/.claude/settings.json, keeping your existing settings.

Vox on X

Open Claude Code in your home folder and it can read all of it: the API keys in your .env, the private keys in ~/.ssh, the cloud credentials in ~/.aws.

If you’ve ever clicked “always allow” on curl, or run it with --dangerously-skip-permissions, one hidden line in a web page or a README is enough for it to send all of that to someone else’s server. When a security firm reproduced the attack by planting a CLAUDE.md in Downloads, Claude Code followed it about half the time and pointed its API address at the attacker’s server.

Only start it inside a project folder, never in your home folder or Downloads. Then merge this into ~/.claude/settings.json, keeping your existing settings:

disableBypassPermissionsMode turns off --dangerously-skip-permissions. sandbox makes the commands and scripts it runs follow these rules too, enforced at the OS level, and any connection to a site you haven’t allowed gets stopped first. On Linux, install bubblewrap and socat first.

Then type /permissions in Claude Code, go through every rule you once set to “always allow,” and delete anything like Bash(curl *) that can send your files out.

In your agent

Add Copybook to your agent
Claude CodeClaude app
How to add Copybook