---

What "leaked" means here

A secret leaks the moment it lands somewhere it was never meant to be read: a public or internal git repo, a Slack thread, a CI log, a screenshot, or a fork. The .env file is the usual culprit because it holds the keys that let your app talk to Stripe, AWS, OpenAI, and the rest. Once a secret is in a place scanners can reach, assume it is compromised.

How secrets actually leak

  • Git history — a .env committed once lives forever in history, even after you delete the file.
  • Chat and tickets — pasting a key "just to debug" puts it in searchable logs.
  • CI / build logs — verbose builds print env vars; forks and public runners expose them.
  • Demo and seed files — "example" keys that look real get shipped and scanned anyway.

Why it matters fast

Credential-harvesting bots crawl GitHub and paste sites continuously. A live key pushed on Monday is often abused by Tuesday. The cost is not theoretical: Verizon's Data Breach Investigations Report consistently shows credentials as a top breach vector, and the remediation is far cheaper than the incident.

What to do first

Rotate the exposed credential immediately, purge it from history where you can (e.g., with a history-rewrite or by rotating so the old value is dead), and move secrets into a manager or environment injection. A scanner like EnvLens tells you what is exposed and what to rotate; it does not rotate for you.

Authoritative references

  • OWASP Secrets Management Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html
  • CWE-798 (Hard-coded credentials): https://cwe.mitre.org/data/definitions/798.html
  • CWE-259 (Use of hard-coded password): https://cwe.mitre.org/data/definitions/259.html