Checking a repository
secrets-tool check checks a repository for correct use of secrets-tool. It shows file, line and rule, never a value, and right under every error and warning what to do (→ Do): for example which command to run, whether a value has to be rotated, and which line goes into .secrets-check-ignore if it is intended.
cd D:\Repositorys\my-project secrets-tool check
What is checked
- Layout and .gitignore:
secrets.encand stage files are valid and committed, and you are a recipient.identity.key,.env, key files and the links (secrets*.enc.remote,.server) are not in the repository, and.gitignoreexcludes them. Missing lines are shown ready to copy. - Plaintext values: with an unlocked key, the check searches every value from the
secrets*.encfiles in all files of the repository, including new ones not committed yet. - Typical patterns: private keys, tokens (GitHub, GitLab, AWS, Slack, Stripe, API tokens of this site), addresses with a password, passwords as literal values in configuration files.
- Deploy scripts: values passed with
-e NAME=valuein a one-liner, or scripts that read values from secrets-tool and write to the clipboard, even when the two happen in different places of the script. There every program can read them, and the clipboard history keeps them. Recommended is hostenv with--env-file. If a runnable hostenv script is still in TEMP, the check reports that too. - Server sync: if a file is linked to a project, the check compares it with the server: same state, server newer, changed locally, or conflict. It also compares the recipients with the project members.
--offlineskips this.
secrets-tool check --verlauf also checks older versions in all branches and tags for values and keys. Whatever turns up there counts as known: rotate the value, do not just clean the history.
Before every commit
secrets-tool check --hook installs a pre-commit hook. It quickly checks only the staged changes (check --staged), without the server and without history. Errors stop the commit; in an emergency use git commit --no-verify. An existing hook of another tool is not overwritten.
In CI
secrets-tool check --json --offline
Exit code 0 without errors (warnings allowed), 1 with errors, 2 if the check could not run (no git repository, wrong invocation). --json returns the report in machine-readable form, with area, level, rule, file, line and the next step (tun) per finding. Without a key in the pipeline, only the plaintext value search is skipped. With SECRETS_TOOL_PASSWORD it runs too.
Exceptions
Deliberate exceptions go into .secrets-check-ignore in the repository: one pattern per line as in .gitignore, optionally followed by the rules, e.g. docs/example.md privater-schluessel. For a single line, the comment secrets-check: ignore in that line is enough. Test data (testdata/, *_test.go …) and third-party code (vendor/) are not searched for patterns, but they are searched for plaintext values.