Secrets management
Secrets management is the practice of keeping the credentials software uses to authenticate (API keys, tokens, passwords, private keys) out of reach, and of limiting damage when one leaks. Secrets leak at scale: a peer-reviewed measurement found them in over 100,000 public GitHub repositories, with thousands of new ones each day (Meli et al., 2019). In honeypot tests, attackers used planted cloud keys within seconds to minutes (Toulas, 2026). The disputes are about how many detected strings are real secrets, how long leaked secrets stay usable, and whether scanning tools prevent leaks. On the last two, most figures come from security vendors.
Where secrets leak
Secrets leak wherever code and its build products are published: source repositories, container images, packages, apps and build logs (Meli et al., 2019; Dahlmanns et al., 2023; Kadkoda et al., 2022).
Code repositories
Public code hosting is the best-measured leak path. The 2019 GitHub study counted leaks in over 100,000 repositories, and most stayed online: just over 12% were gone after one day, and only 19% after 16 days (Meli et al., 2019). A vendor, GitGuardian, counted 12.8 million new secrets leaked on public GitHub in 2023, up 28% from the year before (Segura, 2024).
Leaks are common in developers’ own experience too. In a survey of 109 developers, 30.3% reported first-hand experience of a secret leaking in their projects (Krause et al., 2022).
Container images, packages and apps Strong evidence: many studies agree on this
Later peer-reviewed measurements found secrets in other published artefacts at rates from 8.5% to 35%. In 2023, 8.5% of 337,171 Docker Hub images and images from private registries held secrets, including 52,107 private keys (Dahlmanns et al., 2023). Across GitHub, PyPI (the Python package index) and WeChat, up to 30% of projects were at risk of leaking secrets (Zhou et al., 2025c). In 50,000 Android apps from 2025, detection found secrets in 35%, and 1,802 of 18,908 detected secrets were still active (Alecci et al., 2026).
Leaked keys from images were in real use. The same container study found 275,269 servers using leaked private keys for TLS and SSH authentication (Dahlmanns et al., 2023).
Build logs Weak evidence: few or small studies support this
Build logs from continuous integration (CI), the services that build and test code on each change, have leaked secrets, but the measurements come from security vendors, not peer-reviewed studies. In 2022, Aqua Security found about 73,000 tokens, secrets and credentials in a sample of roughly 8 million public Travis CI log requests (Kadkoda et al., 2022). Travis CI masked a GitHub token in many cases but missed about 20 variations of it, and told the researchers that old logs were exposed by design (Kadkoda et al., 2022).
Provider changes then cut live leaks sharply. Travis CI began expiring logs older than 365 days in 2022 and started censoring secrets in logs with scanning tools in January 2023 (Rahal, 2023). A re-scan of about 4.7 million logs in 2023 found 80 unique live secrets, most likely from users who had switched off the default masking (Rahal, 2023).
Masking in logs has gaps on other platforms too. GitHub’s documentation warns that secrets printed in logs are not redacted when its workaround for large secrets is used (GitHub, n.d.e). In 2025, a compromised third-party GitHub Action (a reusable build step), tj-actions, disclosed secrets including valid access keys (CISA, 2025). Such attacks through shared build components are covered under software supply chain security.
How many detected secrets are real
The share of detected strings that are real secrets depends on how strictly they are filtered. In SecretBench, a dataset hand-labelled by two raters, only 15,084 of 97,479 candidate secrets from 818 public GitHub repositories were true secrets, about 15.5% (Basak et al., 2023b). The 2019 GitHub study used strict filters, and its manual review of 240 random hits estimated that 89.10% were sensitive rather than test or dummy keys (Meli et al., 2019).
The strict figure covers a narrow slice of secrets. That study looked only at private key files and 11 platforms whose API keys have distinctive formats (Meli et al., 2019). Its filters also passed some keys that were valid but harmless, such as an RSA key in a unit test of a cryptographic library (Meli et al., 2019).
Detection tools disagree widely on what they report. In one comparison on public repositories, GitHub’s secret scanner had the best precision, the share of its warnings that were real secrets, at 75% (Basak et al., 2023a). Gitleaks had the best recall, the share of real secrets it found, at 86% and 88% in two test cases (Basak et al., 2023a).
How fast leaked secrets are abused Weak evidence: few or small studies support this
Attackers can find and use exposed cloud keys within minutes, but the figures rest on a few honeypot experiments, where researchers plant a working key and watch for its use. A GitHub honeypot with a dummy Amazon Web Services (AWS) key was found and abused within about one minute (Bischoff, 2020). In a study of Docker Hub images, the fastest use of a planted AWS key came 7.86 seconds after publication. All 100 planted keys were used within 15 minutes (Toulas, 2026).
How long leaked secrets stay valid Weak evidence: few or small studies support this
According to vendor measurements, most leaked secrets remain usable for weeks or years. Truffle Security tracked 10,000 leaked secrets and found 74% still valid 31 days after the leak (Leon, 2024). GitGuardian reports that over 90% of exposed secrets were still active five days after the leak (Segura, 2024). In a later snapshot of public code, Truffle found 543,699 unique credentials still valid, with a median exposure of 784 days (Truffle Security Research, 2026).
Deleting a leaked secret does not end the risk; revoking it does. In more than half of the cases where exposed keys were taken down from GitHub, the keys stayed valid (Leon, 2024). Where providers revoke their own leaked tokens, almost none survive: 1 of 101,886 committed npm tokens and 260 of 73,048 GitHub tokens were still live (Truffle Security Research, 2026). Truffle advises rotating a secret first and cleaning up the code history afterwards (Truffle Security Research, 2026).
Developers who leak a secret mostly replace it. In a survey of 109 developers, 54.1% of those who had leaked one renewed or revoked it, and 17.4% cleaned the version-control history (Krause et al., 2023).
Keeping secrets out of code
The usual advice is to keep secrets outside the code and add scanning as a second line of defence. The authors of a developer study recommend environment variables, vaults or secret managers, blocking secret files from repositories, and scanners, especially before each commit (Krause et al., 2023). In their survey, about half of developers kept secrets outside the code, and 29.4% blocked them from the repository, for example with a .gitignore file (Krause et al., 2023).
Secret managers, services that store secrets and hand them to applications at run time, are not easy to adopt. In a lab study, all 21 new users stored and read a secret with one within 30 minutes. Only 18 of 21 managed to inject it into an application (Neil et al., 2025).
Platform-level limits did not stop large-scale exposure in 2019. The GitHub study found that automatic leak detectors, requiring several secret values, and rate limits on GitHub search all failed to limit it (Meli et al., 2019).
Secret scanning and push protection Weak evidence: few or small studies support this
Whether scanning reduces leaks is unsettled: the before-and-after figures come from vendors, and an independent study found developers often bypass warnings. Push protection blocks a commit that contains a recognised secret before it reaches the repository. GitHub reports that it stops about 30% of newly detected secrets before they enter repository history, counting additional secret types (Havens, 2026). After GitHub turned it on by default, Truffle Security found exposure of covered credential types fell 53%, against 7% for uncovered ones. It could not tie the drop to the rollout date (Truffle Security Research, 2026).
Reported bypass rates differ widely. GitHub reports that developers overrode 3.93% of push blocks in mid-2026, down from 6.63% two years earlier (Havens, 2026). In a peer-reviewed case study of one company’s blocking tool, developers bypassed warnings in 44.2% of cases once and in 7.2% permanently (Rahman et al., 2022).
False alarms explain only part of the bypassing. Those developers judged 50% of the warnings false positives, but also bypassed under time pressure, for projects that would not ship, and because they saw commits as low risk (Rahman et al., 2022). The authors recommend a second check to catch wrong bypasses (Rahman et al., 2022).
Few developers scan for secrets at all. In a survey, only 14.7% reported regular scanning, against 55.0% who kept secrets outside the code (Krause et al., 2022). The authors link the low uptake to false positives and manual review work, and interviewees said tools that change their workflow a lot slow them down and get bypassed (Krause et al., 2022).
Encryption at rest and key management
Encryption at rest mainly protects data on stolen disks and backups, not data in a running system; this rests on guidance and vendor documentation rather than measured outcomes. Microsoft describes the threat its database encryption (Transparent Data Encryption, TDE) addresses as theft of drives or backup tapes (Microsoft, 2025d). TDE decrypts data as it is read into memory and does not encrypt network traffic (Microsoft, 2025d). OWASP, a web security community, says the right layer of encryption depends on the threat: encrypting the disk protects against theft of the server, not against remote compromise (OWASP Cheat Sheet Series, n.d.a).
Encryption is only as strong as the separation of keys from data. OWASP advises storing keys apart from the encrypted data, so that an attacker who reaches one cannot reach both (OWASP Cheat Sheet Series, n.d.a). Envelope encryption puts this into practice. The application encrypts data with a data key it generates, a key management service encrypts (“wraps”) that key with a key that never leaves the service, and the wrapped key is stored beside the data (Google Cloud, 2026b).
Keys also bring a risk of their own. A TDE-protected backup can be restored only with the certificate that protects its key, so losing the certificate loses the data (Microsoft, 2025d). OWASP states that the best protection for sensitive information is not to store it (OWASP Cheat Sheet Series, n.d.a).
Encryption also changes legal duties after a breach. Under the EU’s General Data Protection Regulation (GDPR), a controller need not tell people about a breach if encryption or similar measures made the data unintelligible to outsiders (European Union, 2016a). What causes breaches in the first place is covered under data breaches; misuse of cryptographic libraries in code is covered under secure software development.
Further reading
- Meli et al. (2019): the peer-reviewed measurement of secret leakage on public GitHub, with its estimate of how many detected secrets are sensitive.
- Krause et al. (2023): a survey and interview study of how developers prevent and clean up leaked secrets.
- Rahman et al. (2022): an industrial case study of why developers bypass a push-blocking secret scanner.
- Dahlmanns et al. (2023): an internet-wide study of secrets in container images and the servers that use leaked keys.
- Truffle Security Research (2026): a vendor analysis of credentials left valid in public code, of provider revocation and of GitHub push protection.
- OWASP Cheat Sheet Series (n.d.a): OWASP guidance on choosing an encryption layer and storing keys.
First published .
Known gaps
What this article cannot tell you yet.
- The effect of GitHub push protection on leaks was measured only by vendors (GitHub and Truffle Security); no independent before-and-after study of secret scanning was found.
- No peer-reviewed measurement of secrets in CI build logs was found, and how often GitHub Actions logs expose secrets was not measured.
- No critique of whether honeypot abuse speeds represent real leaks was found; the speed figures rest on a few single experiments.
- No empirical study of how server applications manage encryption keys, or of breaches where encryption at rest made a difference, was found.
- The effect of short-lived credentials on leaks and abuse was not researched.
References
- Solid source
- Rated highly trustworthy by the research, and every passage taken from it was found in it.
- Weak source
- Rated low, or a passage taken from it was not found in it.
- Medium trust
- Rated medium by the research.
- Not checked
- Rated high, but its passages could not all be checked against it.
Show all 24 references
- Alecci, M., Samhi, J., Bissyande, T. F., & Klein, J. (2026). Secrets unlocked: Evaluating LLMs for secrets detection in Android apps. ACM. https://doi.org/10.1145/3832140 Medium trust Peer-reviewed, abstract only.
- Basak, S. K., Cox, J., Reaves, B., & Williams, L. (2023a). A comparative study of software secrets reporting by secret detection tools. arXiv 2307.00714 (preprint). https://arxiv.org/abs/2307.00714 Medium trust Preprint, read in full.
- Basak, S. K., Neil, L., Reaves, B., & Williams, L. (2023b). SecretBench: A dataset of software secrets. MSR 2023 Data and Tool Showcase (arXiv 2303.06729). https://arxiv.org/abs/2303.06729 Medium trust Preprint, read in large part.
- Bischoff, P. (2020). AWS credentials found on GitHub and abused within 1 minute. Comparitech. https://comparitech.com/blog/information-security/github-honeypot Medium trust Blog post, read in full.
- CISA (2025). Supply chain compromise of third-party GitHub Action, CVE-2025-30066. Cybersecurity and Infrastructure Security Agency. https://www.cisa.gov/news-events/alerts/2025/03/18/supply-chain-compromise-third-party-github-action-cve-2025-30066 Medium trust Government report, read in large part.
- Dahlmanns, M., Sander, C., Decker, R., & Wehrle, K. (2023). Secrets revealed in container images: An internet-wide study on occurrence and impact. ACM AsiaCCS 2023. https://arxiv.org/abs/2307.03958 Solid source Peer-reviewed, abstract only.
- European Union (2016a). Art. 34 GDPR, Communication of a personal data breach to the data subject. Regulation (EU) 2016/679. https://gdpr-info.eu/art-34-gdpr/ Medium trust Documentation, read in full.
- GitHub (n.d.e). Using secrets in GitHub Actions. GitHub Docs. https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions Weak source Documentation, read in large part. A passage taken from it was not found in it.
- Google Cloud (2026b). Envelope encryption. Google Cloud Documentation, Cloud Key Management Service. https://docs.cloud.google.com/kms/docs/data-encryption-keys Solid source Documentation, read in full.
- Havens, E. (2026). Secret protection must scale with software. The GitHub Blog. https://github.blog/ai-and-ml/github-copilot/secret-protection-must-scale-with-software/ Weak source Vendor page, read in full.
- Kadkoda, Y., Goldman, I., Morag, A., & Itach, O. (2022). Travis CI security: Thousands of secrets exposed in public Travis CI logs. Aqua Security blog. https://www.aquasec.com/blog/travis-ci-security/ Medium trust Vendor page, read in large part.
- Krause, A., Klemmer, J. H., Huaman, N., Wermke, D., Acar, Y., & Fahl, S. (2022). Committed by accident: Studying prevention and remediation strategies against secret leakage in source code repositories. arXiv 2211.06213 (preprint). https://ar5iv.labs.arxiv.org/html/2211.06213 Medium trust Preprint, read in full.
- Krause, A., Klemmer, J. H., Huaman, N., Wermke, D., Acar, Y., & Fahl, S. (2023). Pushed by accident: A mixed-methods study on strategies of handling secret information in source code repositories. USENIX Security 2023. https://www.usenix.org/conference/usenixsecurity23/presentation/krause Medium trust Peer-reviewed, read in large part.
- Leon, J. (2024). Most publicly leaked keys are never revoked. Truffle Security. https://trufflesecurity.com/blog/most-publicly-leaked-keys-are-never-revoked Medium trust Vendor page, read in full.
- Meli, M., McNiece, M. R., & Reaves, B. (2019). How bad can it git? Characterizing secret leakage in public GitHub repositories. NDSS Symposium 2019. https://www.ndss-symposium.org/ndss-paper/how-bad-can-it-git-characterizing-secret-leakage-in-public-github-repositories Solid source Peer-reviewed, read in large part.
- Microsoft (2025d). Transparent data encryption (TDE), SQL Server. Microsoft Learn. https://learn.microsoft.com/en-us/sql/relational-databases/security/encryption/transparent-data-encryption?view=sql-server-ver16 Solid source Documentation, read in full.
- Neil, L., Mungara, D., Williams, L., Acar, Y., & Reaves, B. (2025). It should be easy but... New users' experiences and challenges with secret management tools. ACM CCS 2025 (extended version, arXiv 2509.09036). https://arxiv.org/html/2509.09036v1 Medium trust Preprint, read in full.
- OWASP Cheat Sheet Series (n.d.a). Cryptographic storage cheat sheet. OWASP. https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html Medium trust Documentation, read in full.
- Rahal, K. (2023). Does Travis CI leak secrets in 2023? Truffle Security blog. https://trufflesecurity.com/blog/travis-leaking-secrets-in-2023 Medium trust Vendor page, read in large part.
- Rahman, M. R., Imtiaz, N., Storey, M., & Williams, L. (2022). Why secret detection tools are not enough: It is not just about false positives. An industrial case study. Empirical Software Engineering, 27(3), 59. https://pmc.ncbi.nlm.nih.gov/articles/PMC8928718 Medium trust Peer-reviewed, read in full.
- Segura, T. (2024). The state of secrets sprawl 2024. GitGuardian blog. https://blog.gitguardian.com/the-state-of-secrets-sprawl-2024/ Weak source Vendor page, read in full.
- Toulas, B. (2026). Cloud keys leaked in Docker Hub images are stolen within seconds. BleepingComputer. https://bleepingcomputer.com/news/security/cloud-keys-leaked-in-docker-hub-images-are-stolen-within-seconds Medium trust News article, read in full.
- Truffle Security Research (2026). GitHub repos exposed 543,699 credentials. Nobody revoked them.. Truffle Security. https://trufflesecurity.com/blog/github-repos-exposed-543699-credentials-nobody-revoked-them Medium trust Blog post, read in full.
- Zhou, J., Zhang, Z., Ying, L., et al. (2025c). Hey, your secrets leaked! Detecting and characterizing secret leakage in the wild. IEEE Symposium on Security and Privacy 2025. https://doi.org/10.1109/sp61157.2025.00122 Medium trust Peer-reviewed, abstract only.