Cloud & Security · SaaS & Startups

Secrets Management for Startups: A Practical Guide for 2026

How startups leak API keys and passwords, and the vault, scanning, rotation and CI/CD habits that stop it.

XDQ Editors10 Nov 2026 · 10 min read
Keys Padlocks

Leaked credentials are one of the cheapest ways into a startup. GitGuardian counted 23.8 million secrets leaked on public GitHub in 2024, up 25% on the year before, and found that 70% of secrets leaked in 2022 were still valid. This guide explains where secrets leak, what the OWASP Secrets Management Cheat Sheet recommends, and how a small team can put a working system in place quickly.

23.8 million
Secrets leaked on public GitHub in 2024
Source: GitGuardian
70%
Secrets leaked in 2022 that were still valid in 2025
Source: GitGuardian
35%
Private repositories found to contain secrets
Source: GitGuardian
USD 19
GitHub Secret Protection per active committer per month
Source: GitHub Changelog

What counts as a secret

A secret is any value that grants access: database passwords, cloud access keys, API tokens for payment or messaging providers, signing keys, webhook secrets and OAuth client secrets. GitGuardian's 2025 report found that generic secrets, such as hardcoded passwords and custom tokens without a known pattern, made up 58% of leaked credentials. That matters because pattern-based scanners catch those least well. Startups accumulate secrets fast. Every new integration, environment and contractor adds more, and few teams keep a list of what exists, who can read it and when it was last rotated.

Where startup secrets actually leak

Public repositories get the headlines, but GitGuardian's data shows private systems are often worse. The figures below come from its 2025 report, which analysed 1.4 billion commits. The pattern is clear: secrets spread wherever engineers work, including tickets, chat and container images, so scanning only new code misses much of the exposure.

LocationFindingWhat to do
Public GitHub4.6% of public repositories contain a secretPush protection and pre-commit scanning
Private repositories35% contain secrets; AWS IAM keys appear in 8%Scan full history, not just new commits
Commit authors15% of commit authors leaked a secretDeveloper training and IDE checks
Slack2.4% of corporate channels contained secretsShare access, never values, in chat
Jira6.1% of tickets exposed credentialsScan and clean ticket systems
Docker Hub images98% of detected secrets were in image layersNever bake secrets into images

Centralise secrets in one managed store

The OWASP Secrets Management Cheat Sheet's first recommendation is to standardise on a central secrets manager, so secrets stop living in code, config files and chat. A cloud provider's managed secrets service is usually the easiest choice for a startup already on that cloud; a dedicated vault suits multi-cloud teams.

Separate production and development stores, scope access to individual secrets rather than whole folders, and document what each secret is for. OWASP also notes that engineers should not be able to read every secret: most should deploy code that reads secrets at runtime without ever seeing the values.

Prefer short-lived credentials over static keys

A key that expires in an hour is far less useful to an attacker than one that lasts for years, which is why the 70% still-valid figure is so worrying. OWASP recommends dynamic, short-lived credentials where possible, with expiry dates on everything else.

For CI/CD, both OWASP and GitHub recommend OpenID Connect federation instead of storing long-lived cloud keys as pipeline secrets. The pipeline proves its identity to the cloud provider and receives a temporary token scoped to that job. For services, have them fetch their own secrets at runtime rather than passing values through the pipeline.

Scan before and after commit

Detection works best at several points. OWASP recommends scanning in the IDE or with a pre-commit hook, so a secret never reaches the repository. GitHub push protection blocks pushes that contain recognised secrets; it is free for public repositories, and GitHub reported that developers blocked 17,000 potential leaks between the April 2022 beta and May 2023.

For private repositories, GitHub split Advanced Security in April 2025, making Secret Protection available on its own for USD 19 per active committer per month, including to Team plan customers. GitHub also offers a free secret risk assessment for Team and Enterprise organisations, a sensible first step before buying anything.

Containers, environment variables and logs

