TL;DR: GitGuardian’s 2026 analysis, cited by Xygeni, shows 28.65 million new hardcoded secrets in public GitHub commits in 2025, a 34% rise, while AI-related credential leaks surged 81% and 64% of valid secrets from 2022 were still exploitable in 2026, underscoring a remediation gap. Detection alone is no longer enough; lifecycle control and revocation now determine exposure.
At a glance
What this is: This guide argues that secrets sprawl is accelerating because AI-assisted coding, MCP configuration practices, and collaboration tools are expanding leak surfaces faster than detection-only workflows can respond.
Why it matters: IAM, PAM, and NHI teams need to treat exposed secrets as a lifecycle problem, because discovery without revocation, rotation, and guardrails leaves standing access in place.
By the numbers:
- AI-related secrets surged 81% year over year, reaching over 1.27 million leaked credentials.
- 64% of credentials confirmed valid in 2022 were still exploitable as of January 2026, four years after first being exposed.
Context
Secrets sprawl is no longer just a code hygiene issue. It is an access governance problem: once an API key, token, password, or certificate leaks, the credential can outlive the workflow that created it and remain usable across cloud, CI/CD, and production systems.
The article’s primary finding is that detection alone is not stopping exposure. AI-assisted development, MCP configuration practices, and collaboration tools are broadening the places where secrets appear, while remediation lag leaves valid credentials exploitable long after first disclosure.
Key questions
Q: What breaks when a secret is deleted from code but not revoked?
A: The exposure remains active because repository cleanup does not remove standing privilege. Anyone who found the secret before deletion can still authenticate until the backing service invalidates it. That is why leak response must include revocation, rotation, and confirmation that the token no longer works, not just removal from the file.
Q: Why do leaked API keys and tokens create such a large security risk?
A: They authenticate actions directly, so anyone who finds them can act as a trusted caller. If the secret is long-lived or broadly scoped, the attacker gains standing access that may bypass normal user controls, making the leak a privilege and identity problem as much as a data exposure issue.
Q: What are the signs that a secrets management programme is failing?
A: Common warning signs include inconsistent secret formats, missing scans in configuration files or side repositories, frequent false positives, and teams relying on manual checks instead of automation. Another red flag is when secrets remain exposed long enough to be reused. If scanning does not cover the full development ecosystem, control gaps usually persist.
Q: How should security teams handle secrets found in collaboration tools and MCP configs?
A: Treat them the same way you would treat a leaked repository secret: assume they are active until proven otherwise, then revoke or replace them through a governed workflow. Collaboration platforms and MCP configs can expose credentials outside traditional code scanning, so the inventory and response process has to include those locations explicitly.
Technical breakdown
Why hardcoded secrets still bypass modern controls
Hardcoded secrets are credentials embedded directly into code, configuration, documentation, or build artefacts. They bypass normal issuance and review paths because the secret is created at the same time as the application logic, often before security tooling sees it. In NHI terms, the problem is not only exposure but governance failure: the credential is now disconnected from its lifecycle owner, intended scope, and revocation point. Once copied into a repository, build log, or shared workspace, it can be consumed by attackers, bots, or unintended internal users. This is why scanning without lifecycle control leaves a residual access path in place.
Practical implication: teams need to treat leaked secrets as active credentials, not as findings waiting for later cleanup.
How AI-assisted development changes leak patterns
AI coding assistants do not create autonomy in the identity sense, but they do change developer behaviour by increasing the rate at which credentials are copied, pasted, or accepted into code. The article’s comparison between Claude Code-assisted commits and the overall baseline shows that secret exposure can rise when code generation accelerates the pace of acceptance. The issue is not the model itself. It is the combination of suggestion, speed, and insufficient review discipline. That means leak prevention now has to sit both at authoring time and at merge time, with controls that interrupt unsafe commits before they reach shared repositories.
Practical implication: place policy checks where developers write and commit code, not only where security teams scan afterward.
Why detection-only secrets management fails at scale
Detection finds exposure, but it does not change exploitability. The article’s strongest point is that many secrets remain valid months or years after discovery, which means a leak becomes a standing credential problem unless the secret is revoked, rotated, or otherwise invalidated. Validation-only prioritisation also misses critical secrets when active status cannot be confirmed automatically. That creates a control gap between visibility and containment. In practice, this is where secrets management becomes a lifecycle discipline, not a scanner output problem: discover, classify, revoke, replace, and prove the replacement is live.
Practical implication: pair secret detection with revocation and rotation workflows that close the exposure window immediately.
Threat narrative
Attacker objective: The attacker aims to turn a leaked secret into usable access for cloud, pipeline, or production environments.
- Entry occurs when a secret is hardcoded into source code, configuration files, or collaboration tools and becomes visible in GitHub commits or shared operational content.
- Credential access follows when an attacker or unintended party retrieves the exposed API key, token, or password and tests whether it is still valid.
- Escalation happens when the credential grants access to cloud services, CI/CD pipelines, or production data beyond its original intended scope.
- Impact is the compromise of systems, pipelines, or sensitive data through a credential that was never revoked after exposure.
Breaches seen in the wild
- iOS apps leaking hard-coded secrets: Cybernews found 71% of 156,080 iOS apps leak hard-coded secrets, with open cloud storage and Firebase databases exposing user data.
- 12,000 secrets in LLM training data: Truffle Security found 11,908 live API keys and passwords hard-coded in web pages captured by Common Crawl, a dataset used to train LLMs.
Read and download The State of NHI & AI Agent Breach Report 2026, covering 200+ breaches impacting Non-Human Identities including AI Agents.
NHI Mgmt Group analysis
Secrets sprawl is now an access-lifecycle failure, not a detection problem: The article shows that visibility without invalidation leaves credentials exploitable long after discovery. That means the governing question is no longer whether a secret was found, but whether its privilege has been removed from circulation. The implication is that secrets governance must be judged by revocation velocity, not scan volume.
Hardcoded secrets create identity debt at the moment of creation: A credential embedded into code inherits none of the normal lifecycle guarantees that a managed secret should have. It can be copied, cached, forked, logged, and reused outside the original control plane, which breaks ownership and offboarding assumptions. Practitioners should treat every hardcoded secret as a governance exception with immediate blast-radius implications.
AI-assisted coding amplifies credential introduction, but the control gap remains human review and policy enforcement: The article’s data show faster leakage rates in AI-assisted workflows, yet the risk still depends on what is accepted into source control. That means the field should stop framing this as an AI-only problem and start framing it as a commit-time governance problem. The practitioner conclusion is that approval gates and secret-blocking policies belong at the point of authoring.
MCP configuration is emerging as a new secrets sprawl channel: The article surfaces a concrete pattern where credential placement in configuration files becomes normalised by integration guidance. That is a structural problem because operational convenience is being mistaken for safe authentication design. The implication is that teams must review MCP deployment patterns as part of NHI governance, not as a niche integration detail.
Ephemeral credential trust debt: The article shows why short-term exposure and long-lived exploitability now coexist in the same environment. A secret can be discovered quickly, yet remain useful for years if it is never revoked. For practitioners, the issue is not just sprawl but accumulated trust debt across repositories, collaboration tools, and pipelines.
From our research library:
- 28.65 million new hardcoded secrets were detected in public GitHub commits in 2025 alone, a 34% year-over-year increase and the largest single-year jump ever recorded, according to the State of Secrets Sprawl 2026.
- Only 44% of organisations are currently using a dedicated secrets management system, according to the 2024 State of Secrets Management Survey.
- Read next: Secrets Management Buyer's Guide
What this signals
Secrets sprawl has become a governance problem because the leak surface now extends beyond source code. Collaboration tools, MCP configuration files, and AI-assisted workflows all create places where credentials can appear outside the paths security teams traditionally monitor. The programme consequence is straightforward: inventory and response need to include every place a secret can be introduced, not just repositories.
Detection must now be measured by containment, not coverage alone. The article’s key signal is that valid credentials can remain exploitable long after discovery, which means alert volume does not equal risk reduction. Teams should assess whether their secret handling process actually removes access or merely records it.
AI-assisted development is widening the gap between secret creation and secret governance. Even when developers stay in control, the speed of code generation and commit acceptance increases the chance of hardcoded credentials slipping through review. The practical signal is that commit-time policy enforcement has become as important as post-commit scanning.
For practitioners
- Block hardcoded secrets before merge Enforce repository and pull request policy that fails builds when API keys, tokens, passwords, or certificates are detected in code or configuration.
- Automate revocation on confirmed exposure Connect secret detection to response workflows that revoke compromised credentials as soon as a finding is validated, rather than waiting for manual triage.
- Separate detection from lifecycle control Use scanning to find leaks, but make rotation, replacement, and ownership transfer mandatory follow-on steps for every confirmed secret exposure.
- Review MCP and collaboration-tool exposure paths Treat MCP configuration files, Slack, Jira, and Confluence as first-class secret sources in your governance model, not as edge cases outside the normal SDLC.
- Prioritise long-lived secrets first Start remediation with secrets that have the longest exposure window, because the article shows those are the ones most likely to remain exploitable long after discovery.
Key takeaways
- Hardcoded secrets are now a high-frequency access problem, not just a coding mistake, because exposed credentials can immediately unlock cloud and pipeline resources.
- The article’s figures show that exposure is rising while valid secrets can stay exploitable for years, which exposes the limits of detection-only operations.
- Teams that want to reduce risk need to connect discovery with revocation, rotation, and policy enforcement at the point where secrets are introduced.
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 addresses the attack and risk surface, while NIST SP 800-53 Rev 5 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | The article is centred on exposed credentials appearing in code, configs, and collaboration tools. |
| NHI-07 — Long-Lived Secrets | Long-lived secrets are the article's core remediation gap because exposed credentials stay usable for years. | |
| NHI-05 — Overprivileged NHI | Leaked secrets often carry more access than they should, amplifying blast radius after exposure. | |
| Recommendation — Scan for leaked secrets continuously and treat every confirmed exposure as a live credential until revoked. Shorten secret lifetime and force revocation when exposure is detected to shrink the exploit window. Reduce privilege scope on secrets so any leak carries less downstream access. | ||
| NIST SP 800-53 Rev 5 | IA-5 — Authenticator Management | Credential lifecycle management is the control family most directly tied to rotation and replacement. |
| Recommendation — Apply authenticator lifecycle controls to rotate, replace, and revoke exposed credentials immediately. | ||
| NIST CSF 2.0 | PR.AA-05 — Access Permissions, Entitlements and Authorizations | The article is about credentials whose access permissions must be governed after exposure. |
| Recommendation — Review and limit entitlements tied to secrets so exposed credentials cannot retain broad access. | ||
Key terms
- Hardcoded Secret: A hardcoded secret is a credential written directly into source code, scripts, configuration files, or build assets. It is convenient for development but dangerous in production because it can be copied, indexed, propagated, and reused outside the intended control boundary.
- Secrets Sprawl: The uncontrolled proliferation of sensitive credentials, API keys, tokens, passwords, certificates, across codebases, cloud environments, CI/CD pipelines, and configuration files. In 2024, over 50 million leaked secrets were found on the dark web.
- Secrets Scanning: Automated tooling that scans source code repositories, CI/CD pipelines, and cloud environments to detect exposed secrets such as API keys, tokens, and passwords before they are exploited.
- Credential Revocation: Credential revocation is the process of disabling a secret, token, or key so it can no longer authenticate or authorize action. It is the operational half of detection, because exposed credentials remain dangerous until they are invalidated and replaced across every dependent system.
Deepen your knowledge
NHI governance, agentic AI identity, and machine identity lifecycle are core topics in our NHI Foundation Level course, the industry's only accredited NHI security programme. If you are responsible for identity security strategy or NHI governance in your organisation, it is worth exploring.
Published by the NHIMG editorial team on August 20, 2026.
Updated on October 12, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org