All articles

DevSecOps · 22 October 2026 · 5 min read

Secrets management for small teams: getting passwords and API keys out of Git and .env files

Almost every small codebase we review has the same secret history: a database password in a .env file, an API key pasted into a CI variable two years ago by someone who has since left, and at least one token that was committed to Git “just for a minute”. None of this feels urgent until a laptop is stolen, a repository is made public by mistake, or a former contractor still has working credentials. This article is about fixing that without buying an enterprise platform.

What counts as a secret

A secret is anything that grants access on its own: database passwords, API keys, SMTP credentials, cloud access keys, SSH private keys, OAuth client secrets, webhook signing keys, session encryption keys (for WordPress, the salts in wp-config.php) and TLS private keys. A server IP address or a username is not a secret. Treating everything as secret makes people stop taking the real ones seriously.

Where secrets actually leak

The first rule: a leaked secret is rotated, not hidden

When a secret leaks, the only real fix is to issue a new one and revoke the old one. Deleting the commit, making the repository private again or editing the chat message does not undo the exposure. Automated scanners watch public GitHub repositories and can find a new AWS key within minutes. So the first thing to design is not storage but rotation: for every secret, you should know who can issue a new one, which systems use it and how long a change takes.

A practical maturity path

Level 1: stop new leaks

Level 2: encrypted secrets in the repository

For small teams, SOPS with age keys is often the sweet spot. Secrets stay in Git, but encrypted, so changes are reviewed like code, and each server or CI runner gets its own key to decrypt them.

# .sops.yaml
creation_rules:
  - path_regex: secrets/prod.yaml$
    age: age1prodserverkey...,age1adminkey...

sops --encrypt --in-place secrets/prod.yaml

Removing a person means removing their key and re-encrypting, plus rotating whatever they could read. That last part is easy to forget.

Level 3: a secret manager

When you run on one cloud, its native service (AWS Secrets Manager or SSM Parameter Store, Azure Key Vault, Google Secret Manager) is usually the simplest choice: access is controlled by the same identity system as everything else, and every read is logged. HashiCorp Vault or OpenBao make sense when you are multi-cloud or need dynamic secrets, but they are a service you must run, back up and patch. We do not recommend self-hosting Vault for a team without someone who owns it.

Level 4: no long-lived secrets at all

The best secret is one that does not exist. CI pipelines can authenticate to AWS, Azure and Google Cloud with OIDC federation and short-lived tokens instead of stored access keys. Servers can use instance roles or managed identities. Databases can issue temporary credentials. Each long-lived key you replace is one less thing to rotate.

How applications should receive secrets

Rotation that actually happens

Rotation policies fail when they depend on memory. What works:

  1. Keep an inventory: secret, owner, where it is used, how to rotate, last rotated.
  2. Rotate on events, not only on a calendar: when someone leaves, when a supplier changes, after any suspected leak.
  3. Support two valid credentials during a change, so you can roll out the new one before revoking the old one without downtime.
  4. Practise once on a low-risk secret. The first real rotation should not be during an incident.

Our take

For most teams of 2 to 20 developers, the right answer is boring: secret scanning in CI, SOPS or the cloud provider’s secret manager, OIDC for pipelines, and a one-page rotation inventory. A full vault platform is rarely the missing piece. The missing piece is almost always an owner and a habit of rotating after people leave.

Need a second pair of eyes?

We review repositories and pipelines for leaked and long-lived credentials as part of our DevOps plans. Start with the free IT audit or see the pricing.

More articles

Websites · 2 min readWordPress maintenance checklist: what to do weekly, monthly and quarterlyA practical WordPress maintenance schedule for business websites: safe updates, backups, security, speed and the checks that catch problems before your customers do.Read the articleInfrastructure · 3 min readMoving company email to Microsoft 365 or Google Workspace without losing mailA practical plan for moving a small company’s email from hosting or an old server to Microsoft 365 or Google Workspace: preparation, DNS, migration of old mail and the cutover day.Read the articleHelpdesk · 2 min readEmployee onboarding and offboarding: the IT checklist that prevents data leaksStep-by-step IT checklists for new hires and leavers: accounts, licenses, devices, access rights and the offboarding steps most small companies forget.Read the article