September 6, 2026
Posted by Joyce Ling
Key Takeaways
Secret sprawl is outgrowing the teams that track it: GitGuardian counted 28.65 million new hardcoded secrets in public GitHub commits in 2025, up 34% in a year.
- Finding a secret is not fixing it. Of the secrets GitGuardian confirmed as valid in 2022, 64% were still valid in January 2026.
- Detection has to cover code, pipelines, and cloud accounts, because roughly one in four leaks starts outside code repositories.
- Centralizing secrets is the interim step. The end state is fewer standing secrets, through short-lived, least-privilege access.
Answer Capsule: What Is Secret Sprawl?
Secret sprawl is the uncontrolled spread of credentials such as API keys, tokens, passwords, and certificates across code repositories, CI/CD pipelines, cloud accounts, containers, and chat tools, faster than anyone can inventory, rotate, or revoke them. It differs from a single hard-coded secret because it is a systemic loss of visibility and ownership, and it grows as non-human identities multiply. The fix combines detection in every place secrets live with fewer, shorter-lived, tightly scoped credentials.
- A hard-coded secret is one symptom; sprawl is the condition behind many of them.
- Scanning finds exposed secrets; rotation, expiry, and least privilege shrink what exposure can cost.
- Fewer standing secrets means less to scan, store, and leak.
Every secret copied into a config file, a Slack thread, or a CI variable is one more place to search when something leaks, and most teams learn how many places there are only when an incident forces the count. Secret sprawl is the uncontrolled spread of credentials such as API keys, tokens, and certificates across code, pipelines, cloud accounts, and chat tools, faster than anyone can inventory, rotate, or revoke them. The cost shows up twice: developers lose hours working out where a key lives before they can rotate it, and attackers need only one stray copy.
This guide is written for DevOps engineers and security leads and covers how to detect secret sprawl, a prevention playbook built from four tactics, and the case for a modern approach to secrets management. One argument runs through all of it: centralizing secrets is the interim step, and sprawl shrinks for good only when there are fewer standing secrets to track.
Secret Sprawl: A Hidden Threat in Development Environments
Picture a developer finishing a feature on deadline day. The service needs a payment API key, so the key goes into a config file “just for now,” and the commit goes up. A reviewer might catch it, or a scanner might flag it, or neither happens. Even when someone notices, deleting the line in a later commit does not erase the key, because the secret stays recoverable from Git history, a point the authors of the first large-scale study of secret leakage on GitHub made in 2019. The scenario is a composite, but the pattern behind it is documented.
The scale has changed since that 2019 study, which found leakage affecting over 100,000 public repositories. GitGuardian’s 2026 report counted 28.65 million new hardcoded secrets in public GitHub commits during 2025, a 34% rise over 2024 and the largest single-year jump in its five editions. The same report found that internal repositories were about six times as likely as public ones to contain a hardcoded secret (32.2% versus 5.6%), so private does not mean safe.
Modern architectures multiply the places a secret can live. A single service may need credentials for a database, a message queue, two cloud accounts, and a third-party API, and each one gets copied into a pipeline variable, a container image, an infrastructure template, and a teammate’s laptop. A copy is one more thing to track, which brings up the definition that matters for everything that follows.
What Is Secret Sprawl?
Secret sprawl is the state in which authentication credentials exist in many more places than the organization can track. The credentials include API keys, access tokens, passwords, SSH keys, database logins, and TLS certificates. The same credential gets copied into repositories, pipeline variables, container images, wikis, tickets, and chat messages, and each copy has no clear owner, expiry date, or revocation path. The Akeyless glossary entry on secret sprawl gives the short version.
| Hard-Coded Secret | Secret Sprawl | |
| What it is | One credential written into source code or a config file | Credentials replicated across many tools, teams, and environments |
| Where to look | Source code and Git history | Code, pipelines, cloud accounts, containers, and collaboration tools |
| Typical fix | Remove it and rotate it | Inventory, centralize, scope, and shorten the life of credentials |
| Relationship | One symptom | The systemic condition that produces many such symptoms |
Non-human identities drive much of the growth. Entro Security’s H1 2025 analysis found non-human identities outnumbering humans 144 to 1, up from 92 to 1 a year earlier. Visibility lags behind: a 2023 Osterman Research survey for Silverfort found that only 5.7% of organizations had full visibility into their service accounts. An attacker needs only the one copy nobody remembers, and the next section covers what happens when they find it.
Why Secret Sprawl Is a Security Risk
Secret sprawl creates three kinds of risk, and a well-documented breach illustrates each.
Exposure: copies end up where anyone can read them. In May 2026, KrebsOnSecurity reported that a CISA contractor kept a public GitHub repository, created in November 2025, that exposed administrative credentials for three AWS GovCloud accounts and plaintext passwords for dozens of internal systems. Experts who reviewed the commit logs said the contractor had disabled GitHub’s built-in protection against publishing secrets, and the AWS keys stayed valid for about 48 hours after CISA was notified. Akeyless covered the lessons in its analysis of the CISA leak.
Abuse: one valid credential becomes broad access. In the 2022 Uber breach, an attacker used a contractor’s credentials to reach the network and then found a PowerShell script on a network share containing hardcoded admin credentials for Uber’s privileged access management system. CyberArk’s analysis describes how harvesting those credentials let the attacker escalate privileges, and GitGuardian’s write-up notes that they opened the way to take over multiple internal services.
Reach: every extra copy raises the cost of one incident. In January 2023, malware on a CircleCI engineer’s laptop let an attacker steal a 2FA-backed SSO session. CircleCI told customers to rotate their secrets, including OAuth tokens, project API tokens, and SSH keys, and said that anyone who stored secrets on the platform during the incident window should assume they were accessed. Every credential a team had copied into that platform became a rotation task.
MITRE ATT&CK files this behavior under the Credential Access tactic (TA0006). The Unsecured Credentials technique (T1552) covers adversaries searching compromised systems for insecurely stored credentials, with sub-techniques for credentials in files (T1552.001) and chat messages (T1552.008). Once an attacker holds a valid credential, Valid Accounts (T1078) lets that activity blend in with legitimate use.
Survey data shows how common the underlying conditions are:
| Finding | Source and Date | Sample and Caveat |
| 96% keep secrets outside secrets managers, in code, config files, and CI/CD tools; 70% had a secret leak in the past two years, with 36 hours on average to mitigate a leak | Akeyless, 2024 State of Secrets Management Survey (published November 2023) | 200 security professionals surveyed in June 2023; vendor survey |
| 83% of organizations had experienced a breach involving compromised credentials | Silverfort and Osterman Research (September 2023) | 637 identity professionals at organizations with 1,000 or more employees; vendor-sponsored |
| Credential abuse fell to 13% of initial access (from 22%) as vulnerability exploitation rose to 31%; half of ransomware victims had a credential or infostealer event in the prior 95 days | Verizon 2026 DBIR (May 2026), as summarized by GitGuardian | The 2026 edition began tracking pretexting separately, which moved some cases out of credential abuse |
Every case above began with someone finding a secret that should not have been findable, so defenders need to find it first.
How to Detect Secret Sprawl
Detection speed matters because the gap between exposure and remediation is where attackers work. IBM’s 2026 research put the average time to identify a breach at 183 days, with a full identify-and-contain lifecycle of 247 days. For secrets, GitGuardian’s retest found that 64% of credentials confirmed valid in 2022 were still valid in January 2026, which it treats as a remediation failure rather than a detection failure. The Akeyless survey put the average time to mitigate a leak at 36 hours once someone had found it.
Three practices cover the main places secrets hide: scanning source code, checking CI/CD pipelines, and auditing cloud resources. Tools fall into a few categories: open-source scanners for code and Git history such as Gitleaks, TruffleHog, and detect-secrets; platform features such as GitHub secret scanning and push protection; commercial secrets detection platforms; and cloud posture tools or provider APIs for inventory. Akeyless’s explainer on what secrets scanning is and how it works covers how these scanners work.
Once the findings arrive, rank them by risk instead of working through them in the order found:
| Priority Factor | Question to Ask | Why It Matters |
| Validity | Is the credential still live? | A dead credential is a cleanup task; a live one is an open door. Scanners such as TruffleHog can check validity (its –only-verified flag reports only verified findings). |
| Privilege | What can it do: admin, write, or read-only? | An admin key outranks a read-only key for the same exposure. |
| Visibility | Who can see it: the public, all employees, or one team? | A public repository outranks an internal one, and both outrank a private notebook. |
| Reach | What does it connect to: production data or a test sandbox? | Production access sets the potential damage. |
| Age | How long has it existed without rotation? | Old, unrotated credentials are the ones most likely to be forgotten and still valid. |
Automated Source Code Scanning
Scanners use two main techniques. Regex detectors match the fixed shape of known credentials, such as the AKIA prefix on AWS access key IDs. Entropy detectors flag long, random-looking strings that resemble generated keys. Regex is precise on known formats and blind to everything else, and entropy catches more but produces more false positives, so most tools combine both.
The cheapest place to catch a secret is before it leaves the developer’s machine. Gitleaks documents a pre-commit setup that blocks a commit containing a secret:
| # .pre-commit-config.yaml repos: – repo: https://github.com/gitleaks/gitleaks rev: <latest tag> # run `pre-commit autoupdate` to refresh hooks: – id: gitleaks # then: pre-commit install |
Hooks can be skipped (Gitleaks documents a SKIP environment variable), so back them with a CI scan. To keep alerts manageable, create a baseline so old, reviewed findings stay quiet and only new ones surface. Gitleaks and detect-secrets both support baselines. Triage verified-live credentials first, and allowlist test fixtures with a comment explaining why.
Continuous CI/CD Pipeline Checks
Add a scanner job to the build stage so every pull request is checked, even when a developer skipped the local hook. Scan the diff on each run for speed, and run a full-history scan on a schedule to catch what predates the hook. Akeyless’s post on the hidden risks of secrets in CI/CD pipelines covers why pipelines deserve this attention.
Blocking versus warning. Start in warning mode for low-confidence rules, and block on high-confidence matches and verified-live credentials. Promote rules from warn to block as their false positive rate falls. A scanner that blocks builds on noise gets switched off.
Send scan results to a central log store or SIEM so audits can show what was found, who triaged it, and when it was revoked. Give the scanner job itself a short-lived credential, since a build runner with a standing key becomes the next place to find one. Code and pipelines are only part of the picture, though, because many keys never touch a repository.
Cloud Resource Inventory Audits
Access keys created in a cloud console and never committed to code are invisible to a code scanner. Use a cloud security posture management (CSPM) tool or the provider’s own APIs to list long-lived credentials. On AWS, the IAM credential report lists every user and the status of their credentials, and the CLI shows when a given key was last used:
| aws iam generate-credential-report aws iam get-credential-report # returns the report as base64-encoded CSV aws iam get-access-key-last-used –access-key-id <key id> |
AWS notes that access keys that have not been used recently are good candidates for removal. IAM Access Analyzer’s unused access findings go further by reporting unused roles, unused access keys, and unused permissions across an organization, and that is how you flag an over-privileged token: an administrator-level key that has not touched most of the permissions it holds is a scoping problem. Unused access analysis is a paid feature billed by the number of roles and users analyzed.
Run the audit on a schedule, weekly for production accounts, and decide in advance what happens to a stale key. A common policy is to deactivate keys unused beyond a set window, such as 90 days, and delete them after a grace period. Every long-lived key the audit turns up is also a candidate for replacement with a short-lived credential, which the prevention section covers.
How to Prevent Secret Sprawl
Prevention has three goals: fewer places where a secret can live, shorter lives for the secrets that remain, and a smaller reach for any one that leaks. The return is concrete. IBM’s 2026 research, as summarized by Baker Donelson, found that breaches with lifecycles over 200 days cost an average of $5.65 million, against $4.32 million for breaches contained sooner. Every secret you retire or shorten reduces the time an attacker can use it.
Four tactics work best in combination: centralizing secrets, issuing dynamic credentials, enforcing least privilege, and improving developer workflows. The detection steps above feed them, since what scanning finds becomes the backlog for these tactics, and what these tactics remove stops appearing in scans.
Centralize Secrets in a Managed Vault
Moving unmanaged secrets into one governed store is the right first move. A single source of truth gives you policy enforcement over who can read what, encryption, and an audit trail that answers who accessed which secret and when. HashiCorp’s explainer on secret sprawl calls centralization the first-level answer, and it is a fair one. Centralization is a first step, though. A vault that holds the same long-lived keys has moved the sprawl into one place without shrinking it.
The end state is fewer persistent secrets. When a workload proves who it is through identity, such as a cloud IAM role or a Kubernetes service account, and receives short-lived access, there is less to store, leak, and rotate. Akeyless’s guide to secretless adoption principles describes that direction.
Self-hosted versus SaaS. Self-hosting gives you control and costs engineering time. HashiCorp’s reference architecture for Vault with integrated storage recommends five nodes across three availability zones, and replication across regions links separate clusters and requires an Enterprise license or HCP Vault Dedicated. A SaaS-delivered platform removes cluster operations and adds a vendor to the trust chain, so ask how the vendor protects your keys and whether it can read them.
Use Dynamic, Short-Lived Credentials
A dynamic secret is a credential generated on demand for one requester and one task, with a time to live (TTL) after which it expires. Static secrets sit valid until someone remembers to rotate them. Dynamic ones expire on their own, which is why they undercut sprawl: there is no long-lived copy worth stealing, and nothing to hunt down later.
Here is how just-in-time database credential issuance works with Akeyless, per its database dynamic secrets documentation:
- The service authenticates with its own identity, such as a Kubernetes service account or a cloud IAM role, rather than a stored password.
- The service requests the credential, for example with akeyless dynamic-secret get-value –name /prod/orders-db.
- The platform connects to the database through the Gateway and creates a temporary, restricted account with the databases, tables, and permissions you defined and the TTL you set.
- The application connects with that account, and when the TTL ends the account is revoked using the revocation statements you configured.
The potential damage shrinks in three ways: the credential belongs to one workload, it can reach only what its permissions allow, and it stops working in minutes or hours. The same pattern applies to cloud access. Akeyless’s AWS dynamic secrets can issue a temporary IAM user or an assumed-role session instead of a static access key. See the explainers on dynamic secrets and just-in-time credentials, and the post on zero standing privileges for the principle behind them.
Enforce Least-Privilege Access
Least privilege has to apply across identities (human and non-human), resources, actions, and credentials, not only to who can open a vault entry. Scoping each dimension limits what one leaked credential can do:
| Dimension | Typical Sprawl | Scoped |
| Identity | One shared CI token used by every pipeline | One identity per pipeline or workload |
| Resource | Access to every secret under /prod | Access to /prod/orders/db only |
| Action | Read, write, and delete | Read only, unless the job rotates the secret |
| Credential | Static, no expiry | TTL measured in minutes or hours |
Review access on a schedule. Check who and what can read each secret at a fixed cadence and remove what is unused. The same Access Analyzer-style reports used in the detection section help, and so does an owner field on every secret so reviews have someone to ask.
Compliance drivers. Least privilege is an explicit control in major frameworks: NIST SP 800-53 Rev. 5 (AC-6) requires allowing only the access necessary to accomplish assigned tasks, and PCI DSS v4.0 Requirement 7 restricts access by business need to know, including periodic reviews of accounts and privileges. SOC 2 access controls (CC6.1 and CC6.3) cover similar ground. Scoped secrets and audit logs produce the evidence auditors ask for.
Improve Developer Workflows & Training
Developers hardcode secrets when the safe route is slower than the unsafe one. Make the safe route the default:
- Pre-commit hooks: install the scanner hook shown above in every repository template, so the check is on from the first commit.
- Secret-free boilerplates: project templates that read configuration from the environment at runtime and ship an example config file with variable names and no values.
- Onboarding on secret hygiene: a short module covering why static keys leak, how to get a credential from the approved tool, and what to do after a leak (revoke first, then clean up history).
Measure whether it works. Track secrets caught per 1,000 commits in pre-commit and CI scans, along with the median time from detection to revocation, and compare the quarter before training with the quarter after. A falling catch rate in CI alongside a steady or rising catch rate at pre-commit means developers are fixing problems earlier. For API keys specifically, see Akeyless’s guide to API key risks and best practices.
The Problem with Traditional Vaults
A self-hosted vault solves the storage problem and creates an operations problem. The costs that rarely appear in a purchase decision include:
- Infrastructure: a production-grade cluster is five nodes across three availability zones in HashiCorp’s reference architecture, plus a second cluster in any region that needs replication.
- Licensing: replication across clusters requires an Enterprise license or a hosted dedicated cluster.
- Upgrades: teams follow the vendor’s lifecycle calendar, and Vault’s documentation says operators must move to the latest fix release within a major release to receive updates.
- People: someone has to own backups, unsealing, capacity, and upgrades, and that someone is not working on product.
Akeyless’s customers describe the difference in their own numbers, which are vendor-published and worth testing against your own environment. Cimpress reported a 70% cost reduction and 270% higher adoption against its previous secrets solution, which it had found costly in licensing and infrastructure.
Fragmented tooling can create new sprawl. GitGuardian and CyberArk’s 2024 Voice of Practitioners survey of 1,000 IT decision-makers found organizations maintain an average of 6 distinct secrets manager instances. A vault added for a team or a cloud brings its own policies, audit logs, and rotation schedules, so the tool bought to cure sprawl becomes the next pocket of it. Akeyless’s post on streamlining secrets management across platforms covers the cross-vault side of the problem.
How Secrets Management Addresses Secret Sprawl
Akeyless approaches secret sprawl by shrinking what exists to be scattered, not only by storing it better. The platform protects keys with Distributed Fragments Cryptography (DFC): key material is split into fragments that are never assembled in one place, and the customer holds one of them, so the platform operator cannot reconstruct the keys. The DFC recap stops there, since the rest of the approach does the work against sprawl.
| Risk Bucket | What Shrinks It | Akeyless Capability |
| Exposure | Fewer static secrets to expose, and one governed inventory | Multi-Vault Governance, delivered through the Universal Secrets Connector, governs secrets already stored in AWS, Azure, GCP, and Kubernetes without copying them |
| Abuse | Credentials that are short-lived and scoped to one identity | Just-in-time credentials, role-based access control, and authentication through existing cloud and Kubernetes identity |
| Reach | Expiry, rotation, and a record of every access | Dynamic secrets with TTLs, automated rotation, and audit logs that can be forwarded to a SIEM |
Migration does not have to start with moving secrets. The Universal Secrets Connector lets teams govern secrets where they already sit. A phased plan looks like this (illustrative, not customer data, and every environment differs):
| Phase | Timing | Work |
| 1. Inventory | Week 1 | Connect existing secret stores, run scanners, and build one list of what exists and who owns it |
| 2. Contain | Weeks 2 to 4 | Rotate the highest-risk secrets first (verified-live, high-privilege), and move one pipeline to dynamic credentials |
| 3. Replace | Weeks 5 to 8 | Extend dynamic or identity-based access to remaining workloads, and set the access review cadence |
| 4. Retire | Ongoing | Delete static secrets as workloads stop using them, and track the count as a metric |
Progress Software, a global software company operating in 16 countries, adopted Akeyless to fight secrets sprawl across a multi-cloud environment inherited through acquisitions. Richard Barretto, Chief Information Security Officer and VP at Progress, said in the Progress case study: “Akeyless is true SaaS that allows you to scale. It’s purpose-built to live in the cloud. We saved 70% of our maintenance and provisioning time with Akeyless.”
| See It Against Your Own Sprawl Want to see how inventory, dynamic credentials, and audit logs work on your environment? Schedule an Akeyless demo, or start with the secrets management platform overview. |
FAQs
What Causes Secret Sprawl?
Fast CI/CD cycles, decentralized repositories and cloud accounts, and the lack of a central inventory let credentials be copied faster than anyone tracks them. See “What Is Secret Sprawl?” above for the full definition.
How Does Secret Sprawl Differ from Hard-Coded Secrets?
A hard-coded secret is one credential written into code, and it is one symptom. Secret sprawl is the systemic spread of credentials across code, pipelines, cloud accounts, and chat tools with no inventory or lifecycle, as the definition section explains.
Which Tools Can Help Detect Secret Sprawl Quickly?
Use three categories together: pre-commit scanners such as Gitleaks or detect-secrets, CI and Git history scanners such as TruffleHog, and cloud inventory tools such as AWS IAM credential reports or a CSPM platform. Together they cover places that no single one can see.
Is Secret Sprawl Only a DevOps Problem?
No. Roughly one in four leaks starts outside code repositories, in tools such as Slack and Jira that every team uses. Security teams own the risk, and compliance teams need the access-control evidence that scoped, audited secrets provide.
How Can Small Teams Prevent Secret Sprawl Without Large Budgets?
Run an open-source scanner such as Gitleaks as a pre-commit hook and in CI, turn on GitHub secret scanning where it is available, and adopt one rule: no credential lives in a repository. A secrets manager with a free plan, and short TTLs on anything it issues, cost little (check the vendor’s pricing page for current free plan limits).
References
1. GitGuardian, “The State of Secrets Sprawl 2026” (March 17, 2026)
2. Meli, McNiece, and Reaves, “How Bad Can It Git? Characterizing Secret Leakage in Public GitHub Repositories,” NDSS Symposium (February 24 to 27, 2019)
3. Verizon, “2026 Data Breach Investigations Report” (May 19, 2026)
4. GitGuardian, “Initial Access Changed. The Attack Path Did Not” (analysis of the Verizon 2026 DBIR) (May 2026)
5. IBM, “Cost of a Data Breach Report 2026” (July 29, 2026)
6. SecureWorld, “2026 Cost of a Data Breach Report: AI Wreaks Havoc on Budgets” (July 2026)
7. Baker Donelson, “Ten Takeaways from IBM’s 2026 Cost of a Data Breach Report” (August 2026)
9. KrebsOnSecurity, “CISA Admin Leaked AWS GovCloud Keys on Github” (May 18, 2026)
10. KrebsOnSecurity, “Lawmakers Demand Answers as CISA Tries to Contain Data Leak” (May 22, 2026)
11. CyberArk, “Unpacking the Uber Breach” (September 20, 2022)
12. GitGuardian, “Uber Breach 2022: Everything You Need to Know” (September 2022)
13. CircleCI, “CircleCI Incident Report for January 4, 2023 Security Incident” (January 13, 2023)
14. Entro Security, “NHI & Secrets Risk Report H1 2025” (July 23, 2025)
15. Silverfort and Osterman Research, “The State of the Identity Attack Surface” (September 6, 2023)
16. Akeyless, “The 2024 State of Secrets Management Survey Report” (November 2023)
17. GitGuardian and CyberArk, “Voice of Practitioners 2024” (October 30, 2024)
18. Gitleaks documentation (pre-commit and baseline usage) .
19. TruffleHog and detect-secrets repositories .
20. GitHub Docs, “About Secret Scanning” .
21. AWS IAM User Guide, “Find Unused AWS Credentials” .
22. AWS Security Blog, “IAM Access Analyzer Simplifies Inspection of Unused Access in Your Organization” (December 2023)
23. HashiCorp, “What Is Secret Sprawl and Why Is It Harmful?” .
24. HashiCorp Developer, “Vault with Integrated Storage Reference Architecture” .
25. Akeyless Docs, “Database Dynamic Secrets” .
26. Akeyless, “Progress Case Study” and “Cimpress Case Study” .