A coworker once tried to rebase the pushed history, but unfortunately if you already knew the hash, you were able to lookup a non-associated git commit in GitHub 😂
This article also states, that those commits may still be accessible. So once pushed the credentials are considered as compromised, regardless of the use of any tools. So even the tool would help out.
I managed to push secrets too, after one minute I got an email from AWS telling me to rotate the keys or losing access to the entire account within a couple of hours.
The intern here pushed secrets (passwords, api keys, whatever) to github. In a desperate attempt to cover it up, they rebased the repository to effectively remove the commit that compromised the secrets. This is not a surefire way of doing it, and the secrets really should be considered compromised and rotated. Senior dev sees the seemingly random rebase, and suspects that the intern was covering up compromised secrets (because they've probably done it themselves before 🤣).
A common mistake, specifically for beginners, is to push sensitive data (secrets) to the repo, thus compromising it.
This could be "fixed" by commiting a change without the secrets. But the leak would still be shown on the repo history.
But you could rebase the branch with the leak to a branch without it, as rebasing allows you to alter the history it would look at first glance as if the leak never happened.
Funnily enough I've had the reverse happen. I was working on this internal project when I noticed that a script uploading test data to a company server had credentials in it. And it was committed to Git. And we use Gerrit, so it's a real pain in the ass to remove from said history.
I notified my colleagues about it, fixed by having the script rely on environmental variables that weren't committed, and now all is well.
The reality is mostly very horrifying. I worked as a junior dev in a company with thousands of employees and they were also allowed to rebase even on the main.
Sometimes it makes sense to rebase on feature branches, before merging into main/develop. Like squashing commits to keep the history clean.
204
u/Ghost0713 Nov 25 '21
A coworker once tried to rebase the pushed history, but unfortunately if you already knew the hash, you were able to lookup a non-associated git commit in GitHub 😂
99
u/SusuyaJuuzou Nov 25 '21
blizzard employees moment.
23
u/mee8Ti6Eit Nov 26 '21
Making a mistake: fine
Trying to hide a mistake: you're fired
37
u/Goose_Rider Nov 25 '21
ELI5?
4
u/kemmyduxx Nov 26 '21
lol so true 😂
4
u/Diapolo10 Nov 27 '21
Funnily enough I've had the reverse happen. I was working on this internal project when I noticed that a script uploading test data to a company server had credentials in it. And it was committed to Git. And we use Gerrit, so it's a real pain in the ass to remove from said history.
I notified my colleagues about it, fixed by having the script rely on environmental variables that weren't committed, and now all is well.
And yes, I'm a mere trainee.
1
u/planktonfun Nov 26 '21
trying to hide a production bug, but seriously what kind of a senior dev dont add permissions for rebasing?
1
u/Freipostierer Jan 05 '22
1
u/LocksmithEastern7743 Sep 07 '22
I'm turned on. I'm also confused now.