Malicious code injection by compromised pull request branch names (github.com)
from Sheldan@programming.dev to programming@programming.dev on 06 Dec 16:51
https://programming.dev/post/22539101

#programming

threaded - newest

allywilson@lemmy.ml on 06 Dec 17:54 next collapse

Terrible title, I thought it was a vulnerability in git.

Azzu@lemm.ee on 07 Dec 07:29 collapse

Pull requests are not a feature of git, you probably thought they were?

Zykino@programming.dev on 07 Dec 08:52 collapse

Yup, pull requests are an invention from git’s servers (I think github came up with that first). The built in way (famously used by the linux kernel) is git-send-email.

Azzu@lemm.ee on 07 Dec 14:12 collapse

GitHub is completely unrelated to git.

git-send-email is not even very similar to a pull request, just tangentially related but very different conceptually.

snaggen@programming.dev on 06 Dec 18:16 next collapse

This is why Bobby Tables mom needs her Github account suspended…

snaggen@programming.dev on 06 Dec 18:17 collapse

On an unrelated note, don’t forget to sanitize your input.

BehindTheBarrier@programming.dev on 06 Dec 19:26 next collapse

I never considered branch names to be a vector, but in hindsight it makes total sense when put into a workflow like that. What possibly surprised me even more, was that branch names weren’t limited to basic characters or at least no special signs. I obviously see the case for all the extended characters outside the latin alphabet, such as Chinese characters, but I totally expected restrictions on special symbols like ", ', /, \, ;, etc.

Traister101@lemmy.today on 06 Dec 20:17 collapse

/ is used to separate the same branch in different repos. For example origin/main and remote/main. Surprising that the other stuff is legal though

bamboo@lemm.ee on 07 Dec 02:50 next collapse

You can still freely use / in branch names. Having remote branches available as remote/branch is just a convenience, and you can delete or modify them locally. It’s common to use / in branch names, too.

Traister101@lemmy.today on 07 Dec 03:10 collapse

Okay? I’m well aware. I do so all the time

BehindTheBarrier@programming.dev on 07 Dec 13:27 collapse

That’s true, i didn’t think about that when I wrote it.

I’m used to the world being pretty simple though, so for me that slash has always just been a visual representation of the location of the branch if that makes sense. We don’t have to have a slash in the branch name, only to use it to represent where that branch is located. It could have been something git only used for presentation.

FizzyOrange@programming.dev on 06 Dec 20:13 next collapse

Where’s the code that doesn’t quote this properly? I’m guessing it’s Bash.

LPThinker@lemmy.world on 06 Dec 20:52 collapse

Ding ding ding! We have a winner!

It’s a third-party GitHub Action that is passing the branch name directly to Bash. So to be clear, not GitHub’s fault.

Artyom@lemm.ee on 06 Dec 22:54 collapse

Presumably they picked the repo because it will auto-merge MRs if they pass testing even without human approvals. Glad they caught it and good work to everyone involved, but I’m gonna file this one under my “fuck around, find out” folder.