Interview Prep/Git & GitHub/Security: secrets, signing, access and supply chain

How do you prevent secrets from entering the repo in the first place?

IntermediateProductionSecurity: secrets, signing, access and supply chain
Answer

Layered controls: a local pre-commit scanner (gitleaks or detect-secrets), GitHub push protection that blocks at push time, secret scanning with custom patterns, a CI scan as a backstop, and an engineering habit of using a secrets manager or OIDC. No single layer is enough because hooks are skippable.

repos:
  - repo: https://github.com/gitleaks/gitleaks
    rev: v8.21.2
    hooks:
      - id: gitleaks
All Git & GitHub questions Roadmap: Git & GitHub

More on Security: secrets, signing, access and supply chain