Where should secrets scanning run: pre-commit, CI, or both?
IntermediateConceptApplication Security Testing (SAST, DAST, SCA, Secrets)
Answer
Both, plus server-side. Pre-commit (gitleaks protect --staged or the pre-commit framework) gives instant feedback but developers can skip it with --no-verify. CI scanning is the enforceable backstop. GitHub push protection or GitLab secret push protection blocks pushes server-side before the secret lands in the repo.
Layering them means the cheap local check catches most cases and the server-side check catches the rest.
More on Application Security Testing (SAST, DAST, SCA, Secrets)
What is SAST and what are its strengths and limits?BeginnerWhat is DAST and how does it differ from SAST?BeginnerWhat is IAST and RASP?IntermediateWhat is SCA and what does it scan?BeginnerHow does a SAST tool find a SQL injection using taint analysis?AdvancedHow do you write a simple Semgrep rule?Intermediate