TL;DR: GitGuardian says ggshield can scan repositories, files, archives, Docker images, PyPI packages, CI pipelines, and commits, while also supporting hooks, Honeytokens, and HasMySecretLeaked workflows for leaked-secret checks. The operational lesson is that secrets governance has to move left and extend beyond repositories into the broader developer workflow.
At a glance
What this is: GitGuardian’s ggshield cheat sheet maps the CLI across repo, file, archive, container, CI, and leak-check workflows, showing how secrets scanning now spans more than version control.
Why it matters: For IAM and NHI practitioners, the key point is that secrets exposure can emerge anywhere developers handle text, packages, or pipelines, so governance has to cover the full workflow.
By the numbers:
- GitGuardian has a database of over 20 million publicly leaked secrets.
- Internal repositories are 6x more likely to contain secrets than public ones, at 32.2% versus 5.6%.
👉 Read GitGuardian's ggshield cheat sheet for secrets scanning and leak checks
Context
Secrets sprawl is not just a source-control problem. In NHI governance terms, every place a credential can be copied, committed, packaged, or leaked becomes part of the identity attack surface, which is why CLI-based scanning, pipeline hooks, and post-exposure checks matter.
ggshield is GitGuardian’s terminal-based workflow for finding secrets across repos, files, archives, containers, CI runs, and public-leak lookups. That breadth makes it a practical example of how NHI controls have to follow developer behaviour instead of assuming a single repository scan is enough.
Key questions
Q: How should security teams handle secrets exposed in developer workflows?
A: Treat developer workflows as part of the identity perimeter. Scan repositories, local files, archives, container images, and CI pipelines, then connect every finding to revocation or rotation. A secret is only safe once it is removed from the workflow, invalidated where possible, and blocked from reappearing in future commits or builds.
Q: When does pre-commit scanning add the most value for NHI governance?
A: Pre-commit scanning is most valuable when teams want to stop secrets before they enter shared history. It reduces downstream cleanup, but it works best when paired with pre-push and CI checks, because a single control point will miss secrets that arrive through packaging, branching, or build steps.
Q: What is the difference between secret scanning and Honeytokens?
A: Secret scanning finds real exposed credentials, while Honeytokens are decoy credentials designed to detect use. Scanning answers whether a secret exists in code or artefacts, but Honeytokens answer whether someone is trying to use a credential they should not have. Mature programmes use both because they cover different failure modes.
Q: Should organisations rely on detection alone for secrets management?
A: No. Detection is necessary, but it is not sufficient if the exposed secret remains valid. Organisations need automated revocation, scoped access, and periodic leak verification so a discovered secret cannot continue to authenticate after it is found.
Technical breakdown
How ggshield applies secrets scanning across developer assets
ggshield treats many text-bearing artefacts as scan targets, not just Git repositories. The same secret-detection engine can inspect a local path, a commit range, an archive, a Docker image, or a PyPI package, which matters because secrets often move before they are formally committed. This matters for NHI security because a secret is still an identity credential even when it is hiding in a build artefact, a dependency, or a compressed bundle. The technical shift is from repo-centric inspection to content-centric inspection.
Practical implication: Scan the artefacts developers actually move, package, and ship, not only the repository history.
Why hooks and CI checks change the control point
Pre-commit, pre-push, and CI scanning move secret detection closer to the moment of change. That reduces dwell time for accidental exposure, but it does not eliminate risk by itself because a committed secret can already have propagated into forks, caches, logs, and downstream systems. In NHI terms, this is an admission that prevention needs to sit alongside discovery and revocation. The important architecture point is that control placement matters as much as detection logic.
Practical implication: Use hooks and pipeline scans as gatekeeping controls, then pair them with revocation and rotation workflows.
What Honeytokens and HasMySecretLeaked add to NHI monitoring
Honeytokens are decoy credentials that should never be used by legitimate systems, so any access attempt becomes a strong signal. HasMySecretLeaked adds a retrospective exposure check by fingerprinting secrets and matching them against known public leaks. Together they cover two different NHI problems: unexpected use of a credential and prior public exposure of a credential. Those are distinct failure modes, and they require distinct operational responses.
Practical implication: Treat decoys as detection and leak matching as exposure validation, then route each alert into a revocation workflow.
Threat narrative
Attacker objective: The attacker wants reusable non-human credentials that unlock systems, pipelines, or cloud resources before defenders detect and revoke them.
- Entry occurs when a developer copies a credential into code, a config file, an archive, or a container image that later becomes part of the build or distribution path.
- Escalation follows when pre-commit or CI controls are absent, allowing the secret to propagate into commits, images, logs, forks, or dependency artefacts.
- Impact occurs when the exposed secret is reused for API access, cloud access, or service authentication before it is revoked.
Breaches seen in the wild
- CI/CD pipeline exploitation case study — full server takeover via exposed .git directory and mismanaged CI/CD pipeline secrets.
- Reviewdog GitHub Action supply chain attack — reviewdog/action-setup GitHub Action supply chain attack exposed secrets.
Read our 52 NHI Breaches Analysis report for a comprehensive view of breaches impacting Non-Human Identities including AI Agents.
NHI Mgmt Group analysis
Secrets governance is no longer a repository problem, it is a workflow problem. The cheat sheet makes clear that secrets can surface in files, archives, Docker images, CI pipelines, and leak-verification workflows, which means control placement has to match developer behaviour. A repository-only model leaves blind spots everywhere teams package, test, and distribute code. Practitioners should treat the full developer workflow as the NHI control boundary.
Ephemeral detection without revocation is incomplete control. Scanning at commit time reduces exposure, but the source article also points to the need for post-exposure validation through HasMySecretLeaked and for decoy-based monitoring through Honeytokens. That combination reflects a broader NHI governance reality: discovery, detection, and response must work together, or exposed secrets remain valid long enough to matter. Teams should pair every finding with an automated revocation path.
Developer tooling is becoming an identity control plane by accident. CLI commands, hooks, and pipeline checks increasingly decide when secrets are allowed to move, which makes them governance infrastructure whether teams label them that way or not. The named concept here is the terminal trust boundary: the point where local developer actions become security-enforced identity decisions. Practitioners should formalise that boundary before it becomes an unmanaged policy layer.
Honeytokens should be treated as an early-warning layer, not a replacement for least privilege. Decoy credentials are useful because they turn unintended use into a signal, but they do not reduce blast radius if real secrets remain overprivileged or long-lived. That means teams still need rotation, scoping, and access review. The practical conclusion is straightforward: deception augments governance, it does not substitute for it.
From our research:
- 64% of valid secrets leaked in 2022 are still valid and exploitable today, proving that detection alone is not enough without automated revocation, according to the State of Secrets Sprawl 2026.
- Claude Code-assisted commits leaked secrets at a rate of 3.2%, more than double the human-only baseline of 1.5%, according to the same research.
- For the broader governance model, review the Guide to the Secret Sprawl Challenge for remediation patterns that go beyond detection.
What this signals
Terminal trust boundary: as CLI tools take on scanning, gating, and leak-verification roles, they become part of the control plane for NHI governance. That raises the bar for policy consistency across developer laptops, runners, and build systems, especially when OWASP Non-Human Identity Top 10 guidance already treats secret exposure and rotation as core identity risks.
The programme signal is clear. With 24,008 unique secrets exposed in MCP configuration files in 2025 alone, teams cannot assume that the highest-risk credential leaks will stay inside source code. Governance needs to extend into tools, artefacts, and AI-adjacent configuration paths before those become the next blind spot.
For practitioners
- Expand scanning beyond repositories Cover local files, archives, Docker images, and dependency artefacts in the same secrets workflow so packaging does not bypass detection.
- Move enforcement into commit and pipeline stages Use pre-commit, pre-push, and CI checks to catch secrets before they spread into branches, builds, and shared artefacts.
- Automate revocation after every finding Do not stop at detection. Route exposed credentials into a documented rotation or revocation process immediately after alerting.
- Use Honeytokens as detection signals Seed decoy credentials in places an attacker might touch, then treat any use as a high-confidence indicator of unwanted access.
Key takeaways
- Secrets scanning has to cover the full developer workflow, not just repository history.
- Detection is only half the control story when exposed secrets can remain valid long after discovery.
- Hooks, CI checks, leak verification, and revocation need to operate as one governance chain.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST CSF 2.0 and NIST Zero Trust (SP 800-207) set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-03 | Covers secret exposure and rotation, which this post centres on. |
| NIST CSF 2.0 | PR.AC-4 | Least-privilege access depends on limiting how exposed secrets can be used. |
| NIST Zero Trust (SP 800-207) | Zero Trust requires continuous verification even for machine credentials. |
Apply ZT principles to NHI credentials by verifying every use path and reducing standing trust.
Key terms
- Secrets Sprawl: Secrets sprawl is the uncontrolled spread of credentials across code, pipelines, files, logs, and collaboration tools. It matters because once a secret is copied into multiple places, revocation becomes a distribution problem, not just a detection problem, and the effective attack surface grows faster than most teams can manage.
- Honeytoken: A Honeytoken is a decoy credential that should never be used by legitimate systems. When someone attempts to validate or consume it, the event becomes a high-confidence signal of unwanted access, helping defenders detect misuse without relying on the attacker to trigger a conventional alert.
- Terminal Trust Boundary: The terminal trust boundary is the point where local developer actions become security-controlled identity decisions. In practice, it is the line where CLI tools, hooks, and pipeline checks start enforcing whether a secret can move, and that makes the terminal part of the governance stack.
- Commit-Range Scanning: Commit-range scanning inspects a chosen slice of Git history instead of the entire repository. It is useful when teams need to focus on a suspected window of exposure, but it still depends on downstream response because a secret found in history can already be valid elsewhere.
What's in the full article
GitGuardian's full blog post covers the operational detail this post intentionally leaves for the source:
- Command-by-command examples for every ggshield scan mode, including repo, path, archive, Docker, PyPI, and CI use cases.
- Authentication, scope, and token workflow details for teams that need to operationalise ggshield across environments.
- Hook installation examples for local and global Git workflows, including append behaviour for existing hooks.
- HasMySecretLeaked fingerprinting and validation workflow details for teams investigating whether a secret has already been exposed.
Deepen your knowledge
Secrets sprawl, developer workflow scanning, and automated revocation are core topics in our NHI Foundation Level course, the industry's only accredited NHI security programme. If your team is trying to move from ad hoc scanning to governed identity controls, it is worth exploring.
Published by the NHIMG editorial team on 2025-12-10.
NHI Mgmt Group — the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org