Catch leaked secrets before commit
clavis scan --staged checks the files you are about to commit for Clavis tokens. With --values it also matches the values of your own secrets, which needs permission to read them. It exits with code 7 when it finds something, which stops the commit.
With the pre-commit framework
# .pre-commit-config.yaml
repos:
- repo: https://github.com/dumhouse/clavis
rev: v0.3.3
hooks:
- id: clavis-scanpre-commit installUse a release tag for rev. The hook needs the clavis CLI on your PATH (install it). To match secret values too, override the entry: args: [] and entry: clavis scan --staged --values in your own config.
Without it
clavis scan --install-hookThis writes .git/hooks/pre-commit, which runs the same check. It won't overwrite a hook you already have.
In CI
Run clavis scan (without --staged) in a pipeline step to check the whole tree; the exit code is the same.
In CI
A hook can be skipped (git commit --no-verify), so run the same scan in CI too. Copy integrations/github/clavis-scan.yml to .github/workflows/clavis-scan.yml. It installs the CLI and runs clavis scan --values=false, which checks token formats without signing in to your server, and fails the pull request when it exits with code 7.