Skip to main content
coreydaley.dev
Docs menu

Safety hooks

agent-config is a public repository built from a working, personal configuration, so it ships two layers of protection against leaking secrets or personal details. make hooks (part of make all) installs them; it needs gitleaks (brew install gitleaks).

The hooks

pre-commit, on what’s staged:

  • blocks credential and key file types outright (.pem, .key, .p12, .p8, SSH private keys, .env and so on), whatever their content;
  • blocks archive and database files over 1 MB;
  • runs gitleaks protect --staged;
  • runs scripts/check-personal-info.py --staged on the lines being added.

pre-push, on everything:

  • gitleaks detect over the full history;
  • the personal-info check over every tracked file.

Hooks can be skipped with --no-verify, so CI is the backstop: .github/workflows/scan.yml re-runs gitleaks (with --redact) over the full history and the personal-info check over all tracked files on every push and pull request. CI downloads a pinned gitleaks release and verifies its checksum before running it.

The personal-info check

scripts/check-personal-info.py complements gitleaks, which looks for secrets, by looking for things that are personal rather than secret. It has two layers.

Generic patterns, kept in the repo because they’re safe to publish:

  • home-network hostnames (*.local, *.lan, *.home.arpa)
  • private IPv4 addresses (10/8, 172.16/12, 192.168/16)
  • email addresses
  • phone numbers
  • absolute home-directory paths (/Users/<name>/, /home/<name>/); use ~ instead

A private denylist at ~/.config/agent-config/denylist (or $AGENT_CONFIG_DENYLIST): one case-insensitive regex per line for names, employers, addresses, amounts, codenames and anything else that only you know is sensitive. make hooks creates it empty with 0600 permissions. The list is personal itself, so it lives outside the repo, and matches are reported without echoing the offending line.

The denylist is protected against its own leak: any file named like *denylist*, any line carrying the marker make hooks writes at the top of the file, and any line that’s a verbatim copy of a denylist pattern are all blocked and can never be allowlisted. CI only has the generic patterns, since the denylist never leaves your machine.

Allowing known-safe matches

.personal-info-allow in the repo holds regexes for known-safe matches, one per line, such as noreply@anthropic.com in commit trailers or @example.com addresses. Keep it short and specific, because every entry is a hole in the check. A single line can also opt out with the marker personal-info: allow.

Keeping a config like this public

The repo’s CLAUDE.md spells out the rule the hooks enforce: never put secrets, personal details or machine-specific values (hostnames, usernames) in the public config. Read them from environment variables set in private dotfiles instead.

Running the check by hand:

python3 -I scripts/check-personal-info.py --staged   # added lines in the index
python3 -I scripts/check-personal-info.py --all      # every tracked file