1
2
3
4
5
6
7
8
9
10
#!/usr/bin/env bash
# Block commands that reference .envrc — it loads secrets (sops/direnv).
# Matches any mention, since even `wc -l .envrc` leaks information.

command=$(jq -r '.tool_input.command // ""')

if [[ "$command" == *".envrc"* ]]; then
  echo ".envrc contains secrets. Ask the user how env/secrets load instead of reading it." >&2
  exit 2
fi