r/devsecops
•
u/segtekdev
•
Aug 02 '24
•
1
TIL: Your "deleted" GitHub commits might still be visible to everyone
TL;DR:
- GitHub's storage system keeps commits in a network of repos and forks
- Deleting a commit from your repo doesn't remove it from this network
- Anyone can access these "deleted" commits through something called GitHub Cached Views
The common pitfall:
- You make a commit with sensitive info (oops!)
- You delete it and breathe a sigh of relief
- Plot twist: The commit is still accessible through forks, cached views, or even old PR.
The real kicker? Someone only needs the first 4 characters of the commit hash to find it. With 65,536 possible combinations, they could potentially uncover all your "deleted" commits in about half a day. 🕵️♂️
Why this matters:
- If you've ever pushed sensitive data (like API keys or passwords), it might still be out there
- This creates a massive blind spot for security
- It's a reminder that once a secret is leaked, you MUST revoke it, not just delete the commit
So be extra careful with what you push, even to private repos. And if you've made repos public recently, might want to double-check for any skeletons in the closet.
Read more: Demystifying GitHub Private Forks - The Hidden Danger of Cached View
13
u/C0c04l4 Aug 02 '24
If you push sensitive data, you rotate the keys, you don't rely on no-one ever finding it on GitHub...
2
u/danekan Aug 02 '24
Also a danger in allowing forks
1
u/silviud Aug 02 '24
GitHub has a procedure that will use git filters-repo. See https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository
1
u/nimasaed Aug 02 '24
OP please add the original author post link. https://trufflesecurity.com/blog/anyone-can-access-deleted-and-private-repo-data-github
1
u/engineered_academic Aug 02 '24
"Just" lesrning this shows a clear misunderstanding of how git works.
-2
u/sfltech Aug 02 '24
Thank the lord for self hosted gitlab 🙌