R50 Scan the staged changes for credentials in the commit hooks
Have a repository’s commit hooks scan the staged changes for credentials at every commit.
Reason
A credential that reaches a commit spreads with every push and clone, and taking it out of the history afterwards does not take it back (Art. II §1). A scan of the staged changes catches it before the commit exists; a scan of the history finds it only after.
Verification
The repository’s commit hook configuration runs a credential scanner on the staged changes each time a commit is made. A scan that runs only on the history, at push time or in CI does not take its place, though a repository may run such scans as well. When the scanner reports a hit, the value stays out of the report (rule 291). What is judged is the repository’s configuration; installing the hooks in a checkout is left to the project’s instructions.
Violated when a repository has no commit hook that scans the staged changes for credentials.