Skip to main content

Pre-commit hook: penthera hook

Pro. For “how do I put it in CI?”

Block it before it’s committed

Once a secret is pushed, rotating it is the only fix. The pre-commit hook runs the checks that matter on what you are about to commit, and nothing else:
On staged content only (the git index, not your working tree):
  • secrets and AI provider keys in staged files;
  • penthera agents rules on staged .mcp.json, CLAUDE.md, AGENTS.md, .cursor/, .claude/ and skills/;
  • when package-lock.json is staged, the capability diff against HEAD’s lockfile and the license policy, for the packages this commit adds.
It blocks on high and critical by default and takes about 0.1 to 0.5 s. Configure it in penthera.policy.json:
A staged file larger than 16 MB is not read, and it blocks the commit with a warning that names it, since it could hold a secret nobody checked. Add it to ignore, or set "largeFiles": "warn" in the hook section to only warn. If husky or lefthook manage your hooks (core.hooksPath is set), penthera hook install says so instead of overwriting them. Add one line to that tool instead:
Back to the README · All commands