Secrets Detection Pre-Commit

Catch secrets before commit.

Pre-commit hook

Secrets accidentally committed to source control are the most common credential leak path. An engineer commits a config file with a real API key in it; the commit lands on GitHub; bots scanning public repositories find the key within minutes; the credential is compromised before the engineer realizes the mistake. The defense is detection at the commit time, before the bad commit ever leaves the developer's machine.

What pre-commit secret detection looks like:

Pre-commit hooks are the cheapest and earliest defense. The engineer who would have committed a secret instead gets a friendly "you have a secret in this commit" message and fixes it locally.

CI fallback

Pre-commit hooks rely on the engineer having them installed. Some engineers do not. Some commits come from external sources (other tools, automation, contributors who skipped the hook). The CI-side scan is the fallback that catches what local hooks miss.

The two-layer detection (pre-commit local plus CI fallback) closes most of the accidental-commit gap. The remaining cases are where the scanner does not recognize the secret pattern; those are caught by the third layer (repository-level continuous scanning).

Respond

The hardest part of secret detection is what to do when one is detected after it has already been committed. The instinct is to delete the commit and pretend it did not happen. The instinct is wrong; the secret has been compromised the moment it left the encrypted boundary.

Secret detection at commit time is the discipline that prevents the most common credential leak path. Nova AI Ops integrates with pre-commit hooks, CI scanning, and repository-level scanning, surfaces detection events as security incidents with rotation tracking, and produces the audit trail compliance frameworks expect.