Boss lesson · Unit 03
The key in the repo
A leaked secret, from the first minute to never again
What you practise
- A secret committed to git is leaked forever
- Environment variables and secret managers
- Rotation
- Scoping keys
- What to do in the first hour after a leak
Try a question from this lesson
Pick one
You commit an API key by mistake and push. A minute later you notice, delete the line and push a new commit. Is the key safe now?
Correct answer
No: the old commit still holds it, and it may already be copied
Why
A new commit adds a snapshot; it does not erase the old one. Anyone who fetched the repository in that minute has the key, and scanners watch public pushes for exactly this.
The idea
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
Git never forgets
Deleting a secret in a new commit leaves it in every earlier one. Rewriting history is possible, but it cannot reach clones, forks, caches or build logs that already have a copy.
So a secret that was pushed is a secret that leaked. The only real repair is to rotate it: revoke the old secret so it stops working, and issue a new one.
11 more exercises in the app
- 2× type the answer
- 5× multiple choice
- 1× order the lines
- 1× fill the blanks
- 1× true or false
- 1× match the pairs
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.