Curated, pinned pre-commit security hooks that you copy into your repo and own.
It's for teams that want secrets, Terraform and Dockerfiles checked on every commit without building the setup themselves. You copy a few plain files from here, and your repo never depends on this one again.
Every repo gets the base stack. Add terraform or docker if the repo has them. Recommended tools are the default; optional ones add more checks.
| Tool | Stack | Catches | On a finding |
|---|---|---|---|
| gitleaks | base, recommended | Hardcoded secrets | Blocks |
| pre-commit-hooks | base, recommended | Private keys, leftover merge conflict markers | Blocks |
| checkov | terraform and docker, recommended | Terraform and Dockerfile misconfigurations | Warns |
| tflint | terraform, optional | Terraform mistakes and deprecated syntax | Warns |
| hadolint | docker, optional | Dockerfile best practices, shell mistakes in RUN |
Warns |
The stacks live in catalog/stacks.yaml.
docs/setup.md walks through each step, with commands for bash and PowerShell.
- Install pre-commit (it needs Python 3.11 or later), for
example with
uv tool install pre-commitorpipx install pre-commit. - Clone this repo next to yours:
git clone https://github.com/kston83/hookshelf. - In your repo, create
.pre-commit-config.yaml: arepos:line, then each tool'scatalog/<tool>/snippet.yaml, with a blank line between snippets. - Copy each tool's config file to your repo root:
.gitleaks.toml, plus.checkov.yamlor.hadolint.yamlif you use those tools. - Run
pre-commit install,git addthe new files, thenpre-commit run --all-files. The first run installs each tool. Commit when it's done.
- You own plain files. After setup your repo has
.pre-commit-config.yamland a config file per tool. If this repo disappeared, yours would keep working. - Hooks come from the providers. Every hook comes from the tool provider's own repo at
a pinned version. tflint ships no pre-commit hook, so its snippet is a short
repo: localhook that has pre-commit build the pinned tflint release. - Secrets block, everything else warns. gitleaks and pre-commit-hooks stop the commit. checkov, tflint and hadolint print findings but let the commit through, until you switch each one to block.
- Free and open source. No accounts or API keys.
Each tool's README gives a range measured on GitHub's runners and an older Windows laptop. To measure a DevOps laptop or a Jenkins agent, install uv and run:
git clone https://github.com/kston83/hookshelf
cd hookshelf
uv run scripts/measure_install.pyIt installs each tool into its own temporary pre-commit cache, deletes the cache
afterwards, and prints a table to paste back. The table also shows whether the machine can
reach GitHub, PyPI and the Go proxy. Add --without-go to see what a machine without Go
gets.
docs/design.md sets the goal, principles and non-goals. This repo uses uv and Python 3.14 (uv installs it for you):
uv sync
uv run pytestThe fixture tests run real pre-commit. The gitleaks rule tests also need a gitleaks
binary on PATH; without one they skip locally, while CI installs the pinned version.
Apache-2.0