Github co-creator & Pro Git author skewers Git 3.0's SHA-256 move

18 days ago by Life is Tetris to c/programming

Git 3.0 will make SHA-256 the new default content hashing algorithm and it will be an incomprehensibly expensive and ultimately valueless and avoidable global nightmare.

In a well-fleshed-out post, Scott Chacon shows how unneecessary Git 3.0's move to replace SHA-1 with SHA-256 is.

enchanted 26 points 18 days ago

His defense of SHA-1:

Mathematically, for SHA-1’s 160-bit output, the birthday bound means that you would need about 1.4 septillion random files (1.4 quadrillion billion files - 1,400,000,000,000,000 billion - it's impossible to effectively describe) in a single project to have file hashes accidentally collide.

For the most part the article mostly talks about collision attacks, which quite frankly i think is silly.

He also talks about hashes pointing to other (older) projects using a different hashing algorithm, but can't the software just detect if its a SHA-1 hash or SHA-256, and fetch it accordingly? He acts like its the end of the world when in my mind most everything can (and probably will) be compensated for pretty easily. It's reminiscent of the IPv6 fear-mongering.

The thing that gets me is he doesn't say if the current hashing algorithm or the new one has any support for when hashes do collide. Since that can theoretically happen with both, to me that sounds like a problem worth tackling.

path: 0 26127104, hotness: undefined, score: 26, children: 6
panda_abyss 5 points 17 days ago

I would have thought they’d prefix the hash with β€œsha256-β€œ or something, or even just 256 prefix the hash.

path: 0 26127104 26127354, hotness: undefined, score: 5, children: 3
setsubyou 34 points 17 days ago

They have different fixed lengths, no prefix needed to tell them apart.

path: 0 26127104 26127354 26128906, hotness: undefined, score: 34, children: 2
corsicanguppy -2 points 17 days ago

Like how y2k wasn't a worry.

path: 0 26127104 26127354 26128906 26128936, hotness: undefined, score: -2, children: 1
yggstyle 5 points 17 days ago

This statement requires nuance. It was a nothingburger because people patched and upgraded ahead of time.

path: 0 26127104 26127354 26128906 26128936 26134158, hotness: undefined, score: 5, children: 0
jsnfwlr 3 points 17 days ago

Collision concerns make sense. If you manage to get two different files with the same hash, that will cause issues for your repo - the concerns over a collision justify the move to SHA-256 though.

path: 0 26127104 26138853, hotness: undefined, score: 3, children: 0
PokerChips 1 point 17 days ago
path: 0 26127104 26130443, hotness: undefined, score: 1, children: 0
thenextguy 23 points 18 days ago

Madness

We had a similar stupid issue at my last job. Someone made an edict that all Sha-1 and md5 references in the code must be removed for security reasons.

path: 0 26126979, hotness: undefined, score: 23, children: 0
JakenVeina 22 points 17 days ago

There's people who seriously think commit hashes are there for security purposes? Furthermore, there are git MAINTAINERS that think this?

How absurd. Author is completely right, making SHA-256 the default implementation serves no purpose. SHA-1 is a completely valid algorithm for non-security use cases, which is precisely how git uses it. This is a solution looking for a problem.

I think he's maybe overblowing the impact of this change. Realistically, the only ones who are going to be impacted are the folks who maintain git-related tools and forges, as he mentions. The rest of us probably won't even notice. But that's still a ton of pointless work for those folks.

path: 0 26138164, hotness: undefined, score: 22, children: 4
atzanteol 4 points 17 days ago

I think he's maybe overblowing the impact of this change.

Maybe... But I don't look forward to working with the dozens of IT folks at my company who all installed git once and have never upgraded. This will be multiple meetings, show up on slide decks, break builds...

It's going to be a right pain for nothing.

path: 0 26138164 26141666, hotness: undefined, score: 4, children: 0
asdfasdfasdf 3 points 17 days ago

Wait, they don't affect security? Wouldn't a hash collision mean pulling that hash from GitHub would pull wrong code? Or maybe delete code? I'd assume the hash is used as a lookup key in a database somewhere.

You also pin dependencies to specific hashes for security reasons.

path: 0 26138164 26142271, hotness: undefined, score: 3, children: 2
JakenVeina 5 points 16 days ago

The blog post lays it out pretty well.

The vulnerability of SHA-1 is that it's possible for an attacker to find colliding hashes. But that's not really an attack vector, because it's not like they can find aatching hash for just ANY input. In order to pull off an attack, using a hash collision, an attacker would have to already be trusted within the controlling system, in which case they can do a hell of a lot worse than swapping out a file.

Like you say, the hash is used as a lookup key within the git repo's database. The requirement for that is uniqueness, which SHA-1 still fulfills just fine. The trust isn't in the database lookup, the trust is in the systems that controls access to and distribution of that database.

As the article points out, Linus Torvalds himself said as much in 2005, when he first wrote git:

I really think people should not consider the sha1 the "security". The real security is in distribution.

path: 0 26138164 26142271 26145874, hotness: undefined, score: 5, children: 0
one_old_coder -1 points 14 days ago

If you need security, you must sign the commits.

path: 0 26138164 26142271 26175269, hotness: undefined, score: -1, children: 0
panda_abyss 13 points 17 days ago

Why did they skip the 255 versions?!

/s

path: 0 26129440, hotness: undefined, score: 13, children: 3
BitUnWise 11 points 17 days ago

Don't be insane, they only skipped 254 versions

path: 0 26129440 26139534, hotness: undefined, score: 11, children: 0
Randelung 8 points 17 days ago

Filler episodes.

path: 0 26129440 26136500, hotness: undefined, score: 8, children: 1
one_old_coder 0 points 14 days ago

Every time I use the shitty command-line flags of git, there is a laugh track.

path: 0 26129440 26136500 26175288, hotness: undefined, score: 0, children: 0
JadedBlueEyes 11 points 17 days ago

This post misses, uh, a few important things that get mentioned in the lobsters comments: https://lobste.rs/...

path: 0 26141958, hotness: undefined, score: 11, children: 2
Kajika 3 points 16 days ago

Thanks for sharing.

Why didn't I know lobsters before? This look 1000 times better than HN... oh you can't join. Makes sense it isn't that known.

path: 0 26141958 26153654, hotness: undefined, score: 3, children: 1
outerspace 1 point 13 days ago

Can anyone share an invite please?

path: 0 26141958 26153654 26204162, hotness: undefined, score: 1, children: 0
one_old_coder 7 points 17 days ago path: 0 26127842, hotness: undefined, score: 7, children: 1
ISO 25 points 17 days ago

You're probably more qualified than most HNers, just less confident, less inclined to indulge in performative expertise and pseudo-intellectual posturing, and more resistant to joining the circle-jerks with those who do indulge.

path: 0 26127842 26130570, hotness: undefined, score: 25, children: 0
Kajika 5 points 16 days ago

It's sad to see this community only listening to people because they're rich: there are a lot of better engineers who knows more than this guy but they're not "co-creator of GitHub". I read this title as boot licking silicon valley.

That being said you don't hash git commits for security reason : YOU SIGN YOUR COMMITS FOR SECURITY. Sorry for the caps but let's make this visible.

path: 0 26153339, hotness: undefined, score: 5, children: 2
tetrislife 2 points 14 days ago

If you know of write-ups by others on this, you are welcome to share. It was a pretty long post, so I mentioned who authored it. If it was on, say, LWN, I wouldn't have prefixed anything to the topic. It looks like it also helps people to avoid rich-man blogs (if they want to)!

path: 0 26153339 26185891, hotness: undefined, score: 2, children: 0
Miaou 1 point 16 days ago

But signing keys can be stolen, have to be updated, revoked etc. A secure hash is an elegant way to say "this repo contains what I want"

path: 0 26153339 26157916, hotness: undefined, score: 1, children: 0
programming
programming

@programming.dev

login for more options
28886
3737
3394

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


go to feed...