The Incident: The Seven-Minute Leak

Incident Hook

Thursday, 16:20. Boris is adding a payment provider to the backend, and staging needs the provider’s API key for a demo at 17:00. The other staging secrets are in flux/secrets/staging/backend-secrets.yaml, encrypted for the platform key - which Boris does not have, so he cannot open that file. He writes the key into a new, plain Secret instead:

# flux/secrets/staging/payments-api.yaml
apiVersion: v1
kind: Secret
metadata:
  name: payments-api
  namespace: staging
stringData:
  API_KEY: "pay_live_7Hq..."   # the provider's live key, in plaintext

The pre-commit hook refuses the commit. “Just for the demo,” he thinks, commits with git commit --no-verify at 16:24, pushes his branch and opens a pull request.

At 16:25 the Secrets guard job in CI fails on the pull request. Ana sees the red check, opens the diff and writes: “That’s a plaintext live key.” At 16:31 Boris removes the commit and force-pushes the branch. CI turns green. “Fixed - it never reached main.”

The repository is public. For seven minutes, the key was in a commit anyone could read - and the commit did not go away when the branch moved.

Result: the pull request is clean, CI is green, nothing reached the cluster - and the key is still valid, and published.

Diagram: 16:24 skips the check pushes the branch; 16:25 CI Secrets guard fails; 16:31 force-push without the commit; CI green 'never reached main'; public from this moment; the old commit still reachable by its SHA clones, forks, scrapers

Observed Symptoms

What Boris saw at 16:23, before he skipped it:

$ git commit -m "staging: payments API key"
Secrets under flux/secrets/ are SOPS-encrypted...........................Failed
NOT ENCRYPTED: flux/secrets/staging/payments-api.yaml has no SOPS metadata - encrypt it: sops --encrypt --in-place flux/secrets/staging/payments-api.yaml

What the team sees at 16:32: a pull request with a green check and one line in its timeline - Boris force-pushed the branch from 3f9c2a1 to 8b7e044. The first SHA is a link. It still opens the commit with the key.

Confusion Phase

Every signal says the problem is gone:

  • the branch no longer has the file;
  • CI passed;
  • the pull request was never merged, so Flux never applied the Secret.

So is this an incident at all? And if it is, what is left to fix - the branch looks clean.

What AI Would Propose (Brave Junior)

  • “Force-push the branch without the commit - then it’s gone.”
  • “Rewrite the history with git filter-repo and force-push every branch.”
  • “Next time put the value in data: as base64, so it isn’t readable.”
  • “Add the file to .gitignore so it can’t happen again.”

Why This Is Dangerous

  • A push to a public repository is a publication. The guardrail in CI stopped the merge, not the exposure. From 16:24 the commit could be fetched, cloned, forked and read by bots that watch public pushes for keys. A force-push moves the branch; it does not recall the copies.
  • Base64 is an encoding, not encryption. Anyone decodes it with one command; the sops-encrypted check refuses it the same way.
  • .gitignore only hides untracked files. It does nothing for a file someone commits on purpose, and it would also keep the encrypted secret out of Git - the one place it belongs.
  • The key is still valid. As long as the provider accepts it, every copy works. Cleaning Git cannot change that; only the provider can.

Pause and Predict: The branch is clean and CI is green. Write down every place the API key may still exist - then mark the ones you can actually delete.