Skip to content

security

  • NEVER stage .env, .pem, .key, credentials.*, secrets.yml, SSH keys, or service account files
  • ALWAYS use .env.example or .env.template for documenting required variables (without values)
  • ALWAYS check git status before committing to verify no sensitive files are staged
  • NEVER hardcode API keys, tokens, passwords, or connection strings in source code
  • Use environment variables or config files (gitignored) for all secrets

Two core hooks registered in .claude/settings.json: privacy-guard.cjs (PreToolUse: Read/Glob/Grep) blocks reading sensitive files pending user approval; secret-guard.cjs (PreToolUse: Bash) hard-blocks staging/committing/pushing them. Both fail-closed on a detected threat (exit 2) and fail-open on an internal hook exception (exit 0 — a buggy guard never blocks legitimate work).

Ask which env vars are needed → create .env.example with placeholder values → have the user create .env locally with the real values → ensure .env is in .gitignore.