R50 Scan the staged changes for credentials in the commit hooks

On by default

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.

Provisions of the constitution it cites

Relations

Parent
R265 Credentials
Requires
none
Conflicts with
none

Metadata

ID
50
Revision
9
Kind
rule
Status
active
Slug
commit-hook-credential-scan
Default level
project
Constitution revisions
>=1
Check
builtin
Default
on
Uses
Instructions instructions
Original language
English en
Translations
Chinese zh