Skip to content

Leak Response Drill

Run the Leak Response Drill MicroSim Fullscreen

About This MicroSim

The running example had three secret leaks after launch: a live token committed in a source file, a whole .env file committed, and a production .env file sent by email. This drill walks through the response to each one.

In incident 1 you put six rotation steps in order and throw out two that don't help. The order matters: the app switches to the new key before the old one is revoked, so nothing breaks when there is no sign the key is being misused.

In incidents 2 and 3 you decide which lines of the leaked file to rotate. A line needs rotating if a stranger holding it could reach data, money or a vendor account, or could pretend to be the app or a member. Plain settings, values that are public by design, and addresses that only work on the builder's laptop can stay. The file contents are illustrative.

How to Use

  1. Incident 1: drag the eight cards. Six go into the numbered response order. Two go to Discard. Press Check.
  2. Click any card after Check to read why it belongs where it does.
  3. Press Next incident. For each line of the leaked file, press Rotate or Leave, then Check.
  4. Do the same for incident 3, then press See summary.
  5. You have one Retry in total, usable on any incident you got wrong.

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/leak-response-drill/main.html"
        height="574px"
        width="100%"
        scrolling="no"></iframe>

Lesson Plan

Learning Objective

The learner will prioritize the response to three leaked-secret incidents from the running example, putting rotation steps in a safe order and choosing which values in a leaked file must be rotated, with no leaked secret left working at the end.

Grade Level

Adult professional (Good Enough Engineering)

Duration

15 minutes

Prerequisites

Secret, API key, dotenv file, test vs live keys, revoking a key, secret rotation, secret in git history, and secrets in chat and email, from Chapter 6.

Activities

  1. Order (5 min): Incident 1. Build the rotation order and discard the two steps that leave the key working.
  2. Judge (7 min): Incidents 2 and 3. Mark each line Rotate or Leave, then read the reason for each.
  3. Reflect (3 min): Compare the summary counts, 1, 3 and 6 keys. Why does each incident cost more than the one before?

Common Misconceptions

  • Deleting the file and committing again fixes a leak.
  • Rewriting git history makes the key safe.
  • Only the payment key needs rotating.
  • Every line in a .env file is a secret.
  • A key from a local .env file is harmless because it isn't production.

Assessment

Mastery is all three incidents correct, with at most one retry in total. After incident 1, ask: what changes if the repository was public, or the usage log showed calls you didn't make? (Revoke first, and accept a few minutes of a broken check.)

References

  1. Chapter 6: Secrets and Configuration, sections "When a Key Leaks: Revoke and Rotate" and "A Worked Example: Rotating the Committed Live Token."
  2. p5.js reference - the library used to draw the drill.