Build1 publisher3 min readPublished
Git's SHA-256 Default Under Breaking-Changes Builds, Not Just After 3.0 Ships, Will Still Break CI Scripts
Git 3.0 will give new repositories 64-character SHA-256 object IDs in place of 40-character SHA-1, while existing repositories keep their format. Scott Chacon disputes the security payoff, and his own breakage list shows which scripts need changes.
The Engineer · Build desk
Drafted by a language model from the sources cited here and checked against its claim ledger before publication. How we use AISend a correction
What happened
- Git 2.55, the current release, still defaults to SHA-1; SHA-256 applies only in builds with breaking changes enabled, and 3.0 has no release date.
- A repository must be wholly SHA-1 or wholly SHA-256, and submodules must use the same format as their parent repository.
- Scott Chacon's post calling the SHA-256 default a costly mistake reached number three on Hacker News with 549 points in under a day.
- Chacon says GitHub cannot currently host SHA-256 repositories, a gap he calls probably the main thing delaying Git 3.0.
- The Git project's position is that NIST has deprecated SHA-1 and more attacks are coming, so the default has to move while there is still runway.
Compiled by The EngineerSomething wrong?How this is made
Why it matters
- cost Script owners pay for the change whichever side wins the security argument. The breakage follows from hash length, and neither camp disputes the length.
- constraint A project started under 3.0 has to settle one format for its whole submodule tree, so older SHA-1 dependencies cannot simply be attached to a new SHA-256 parent.
- decision Forges will have to ask users to pick an object format at repository creation, and Chacon expects many users to face that choice before they understand it.
- contradiction The post's own migration story reports 64-character hashes after a move to GitHub, a host it says cannot store SHA-256 repositories, so the story cannot be used to size the work.
A SHA-256 object ID is 64 hex characters where SHA-1 used 40 [6]. At four bits per hex digit, that is 256 bits against 160 [1]. Any code that checks or extracts a commit hash by length is affected. A regex anchored to exactly 40 characters rejects the new IDs outright. Without the end anchor, it matches the first 40 characters, and a script that extracts the match passes a truncated ID to the next step with no error raised [2].
The BreakingChanges document sets the scope: the new default applies to newly initialized repositories [1]. Existing SHA-1 repositories are not converted, and the document says there is "no plan to deprecate the sha1 object format at this point in time" [2]. A script that only touches existing repositories keeps seeing 40 characters. Exposure starts when someone runs `git init` on 3.0, or picks SHA-256 when a forge asks for a format at creation [17]. To see which format a repository uses, run `git rev-parse --show-object-format` [4].
According to the post, Chacon co-wrote Pro Git and founded GitHub and GitButler [8]. He calls the switch a "global train wreck" that buys almost no real security [10]. He accepts that SHA-1 collisions are real. SHAttered produced one in 2017, and the 2020 "SHA-1 is a Shambles" paper brought chosen-prefix collisions down to about 2^63 operations [12]. His objection is to what that buys an attacker inside Git. The attacker has to manufacture two variants that hash identically, get a victim who has never pulled before to fetch the malicious one, and get it run [13]. He puts the practical chosen-prefix cost at "a few tens of thousands of dollars" for contrived content [13]. Buying out a burned-out maintainer for a $40k lump sum, he wrote, is "maybe a billion times simpler, cheaper and more likely to succeed" than a cryptographic attack [14].
That argument is about benefit. Neither camp disputes the length change [6]. Chacon's own list of casualties covers every script, CI pipeline, issue tracker and deploy tool that assumes a 40-character hash, and he calls it long, wide-ranging and largely unsolved, with no consensus fix [18]. I think that list is the most useful part of his post for anyone who owns tooling, whichever way the default argument ends. The deadline depends on the hosts. According to Hacker News commenters cited in the post, GitHub's SHA-256 hosting is in private beta [16].
The field evidence is thin. The post's author says he has not run the official migration tooling in production and works from Chacon's post, the Git documentation and the HN thread [19]. His opening story has a team moving a legacy service from Bitbucket Server to GitHub and finding that half its CI scripts parsed commit hashes with a 40-character regex, while the new hashes were 64 characters [7]. The post does not explain where 64-character hashes came from, given the GitHub hosting gap Chacon describes [15]. Finding every affected spot took a full day [7].
What to watch
- GitHub moving SHA-256 hosting out of private beta, which Chacon names as the main thing holding up Git 3.0.
- A Git 3.0 release date, which sets the deadline for tooling that will touch newly created repositories.
- Any change to the Git project's stated position that it has no plan to deprecate the sha1 object format.