OWASP advises against putting secrets in Docker ENV or ARG instructions, because they persist in image definitions, and GitGuardian's Docker Hub finding shows how often that happens. Environment variables are common but visible to every process and can leak into crash dumps and logs. Mounted files from the orchestrator or a sidecar that fetches secrets into memory are safer. Never log secret values. GitHub's Actions guidance warns against storing JSON or YAML blobs as a single secret, because log redaction relies on exact matches, and recommends registering derived values such as encoded tokens as secrets too.

What to do when a secret leaks

Assume it will happen and write the steps down now. OWASP's incident guidance for leaked secrets is short and practical. Keep the runbook next to the code, name the person who can rotate each critical credential, and make sure at least two people know how to do it.

  • Revoke the exposed secret immediately; deleting the commit is not enough
  • Issue and deploy a replacement, ideally through automated rotation
  • Check provider logs for any use of the old credential
  • Remove the value from code history, tickets, chat and logs
  • Record who had access, when it was used and when it was rotated
  • Find the root cause and add a scanner or control that would catch it

A 30-day plan for a small team

Week one: list every secret and owner, and turn on push protection. Week two: run a full-history scan across repositories, tickets and chat, then rotate anything found. Week three: move production secrets into a managed store and switch CI to OIDC. Week four: add pre-commit hooks for every developer and write the leak runbook. XDQ Labs helps teams audit and fix secret handling on systems they own, as part of its authorised AI security engineering work.

Frequently asked questions

Is it safe to store secrets in environment variables?

It is better than hardcoding, but not ideal. OWASP notes environment variables are visible to all processes and can leak into logs or dumps. Prefer a secrets manager, with secrets mounted as files or fetched into memory at runtime, and never set them through Docker ENV or ARG.

What should I do if I pushed an API key to GitHub?

Revoke the key at the provider straight away, because removing the commit does not make it safe and copies may already exist. Issue a new key, check the provider's logs for misuse, then clean the history. GitGuardian found 70% of secrets leaked in 2022 were still valid years later.

Is GitHub push protection free?

Push protection is free for public repositories. For private repositories it is part of GitHub Secret Protection, sold since April 2025 at USD 19 per active committer per month and available to Team and Enterprise plans.

Do small startups really need a secrets manager?

Yes, once you have more than one environment or developer. Cloud providers offer managed secret stores that are quick to adopt. The bigger gains come from habits: no secrets in code, short-lived credentials, scoped access and a written plan for rotating a leaked key.

Sources

  1. The State of Secrets Sprawl 2025, GitGuardian, 2025
  2. Secrets Management Cheat Sheet, OWASP Cheat Sheet Series, 2025
  3. Secure use reference for GitHub Actions, GitHub Docs, 2026
  4. Push protection is generally available, and free for all public repositories, GitHub Blog, 2023
  5. Introducing GitHub Secret Protection and GitHub Code Security, GitHub Changelog, 2025
  6. Verizon 2025 Data Breach Investigations Report: news release, Verizon, 2025
  7. OWASP Top 10 CI/CD Security Risks, OWASP Foundation, 2022
Keep reading

Related research

Padlock Lock
Cloud & Security · 9 Nov 2026

Deepfake and AI Fraud Statistics 2026, and Defences for Businesses

What the FBI, IBM and Deloitte data says about deepfake and AI-enabled fraud, and the verification steps that stop it reaching your bank account.

XDQ Editors9 Nov 2026 · 10 min read
Cardboard Box
Cloud & Security · 10 Nov 2026

Website Security Checklist for Small Businesses (2026)

A practical, defensive checklist for keeping a small business website patched, encrypted, backed up and monitored, based on 2026 data.

XDQ Editors10 Nov 2026 · 11 min read
Keys Padlocks
Cloud & Security · 10 Nov 2026

DPDP Act 2023 for Startups: Obligations, Rules and Penalties (2026)

What India's DPDP Act and the 2025 Rules ask of startups, when each duty starts, and how the penalty schedule works.

XDQ Editors10 Nov 2026 · 11 min read
Next step

Want your cloud set up and secured properly from day one?

Send the workflow. Our sales experts reply with a scope and a custom quotation within two working days, or a straight answer that it isn't a fit.

Secure by default · find → fix → verify · authorised scope only
Send a brief →enquiry@xdqlabs.com