A key’s day

Part 1, Code · Step 9: Git history

Deleted from the code, and it still works

Deleted, but still working. Right after the merge, Sam deletes the feature/BILL-142-apple-pay branch, the usual cleanup, and Priya, a teammate, deletes the .env file from main. The latest version of the code is clean. But the commit that added the key is still in the code’s history on main, so every clone of the code still has it. And the key still works.

Why it matters. Deleting text does not turn a key off. Only the service that issued it can.

See it in the lesson Part 1 recap

This really happened: Truffle Security, 2024

Commits pushed to a fork stay reachable after the fork is deleted. Checking three widely forked repositories from large AI companies turned up 40 valid keys in deleted forks.

Why many code scanners miss old versions

Where the key still lives

Try it with TruffleHog open source

Scans every commit still reachable from a branch or tag, including commit messages, so a deleted line is still found. A deleted branch is not in that clone once nothing else points at its commits. The experimental command trufflehog github-experimental --repo REPO_URL --object-discovery enumerates those deleted and hidden commits, including ones a fork can still reach.

trufflehog git file://.

Sources

Keep going

More topics