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
More on Security: secrets, signing, access and supply chain
What are the first things you do when a secret is committed to a repo?BeginnerWalk through purging a leaked secret from a 5 GB repo with 200 contributors.AdvancedWhy use OIDC federation for cloud credentials from GitHub Actions instead of stored keys?IntermediateWhat is your policy on signed commits and how do you enforce it?IntermediateWhat do signed commits not protect against, and what supply chain controls complement them?AdvancedWhy pin third-party GitHub Actions to a commit SHA?Intermediate