Stop Claude Code from overwriting your .env with a PreToolUse write guard
Permission deny rules can stop Claude Code from reading .env and key files. That still leaves a hole: a Write or Edit call can create or overwrite those paths. A small PreToolUse hook closes it. The hook Save this as .claude/hooks/block-secret-writes.sh and make it executable ( chmod +x ): #!/usr/b…
Read the full story at DEV Community — AI ↗
Timeline · 1 report
- 2026-11-16 00:55 · DEV Community — AI
Stop Claude Code from overwriting your .env with a PreToolUse write guard