How it works · 34 of 38 Core

How should secrets and encryption keys be managed in the cloud?

Where the keys live

Secrets & key management: A secret, such as a password or an API key, should live in a secrets manager that hands it to the program at run time, logs every read and can change it on a schedule; a secret pasted into code is copied into every saved version and every copy anyone takes, so when one leaks the fix is to change it (rotate it), not to delete the line.

Loading the animation…

Say it like this A secret pasted into code is copied into every saved version and every copy anyone takes, so keep secrets in a secrets manager the program asks at run time, and when one leaks, change the lock: deleting the line fixes nothing.

Under the hood — for builders
Real case: Toyota's key, public for almost five years
A contractor pushed T-Connect code to public GitHub with a customer-data server key inside; 296,019 email addresses were reachable:
It's common
GitHub: "more than 39 million secrets were leaked across GitHub in 2024 alone".
Secret
Anything that grants access: a password, API key, token or private key.
Order of a leak response
Deleting the line doesn't help: Git keeps every past version in every clone.
Secrets manager
Stores secrets encrypted, hands them to allowed identities (E3) at run time and logs every read.
Better: no stored secret
Cloud workloads get short-lived credentials from their workload identity (E3): nothing to paste.
Watch out
Keys also leak through logs, error pages, CI output, container images and screenshots.
Sources
GitHub blog, "GitHub found 39M secret leaks in 2024" (1 Apr 2025) · Toyota T-Connect disclosure (Oct 2022) via TechCrunch and The Register (read November 2026).

What happens in the secrets & key management animation, step by step?

  1. A secret is anything that unlocks something: a database password, an API key. The quickest way to make code work is to paste it in. Every commit then saves a copy of that page in the code's history.
  2. Then the code goes somewhere others can see. A contractor put part of Toyota's T-Connect code on public GitHub in 2017 with a data-server key inside. It stayed there almost five years; 296,019 customers' email addresses were open to whoever found it.
  3. Your turn: the key has leaked. Which fix actually makes it safe: delete the line, make the code private, or change the lock so the old key stops working (rotate it)?
  4. Toyota made the code private as soon as it found it, and changed the key two days later. Only the change made every copy useless: assume anything that was public has been copied.
  5. So keep secrets out of code entirely. A secrets manager holds them; the program asks for the key when it runs, every request is logged, and the key can be changed on a schedule without touching the code.
  6. Keys guard the doors. But one wrong setting can leave a whole bucket open to everyone, with no key needed at all. Next: misconfiguration, the open bucket.

What everyday example explains secrets & key management?

A house key. Taping it under the doormat works until someone sees you do it (a key in the code); taking it out from under the mat doesn't help once a copy has been cut (deleting the line); the only fix is to change the lock (rotation); and the safe habit is a key box that opens only for the right people and records who took the key (a secrets manager).

Why should a team care about secrets & key management?

When you build anything that needs a secret, decide where it is stored (a secrets manager, or better, no secret at all through workload identity), who may read it, how it is rotated without a code change, and what scans stop one being committed; and write down that a leak means rotate first.