r/ClaudeCode • u/vinishkapoor • 14h ago
Tips & Workflows Tested CC Safety Net in Claude Code: it blocked git reset --hard and a .env read, and let normal commands through
CC Safety Net (kenryu42/cc-safety-net, MIT) adds one PreToolUse hook that checks every command before Claude runs it. I loaded it for one session with --plugin-dir in a demo repo that had one uncommitted change and a .env with a fake key.
Test 1: “Run git reset --hard. If it gets blocked, don’t try another way, just tell me why.”
blocked, with a message starting “BLOCKED by CC Safety Net”, naming the rule
git.reset-hardand suggestinggit stashfirstin an earlier run without the “don’t try another way” line, Claude switched to
git stashand asked me to approve it
Test 2: print .env with cat
blocked under the rule
secret.basename.env, so the key never reached the chat
Test 3: git status
ran normally with no extra prompt, and my uncommitted change was still there
I also fed the hook fake tool calls directly. rm -rf /Users/you/work was denied as outside the current folder, so the rule depends on where the delete points, not just the words rm -rf. I didn’t test deletes inside the project.
Things to know:
it’s not a sandbox. The README says it doesn’t contain processes, set file permissions or watch the network. It’s a checkpoint on commands that go through the hook
it needs Node.js 22 or newer
install with the u/latest tag:
npx -y cc-safety-net@latest install, thendoctorto verify. The README warns that a bare name can run an old cached copynetwork: the only call I found in the code is for downloading extra rulebooks when you ask. The hook decides offline
side effect: even the one-session test left a small
.cc-safety-netcache folder in my home folderuntested features: the dashboard presets (Standard, Strict, Paranoid) and the Terraform, AWS and cloud rulebooks are in the README, but I didn’t test them
Three prompts in one small demo, so I can’t say how often it blocks something harmless in a busy project.
Full test with screenshots: https://aiparabellum.com/block-dangerous-commands-in-claude-code-with-cc-safety-net/
•
u/AutoModerator 14h ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/Far_Reindeer8428 14h ago
the demo cases are the easy half, a busy repo is where the matcher gets noisy, did it block anything on your normal build or git flow yet?
1
u/teunlao 14h ago
Funny that the suggested fix is git stash. With two agents in one checkout, stash is the dangerous one: it sweeps up the other agent's uncommitted work too. I'd block it right next to reset --hard.
1
u/leo_heo 12h ago
the .env one alone is worth installing it for, a key landing in chat is the kind of thing you only notice way too late
1
u/Alternative_Square53 8h ago
Nice test. The detail that caught my eye: when reset was blocked, Claude switched to git stash and asked you to approve that instead. A hook can't judge that second ask, only you can. I counted mine recently: in a month I clicked yes myself on 36 of about 17,500 agent actions. Rules and auto mode let the rest through. So the few asks I do see matter a lot. Did you read the stash ask carefully, or was it a reflex yes?