secret scanning
Searching code, commits and files for credentials such as keys and tokens, ideally before they are committed.
A committed secret can be copied by anyone with repository access and used until it is revoked.
In more detail
Scanners combine patterns for known token formats with an entropy check for randomness. Scan in a pre-commit hook and again in CI, because hooks are not cloned and can be skipped.
Example
In this course: Run it in the gate so a leaked secret is caught before merge; any secret that did reach a repository must be revoked, not just deleted. GitHub and tools such as Gitleaks provide it.Related terms
- Gitleaks — An open-source secret scanner for Git repositories and files, configured with TOML rules that combine regular expressions, keywords and entropy.
- Shannon entropy — A measure, in bits per character, of how unpredictable a string is, used to tell random-looking tokens from ordinary text.
- pre-commit hook — A Git hook that runs before a commit is created and can refuse the commit, for example when it contains something shaped like a secret.
- secret — Any value that grants access, such as a password, access token or private key, and must be kept out of code and version control.
- quality gate — A check, or set of checks, that a change must pass before it can move on, such as being merged or promoted to the next pipeline stage.
- dependency scanning — Automatically checking a project's third-party packages against databases of known vulnerabilities and licence rules.
- entropy — A measure of how unpredictable a value is; high-entropy secrets are long and truly random so they cannot be guessed.
- key rotation — Replacing a password or key with a new one on a schedule or after a suspected leak, and re-encrypting what it protected.
- commit history — The full chain of commits in a repository, which keeps every past version of every file, including deleted secrets.
Taught in
- Working With AI Coding Assistants — AI Engineering: LLM Apps, RAG & Agents
- Secrets, Keys And Certificates In Pipelines — Microsoft Azure DevOps Engineer Expert (AZ-400) Exam Prep
- Scanning Code, Dependencies And Containers — Microsoft Azure DevOps Engineer Expert (AZ-400) Exam Prep
- Pre-Commit Secret Scanning with Gitleaks & Entropy — Cloud Security & DevSecOps Engineering
- Software Composition Analysis with Trivy — Cloud Security & DevSecOps Engineering
- Why Secrets Leak — Application Security & Threat Modeling for Engineers
- Secret Scanning — Application Security & Threat Modeling for Engineers
- How To Stop Drowning In Findings — Application Security & Threat Modeling for Engineers
- What To Automate Away — Automated Testing, TDD & Quality Engineering