this post was submitted on 25 Jan 2024
25 points (100.0% liked)

Programming

423 readers
6 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
 

I'm curious to hear what the Lemmy programming community thinks of this!


  • The author argues against signing Git commits, stating that it adds unnecessary complexity to systems.
  • The author believes that signing commits perpetuates an engineering culture of blindly adopting complex tools.
  • The consequences of signing Git commits are likely to be subtle and not as dramatic as some may believe.

Archive link: https://archive.ph/vjDeK

top 14 comments
sorted by: hot top controversial new old
[–] Mikina@programming.dev 12 points 10 months ago* (last edited 10 months ago)

For anyone wondering - why would I need it? I'm already signed in to github, the commit is commited using my ssh-key, Github knows it's me. Why would I need another verification?

Here's why. https://dev.to/martiliones/how-i-got-linus-torvalds-in-my-contributors-on-github-3k4g . If someone commits with your email (or github noreply email, which is public), it will get attributed to you. I was just trying it with colleauges account, and so far I haven't found any way how to tell that it really wasn't him.

[–] Mikina@programming.dev 7 points 10 months ago

I think he should reconsider his stance on signing commits.

[–] MajorHavoc@programming.dev 4 points 10 months ago* (last edited 10 months ago) (2 children)

Great read.

I agree about the culture problem. People want to slap extra encryption into things, like a spoiler on a hatchback.

The core issue is that the problem being addressed by signed commits is already solved.

Did MajorHavoc write this commit?

If it has my username, on GitHub, you're confident it's my commit.

Alternately, it could be someone with so much access to my SSH keys, or to GitHib's infrastructure, that they could easily sign commits as me, anyway.

Signed commits might become more compelling when we start to favor fully open source federated git solutions. At that point, if I'm famously trustworthy, and the repo I submitted a signed commit to is not, then my signature could mean something.

But even then, there's the risk that someone interprets my 4 minute typo fix as my having some clue whether the repo is actually safe to use...

[–] mattd@programming.dev 6 points 10 months ago (1 children)

Anyone can slap your name and email on a commit and pretend you wrote it

[–] MajorHavoc@programming.dev 1 points 10 months ago

On GitHub, the account that pushed the commit is already fairly evident.

Commits pushed from my GitHub account are differentiated from commits that are not.

I don't want huge centralized Git infrastructure, but while we have it, signed commits are less compelling.

And I'm not saying I love the current state of code authorship verification, either.

[–] Mikina@programming.dev 6 points 10 months ago* (last edited 10 months ago) (1 children)

If it has my username, on GitHub, you’re confident it’s my commit.

Apparently, that's not true: https://dev.to/martiliones/how-i-got-linus-torvalds-in-my-contributors-on-github-3k4g

However, it's a pretty old article - maybe it's already fixed? I'll have to try that.

EDIT: It still works, and you can just use the github noreply address, which is ID+username@users.noreply.github.com . The commit gets linked to their profile, and is shown on their profile page, has their username and profile picture. I haven't figured out any difference between legit and impersonated commit so far, but maybe it's hidden somwhere in the repo administration.

So, there you have it. That's what PGP signing is for.

[–] MajorHavoc@programming.dev 3 points 10 months ago

Nice.

That's enough to make me reconsider signing. Thanks!

[–] CameronDev@programming.dev 3 points 10 months ago (3 children)

I've never understood the point of signing commits. If i can push a commit to a repo, then i can also add my own keys to the repo as well right? So malicious actor with my password can happily push signed commits?

Do many people actually sign commits?

[–] loakang@lemm.ee 3 points 10 months ago (1 children)

Unless they have access to your private key then there's no way they can sign code as you.

Alternatively yes, access to your password (and 2fa) would allow them the ability to add an ssh private key for you.

But that's irrelevant because the issue at hand is that I can make a commit to a repo that I have access to, but using your username, and there's no way to verify it wasn't you (actually there is but it requires some assumptions and is also dependent on the git hosting infrastructure)

However when you use signing, key 'A' may be able to access a repo but can't sign commits as key 'B', so you can't have the blame dropped on you for malicious commits (again, unless they also compromised your account/key)

[–] MajorHavoc@programming.dev 3 points 10 months ago (1 children)

I don't sign my commits.

Though I'll admit I'm not making a moral judgement, it was just a pain in the ass to setup last time I had the time to try it.

[–] JackbyDev@programming.dev 2 points 10 months ago (1 children)

I don't sign my commits because I'm not going to verify anyone's commits.

[–] MajorHavoc@programming.dev 2 points 10 months ago* (last edited 10 months ago)

Yep. Same.

And of course there's a relevant XKCD:https://xkcd.com/1181/

[–] Mikina@programming.dev 2 points 10 months ago

I use comment signing as some kind of a multifactor.

I have my signing key saved on YubiKey, so it's pretty difficult that an attacker could gain access to it.

However, you can still commit through git web browser, and usually have a session for it open when working. If I slipped up and someone got to my PC while I have github open (or managed to steal my session cookies somehow - i.e a rubber ducky driveby), his options are:

  • Commit without signing through SSH. I have ssh key password in my password manager that auto-locks after a minute, so that shouldn't happen, plus the commit wouldn't be signed since I have the key with me.
  • Commit something though the browser - he can't sign it.
  • Add SSH or a new signing key through the browser - I get immediately notified.

So, the end result should be that thanks to the signing mechanism, I should immediately know that something is wrong. Is it neccessary? Probably not, but I still think it's worth it, at least for me.

Now I'm wondering whether it wouldn't be better to have the ssh key on the Yubikey instead. Hmm. I did only discover commit signing later, and didn't have ybikey before, so it never occured to me.