The first full scan of a real estate usually returns thousands of historic secrets, and how a team handles that baseline, decides which findings to verify against live services, and phases in push protection determines whether the scanner becomes a trusted control or a dashboard nobody reads. This playbook covers rolling out a secrets scanning tool as a programme: scoping, taking and working a historic-finding baseline, operating validity checks safely, moving push protection from audit to enforcement in rings, routing ownership, rolling back and measuring. It is vendor-neutral and written for platform security, AppSec and DevSecOps engineers who own the rollout. What git secret scanning finds and the detection layers are explained in the Git Secret Scanning Guide, day-to-day triage is in Developer Secret Scanning Triage, and hardening the tool is in Securing the secrets scanning tool itself. This page links them rather than repeating them.
Key takeaways
- The historic baseline is a remediation project, not a report. Split it into waves by validity, credential type and exposure, and give it its own owner and end date so it never blocks developers on day one.
- Validity checks decide priority, not closure. A verified-live secret is an incident; an unverified one is still a lead until someone proves it is dead or rotated.
- Run verification from fixed infrastructure. A validity check presents a found credential to its issuer, so it must come from known scanner egress with logging, never from laptops or shared runners.
- Promote push protection by evidence. Move from audit to enforcement in rings, and widen only when bypass rate and false positive rate meet agreed thresholds.
- Prevention needs a supply of good secrets. Blocking a push only works if developers have a vault path and short-lived credentials to use instead; otherwise the bypass rate climbs.
Scope and sequencing
A secrets scanner is easy to switch on and hard to operate. NIST SP 800-53 Rev. 5 control IA-5(7) No Embedded Unencrypted Static Authenticators is the requirement the scanner evidences, and SA-11 Developer Testing and Evaluation and SA-15 Development Process, Standards, and Tools cover putting the tool in the development process. NIST SP 800-218, the Secure Software Development Framework (SSDF) v1.1, frames the same work as secure development practice. None of them say to enforce everywhere at once.
| Surface | First-wave value | Typical noise | When to add |
|---|---|---|---|
| Source repositories, full history | High: concrete, often live credentials | Test fixtures, example keys, revoked tokens | Phase 1 |
| Push to the source platform | High: stops new secrets entering history | Generic patterns, test data | Phase 3, in rings |
| Pull request and CI diff scanning | High for repositories without server-side push protection | Scanning the whole tree instead of the diff | Phase 3 |
| CI logs and build artefacts | Medium to high: secrets echoed or baked into images | Masked values, binary content | Phase 4 |
| Wikis, tickets and chat exports | Medium: pasted credentials in support threads | Free text, partial strings | Phase 4, with data owners |
| Container registries and packages | Medium: secrets copied in at build time | Layers from base images | Phase 4 |
- Small organisations: one source platform and a few dozen repositories can run history scanning and push protection organisation-wide within weeks, provided one named owner works the baseline.
- Large organisations: start with an inventory of every source platform, self-hosted server, mirror and archived repository, then pick a pilot of five to ten volunteer teams across the main languages. The Secrets Scanning Buyer's Guide covers tool selection.
Phase 1: access and the scanner's own identities
Before the first scan, decide what the tool can reach. A secrets scanner reads every repository it covers and stores the secrets it finds, which makes its own tokens and its findings store among the most sensitive assets in the toolchain (ATT&CK T1213.003 Code Repositories and T1552.001 Credentials In Files describe what an attacker would harvest).
| Integration | Narrowest workable access | Avoid |
|---|---|---|
| Source platform | App-style installation scoped to selected repositories: read contents, write checks and alerts | An administrator's personal access token |
| CI scanning | Per-run credential issued by federation to upload results | A long-lived upload token in every repository |
| Validity checking | Outbound network access from fixed scanner hosts to issuer endpoints only | Verification from developer machines or shared runners |
| Ticketing and chat | Create and update in named projects or channels | Administrator rights |
| Console | Federated sign-in with MFA; masked secret values by default | Local accounts; full values visible to every viewer |
Pin scanner actions and images by commit hash or digest, keep scan jobs away from deployment secrets, and restrict who can reveal full secret values. The If your secrets scanning tool is compromised playbook shows what is at stake if these steps are skipped.
Phase 2: take and work the historic baseline
Run a full-history scan in report-only mode with verification enabled where supported, and store the result set as the baseline. SARIF 2.1.0, the OASIS standard results format, defines a baseline state for each result relative to a previous run: new, unchanged, updated or absent. Tools and dashboards that read this property can show developers only new findings while the backlog is worked separately.
Bucket the baseline into waves
| Wave | Findings | Action | Target (our recommendation) |
|---|---|---|---|
| 0: incident | Verified live cloud, CI/CD, source platform, payment or production database credentials, and any live secret in a public repository | Treat as an incident: revoke or rotate, then review the issuer's logs for use | Within 24 hours |
| 1: verified live, other | Verified live SaaS, messaging and third-party API keys | Rotate through the owning team | Within 7 days |
| 2: unverified, high-risk type | Private keys, connection strings, generic passwords in production configuration | Owner confirms status or rotates; no verification possible means rotate | Within 30 days |
| 3: verified inactive | Credentials the issuer reports as revoked or invalid | Confirm the credential is not merely disabled, record, close | Within 90 days |
| 4: noise | Test fixtures, documentation examples, placeholder values | Replace with the organisation's standard test secrets; add narrow allowlist entries with owner and expiry | With the next change to the file |
- Rotate, do not just delete: the OWASP Secrets Management Cheat Sheet sets the order as revoke, rotate, then remove the secret from the exposed system, and log who had access and when it was used. Rewriting git history breaks links to commits and does not make the secret safe.
- Standard test secrets: the same cheat sheet recommends creating standard test secrets used across the organisation, so each secret type has one known value to ignore. This removes most wave 4 noise permanently.
- Owner by default: route each finding to the repository's code owners or service catalogue owner; unowned findings go to the platform team, never to an open queue.
- Freeze the baseline: regenerate it only through a controlled job with a reviewed diff, because a regenerated baseline is the simplest place to hide a new secret.
Phase 2b: operate validity checks safely
Verification turns a pattern match into evidence by asking the issuing service whether the credential works. It is the best prioritisation signal the tool has, and it is also an outbound action using a credential that is not yours.
| Result | What it means | What to do |
|---|---|---|
| Verified live | The issuer accepted the credential at the time of the check | Incident or wave 1 routing; check the issuer's audit logs for use by others |
| Unverified or unknown | No check exists for the type, or the check failed (network, rate limit, unsupported endpoint) | Treat as possibly live; owner confirms or rotates |
| Inactive or revoked | The issuer rejected the credential | Close after confirming it was revoked, not temporarily disabled or scoped to a network the scanner cannot reach |
- Enable per credential type: start with types whose checks are read-only identity calls, and review each new type before enabling it.
- Fixed egress and logging: run checks from dedicated scanner hosts with known addresses, so the check is attributable in the issuer's logs and your own, and log each check with finding, type and result.
- Re-verify on a schedule: a credential found inactive can be re-enabled. Re-check open and recently closed findings periodically and on any change of status.
- Never verify from untrusted contexts: pull requests from forks and shared runners must not trigger verification or see results.
- Custom and internal tokens: where your own services issue tokens, give them a recognisable prefix so rules are precise. RFC 8959, an Informational RFC from January 2021, registers the
secret-token:URI scheme for exactly this reason: tokens in a consistent form can be scanned for and blocked.
Phase 3: push protection and CI gates in rings
Push protection rejects a push that contains a supported secret type and records any bypass. Enforce it in rings, with evidence for each promotion.
| Ring | Scope | Mode | Promote when (our recommendation) |
|---|---|---|---|
| 0 | Platform and security team repositories | Enforced with self-service bypass and reason | Two weeks with no unresolved false positive patterns |
| 1 | Pilot volunteer teams | Enforced, bypasses reviewed weekly | Bypass rate under 5% of blocked pushes; false positive rate under 10% per pattern |
| 2 | Internet-facing and regulated services | Enforced; bypass needs a reviewer or ticket reference | Same thresholds held for a month |
| 3 | All repositories, and on by default for new ones | Enforced; organisation-wide bypass review | Steady state; thresholds tracked monthly |
- Default patterns first: enforce only high-precision, provider-format patterns at first. Add custom patterns in audit mode, test them against the baseline and known-good fixtures, then promote one by one.
- CI diff scanning as the backstop: on platforms or repositories without server-side push protection, scan the commit range of each pull request and fail on new verified or high-confidence findings. Upload SARIF so findings appear next to the code.
- Pre-commit hooks are convenience: distribute them through repository templates, but never count them as the control, because developers can skip them.
- Give developers somewhere to put the secret: before ring 2, publish the vault path, the federation option for CI and the request route for new credentials. See the Secrets manager rollout playbook.
- Bypass reasons are data: sample "test credential" and "false positive" reasons each month; real credentials are often labelled as test data. How to respond when a push is blocked is in What to do when git push is blocked by secret scanning push protection.
Phase 4: extend, default on, and roll back safely
- Extend surfaces: add CI logs, artefact and container registries, and documentation and ticketing systems, each with a data owner who agrees retention for findings.
- Default on: repository templates and organisation settings enable history scanning, push protection and CI scanning at creation.
- Retire older tools: when the new scanner replaces an older one, revoke the old tool's repository access and tokens and record the date.
- Rule changes through review: keep rules, allowlists and baselines in version control and alert on detector changes.
- Rollback: if a pattern blocks wrongly, move that pattern back to audit mode or narrow it, or switch one repository's enforcement to advisory, through reviewed configuration. Never roll back by disabling the scanner: an absent scan looks the same as a clean one.
Where identity fits
Every finding is a non-human identity with an owner, a scope and a lifetime: API keys, service account keys, tokens and private keys. The rollout is the moment to find out who owns them. Record the owning team for each verified credential, replace long-lived keys with federated or short-lived credentials where the platform allows, and feed recurring credential types into the NHI inventory. The scanner's own app installation, upload tokens and verification hosts are non-human identities too, and need the same scoping and review. See the API Key Management Guide.
Detection and measurement
| Metric | What it shows | Target (our recommendation) |
|---|---|---|
| Coverage: share of active repositories with history scanning and enforced push protection | Reach of the control | Above 95% of in-scope repositories by ring 3 |
| Baseline burn-down by wave | Whether historic exposure is closing | Waves 0 and 1 cleared on target |
| Median time from detection to rotation for verified live secrets | Real exposure window | Under 24 hours |
| Push protection bypass rate and reason mix | Developer trust and quiet erosion | Under 5% of blocked pushes |
| False positive rate per custom pattern | Rule quality | Patterns above 10% returned to audit |
| New secrets reaching default branches per month | Whether prevention works | Falling each quarter |
Also send the scanner's own events to the SIEM: rule and allowlist changes, baseline regenerations, dismissals, full-value reveals, exports and verification volume. An attacker who wants a secret to stay hidden dismisses the finding rather than deleting the scanner.
Common failure patterns
- Baseline as a gate: historic findings block every merge on day one, and developers learn to bypass.
- Closing on "unverified": findings with no available validity check are treated as dead and closed.
- Delete without rotate: the commit is rewritten, the credential stays valid, and copies remain in forks and clones.
- Verification from anywhere: checks run from shared runners or laptops, leaving no attributable trail and exposing results.
- Custom patterns enforced untested: a noisy internal pattern blocks releases, and the response is to disable push protection entirely.
- Blocking without an alternative: push protection enforced before developers have a vault path, so bypasses become routine.
Framework mapping
| Activity | NIST SP 800-53 Rev. 5 | NIST CSF 2.0 | Other |
|---|---|---|---|
| Detecting embedded credentials | IA-5(7), SA-11 | PR.PS-06 | NIST SSDF; ATT&CK T1552.001 |
| Scanner in the development toolchain | SA-15 | PR.PS-06 | SARIF 2.1.0 |
| Rotating exposed credentials | IA-5 | PR.AA-01 | OWASP Secrets Management Cheat Sheet |
| Scanner tokens and findings access | AC-6 | PR.AA-05 | ATT&CK T1213.003 |
| Rule, allowlist and baseline changes | CM-3 | PR.PS-04 | Not mapped |
| Monitoring new exposures | SI-4 | DE.CM-09 | Not mapped |
Practitioner checklist
- Inventory every source platform, mirror and archived repository before scanning.
- Connect the scanner through a repository-scoped app integration and per-run CI credentials.
- Take a full-history baseline in report-only mode and freeze it under change control.
- Split the baseline into waves by validity, type and exposure, with owners and target dates.
- Enable validity checks per credential type from fixed, logged scanner egress only.
- Treat unverified findings as possibly live until an owner proves otherwise.
- Publish standard test secrets and a vault path before enforcing push protection.
- Enforce push protection in rings and promote only on measured bypass and false positive rates.
- Keep rules and allowlists in version control and roll back per pattern, never by disabling the scanner.
- Report coverage, baseline burn-down, time to rotate and bypass rate monthly.
Standards and references
- NIST: SP 800-53 Rev. 5, Security and Privacy Controls for Information Systems and Organizations
- NIST: SP 800-218, Secure Software Development Framework (SSDF) Version 1.1
- NIST: Cybersecurity Framework 2.0
- OASIS: Static Analysis Results Interchange Format (SARIF) Version 2.1.0
- IETF: RFC 8959, The "secret-token" URI Scheme
- OWASP: Secrets Management Cheat Sheet
- MITRE ATT&CK: Credentials In Files
Related NHI Mgmt Group resources: Git Secret Scanning Guide · Developer Secret Scanning Triage · Securing the secrets scanning tool itself · Secrets scanning tool health check · Secret Scanner Rule Coverage Comparison Guide