Where a Secret Lives and Where It Leaks¶
Run the Where a Secret Lives and Where It Leaks MicroSim Fullscreen
About This MicroSim¶
An API key can end up in ten places. Five are homes the owner controls: the vendor dashboard, the password vault, the hosting platform settings, the running server, and a local .env file that git ignores. Five are leak paths: git history, an email attachment, a chat message, the browser bundle, and a server log line.
The rule is simple. A place is a home if the owner controls every copy there and can name who can read it. A place is a leak path if a copy exists that the owner can't delete or can't list. That is why deleting your copy of a leaked key is never enough.
Solid arrows show the path a key should follow. Dashed arrows show how a key slips to a leak path. The stories on the arrows are illustrative.
How to Use¶
- Click a place in the diagram.
- Press Intended home or Leak path. You can change a mark until you press Check.
- When all ten places are marked, press Check. Marks lock.
- Each place now shows ✓ or ✗. Homes get a solid green border and leak paths a dashed red one.
- Click any place to read why it is a home or a leak.
You get one attempt. Nine of ten right on the first try shows you can classify the places.
Iframe Embed Code¶
You can add this MicroSim to any web page by adding this to your HTML:
<iframe src="https://arunbatchu.github.io/good-enough-engineering/sims/secret-homes-and-leaks/main.html"
height="644px"
width="100%"
scrolling="no"></iframe>
Lesson Plan¶
Learning Objective¶
The learner will classify each of ten places an API key can end up as either an intended home for the key or a leak path, and state for each leak path why deleting the copy there isn't enough.
Grade Level¶
Adult professional (Good Enough Engineering)
Duration¶
10 minutes
Prerequisites¶
Secret, API key, environment variable, dotenv file, hosting platform settings, git history, browser bundle and logs, from Chapter 6.
Activities¶
- Predict (5 min): Mark all ten places before seeing any answer.
- Check and read (3 min): Press Check, then click each place you got wrong and read why.
- Explain (2 min): For each leak path, say in one sentence why deleting your copy leaves the key exposed.
Common Misconceptions¶
- A private repository is a safe place for a key.
- Deleting a message or a commit removes the leaked key.
- A
VITE_variable is still private because it is an environment variable. - The local
.envfile is a leak in itself. It isn't. It becomes a leak when it is committed, emailed or pasted.
Assessment¶
Mastery is 9 of 10 correct on the first attempt. Clicking places to read the infobox after Check is exploration, not evidence.
References¶
- Chapter 6: Secrets and Configuration, sections "Dotenv File" and "How Secrets Leak."
- Vite: Env Variables and Modes - only variables prefixed
VITE_are put in the client bundle. - vis-network documentation - the library used to draw the diagram.