Lock In Lab Intern, rank 1 of 9

BU-3choreThird of 3 Builder tickets

Keep keys out of git, out of the browser, out of the chat

Takes
25 min in 3 steps
Checked
19 Nov 2026
min

Your estimate is optional. Your review compares it with how long it took; nothing is scored.

When we audited our own repositories, we found committed .env files and databases, personal email addresses in example files, and keys pasted into chats. None of it was malicious. All of it was the default outcome of moving fast with an agent.

You'll need Any project with at least one secret. git. Prices checked this month are on Tools.

Search what's already there

Step 1 of 3, about 10 min

Run a scanner over the history, for example gitleaks: gitleaks git . (install from its GitHub releases). Anything real it finds must be rotated at the provider. Deleting the file is not enough: it's still in history.

The part of a video worth watching for this step

YouTube, AI Engineer. Published Nov 2026.Checked 19 Nov 2026

Optional. The step counts when you've done it, whether or not you watch. Minutes from the creator's chapters; our notes on this video.

the usual mistake

Thinking a deleted file is gone. git keeps every version until history is rewritten, and anyone who cloned already has it. It happened to us in INC-14, "Secrets in git, across dozens of repos".

Block it at commit time

Step 2 of 3, about 10 min

Add a pre-commit hook that runs the scanner on staged changes. With the pre-commit framework it's a few lines of config; or a plain .git/hooks/pre-commit script calling gitleaks git --pre-commit --staged. Then try to commit a file containing a fake key: sk_test_ followed by about 28 random letters and digits (a run of the same letter may not trigger it). The commit must be refused.

The part of a video worth watching for this step

YouTube, IndyDevDan. Published Jul 2025.Checked 19 Nov 2026

Optional. The step counts when you've done it, whether or not you watch. Minutes from the creator's chapters; our notes on this video.

An honest .env.example

Step 3 of 3, about 5 min
Paste this to your agent
List every environment variable this project reads. Write .env.example with each one, an empty value and a one-line comment. No real values, no real emails.

The part of a video worth watching for this step

YouTube, Tech With Tim. Published Jul 2026.Checked 19 Nov 2026

Optional. The step counts when you've done it, whether or not you watch. Minutes from the creator's chapters; our notes on this video.

Check and ship

The whole ticket
Stage a file with a fake key and try to commit:
echo 'STRIPE=sk_test_51Qx8ZtKe2vQm7RbN4pW9cLdYh3Gf' > leak.txt && git add leak.txt && git commit -m test

It passes when The commit is refused by your hook. Remove leak.txt afterwards.

  • A secret scanner runs before each commit and blocks a fake key.
  • .env.example lists every variable with no real values.
  • You searched git history for secrets and rotated anything you found.

No server checks your work in this version: you mark it, and your review says "Checked by you". Graded checks are planned for Plus.

Next: SE-1 A hook that says no

What do you see?

Pick the closest one. Each goes to what to try first and the incident it looks like.