Back to Feed
r/ClaudeAI
by quinncom
New
Is this Claude Code config safer?
2 points
2 comments
100% upvoted
View on Reddit
Content
Can someone with more expertise chime in here? I’d like to know if using a Claude code configuration file containing something like the following would help prevent Claude from running unsafe commands. I’m considering that it might help when running Claude Code in YOLO mode inside a Catnip.run container. Or just magical thinking?
```json
{
"sandbox": {
"enabled": true,
"autoAllowBashIfSandboxed": false,
"allowUnsandboxedCommands": false,
"excludedCommands": [],
"network": {
"allowLocalBinding": true
}
},
"permissions": {
"defaultMode": "acceptEdits",
"allow": [
"Edit",
"NotebookEdit",
"Bash(pwd:*)",
"Bash(ls:*)",
"Bash(echo:*)",
"Bash(printf:*)",
"Bash(rg:*)",
"Bash(grep:*)",
"Bash(egrep:*)",
"Bash(fgrep:*)",
"Bash(cat:*)",
"Bash(head:*)",
"Bash(tail:*)",
"Bash(wc:*)",
"Bash(sort:*)",
"Bash(uniq:*)",
"Bash(cut:*)",
"Bash(tr:*)",
"Bash(mkdir:*)",
"Bash(touch:*)",
"Bash(git status:*)",
"Bash(git diff:*)",
"Bash(git log:*)",
"Bash(git show:*)",
"Bash(git blame:*)",
"Bash(git grep:*)",
"Bash(git branch:*)",
"Bash(git rev-parse:*)",
"Bash(git remote -v:*)",
"Bash(git add:*)",
"Bash(git commit:*)",
"Bash(npm test:*)",
"Bash(npm run test:*)",
"Bash(npm run lint:*)",
"Bash(npm run build:*)",
"Bash(npm run typecheck:*)",
"Bash(pnpm test:*)",
"Bash(pnpm run test:*)",
"Bash(pnpm run lint:*)",
"Bash(pnpm run build:*)",
"Bash(yarn test:*)",
"Bash(yarn lint:*)",
"Bash(yarn build:*)",
"Bash(pytest:*)",
"Bash(python -m pytest:*)",
"Bash(ruff:*)",
"Bash(python -m ruff:*)",
"Bash(black:*)",
"Bash(go test:*)",
"Bash(go vet:*)",
"Bash(gofmt:*)",
"Bash(cargo test:*)",
"Bash(cargo fmt:*)",
"Bash(cargo clippy:*)",
"Bash(make test:*)",
"Bash(make lint:*)",
"Bash(make build:*)"
],
"ask": [
"WebFetch",
"WebSearch",
"Bash(command:*)",
"Bash(env:*)",
"Bash(find:*)",
"Bash(xargs:*)",
"Bash(awk:*)",
"Bash(sed:*)",
"Bash(rm:*)",
"Bash(\\rm:*)",
"Bash(command rm:*)",
"Bash(env rm:*)",
"Bash(/bin/rm:*)",
"Bash(/usr/bin/rm:*)",
"Bash(/usr/local/bin/rm:*)",
"Bash(rmdir:*)",
"Bash(/bin/rmdir:*)",
"Bash(/usr/bin/rmdir:*)",
"Bash(unlink:*)",
"Bash(/bin/unlink:*)",
"Bash(/usr/bin/unlink:*)",
"Bash(mv:*)",
"Bash(\\mv:*)",
"Bash(command mv:*)",
"Bash(env mv:*)",
"Bash(/bin/mv:*)",
"Bash(/usr/bin/mv:*)",
"Bash(cp:*)",
"Bash(\\cp:*)",
"Bash(command cp:*)",
"Bash(env cp:*)",
"Bash(/bin/cp:*)",
"Bash(/usr/bin/cp:*)",
"Bash(ln:*)",
"Bash(/bin/ln:*)",
"Bash(/usr/bin/ln:*)",
"Bash(tar:*)",
"Bash(unzip:*)",
"Bash(zip:*)",
"Bash(git fetch:*)",
"Bash(git pull:*)",
"Bash(git push:*)",
"Bash(git tag:*)",
"Bash(git rebase:*)",
"Bash(git reset:*)",
"Bash(git clean:*)",
"Bash(git checkout:*)",
"Bash(git switch:*)",
"Bash(git cherry-pick:*)",
"Bash(git merge:*)",
"Bash(/usr/bin/git fetch:*)",
"Bash(/usr/bin/git pull:*)",
"Bash(/usr/bin/git push:*)",
"Bash(/usr/bin/git reset:*)",
"Bash(/usr/bin/git clean:*)",
"Bash(npm install:*)",
"Bash(npm add:*)",
"Bash(npm i:*)",
"Bash(npm in:*)",
"Bash(npm ins:*)",
"Bash(npm inst:*)",
"Bash(npm insta:*)",
"Bash(npm instal:*)",
"Bash(npm isnt:*)",
"Bash(npm isnta:*)",
"Bash(npm isntal:*)",
"Bash(npm isntall:*)",
"Bash(npm uninstall:*)",
"Bash(npm remove:*)",
"Bash(npm rm:*)",
"Bash(npm r:*)",
"Bash(npm un:*)",
"Bash(npm unlink:*)",
"Bash(npm ci:*)",
"Bash(npm update:*)",
"Bash(npm audit:*)",
"Bash(npm exec:*)",
"Bash(npx:*)",
"Bash(pnpm install:*)",
"Bash(pnpm add:*)",
"Bash(pnpm remove:*)",
"Bash(pnpm unlink:*)",
"Bash(yarn install:*)",
"Bash(yarn add:*)",
"Bash(yarn remove:*)",
"Bash(pip install:*)",
"Bash(pip3 install:*)",
"Bash(python -m pip install:*)",
"Bash(brew install:*)",
"Bash(brew upgrade:*)",
"Bash(curl:*)",
"Bash(wget:*)",
"Bash(ssh:*)",
"Bash(scp:*)",
"Bash(rsync:*)",
"Bash(nc:*)",
"Bash(netcat:*)",
"Bash(socat:*)",
"Bash(/usr/bin/curl:*)",
"Bash(/usr/bin/wget:*)",
"Bash(/usr/bin/ssh:*)",
"Bash(/usr/bin/scp:*)",
"Bash(/usr/bin/rsync:*)",
"Bash(open:*)",
"Bash(kill:*)",
"Bash(killall:*)",
"Bash(pkill:*)"
],
"deny": [
"Bash(sh -c:*)",
"Bash(/bin/sh -c:*)",
"Bash(bash -c:*)",
"Bash(/bin/bash -c:*)",
"Bash(zsh -c:*)",
"Bash(/bin/zsh -c:*)",
"Bash(sudo:*)",
"Bash(\\sudo:*)",
"Bash(command sudo:*)",
"Bash(env sudo:*)",
"Bash(/usr/bin/sudo:*)",
"Bash(doas:*)",
"Bash(/usr/local/bin/doas:*)",
"Bash(/opt/homebrew/bin/doas:*)",
"Bash(chmod:*)",
"Bash(chown:*)",
"Bash(chgrp:*)",
"Bash(/bin/chmod:*)",
"Bash(/bin/chown:*)",
"Bash(/usr/bin/chmod:*)",
"Bash(/usr/sbin/chown:*)",
"Bash(diskutil:*)",
"Bash(/usr/sbin/diskutil:*)",
"Bash(mkfs:*)",
"Bash(/sbin/mkfs:*)",
"Bash(dd:*)",
"Bash(/bin/dd:*)",
"Bash(/usr/bin/dd:*)",
"Bash(mount:*)",
"Bash(umount:*)",
"Bash(/sbin/mount:*)",
"Bash(/sbin/umount:*)",
"Bash(launchctl:*)",
"Bash(/bin/launchctl:*)",
"Bash(/usr/bin/launchctl:*)",
"Bash(csrutil:*)",
"Bash(/usr/bin/csrutil:*)",
"Bash(osascript:*)",
"Bash(/usr/bin/osascript:*)",
"Bash(shutdown:*)",
"Bash(reboot:*)",
"Bash(/sbin/shutdown:*)",
"Bash(/sbin/reboot:*)",
"Read(./.env)",
"Read(./.env.*)",
"Edit(./.env)",
"Edit(./.env.*)",
"Read(./secrets/**)",
"Edit(./secrets/**)",
"Read(~/\.ssh/**)",
"Edit(~/\.ssh/**)",
"Read(~/\.gnupg/**)",
"Edit(~/\.gnupg/**)",
"Read(~/\.aws/**)",
"Edit(~/\.aws/**)",
"Read(~/\.kube/**)",
"Edit(~/\.kube/**)",
"Read(~/Library/Keychains/**)",
"Edit(~/Library/Keychains/**)",
"Read(**/*.pem)",
"Read(**/*.key)",
"Read(**/*.p12)",
"Read(**/*.pfx)",
"Edit(**/*.pem)",
"Edit(**/*.key)",
"Edit(**/*.p12)",
"Edit(**/*.pfx)"
]
}
}
```
Comments
No comments fetched yet
Comments are fetched when you run cortex fetch with comment fetching enabled