Skip to content

Commit d877975

Browse files
committed
Merge branch 'ab/doc-hash-brokenness'
Doc updates. * ab/doc-hash-brokenness: doc hash-function-transition: clarify what SHAttered means doc hash-function-transition: clarify how older gits die on NewHash
2 parents 709f9f5 + 5988eb6 commit d877975

File tree

1 file changed

+32
-8
lines changed

1 file changed

+32
-8
lines changed

Documentation/technical/hash-function-transition.txt

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,30 @@ advantages:
2828
address stored content.
2929

3030
Over time some flaws in SHA-1 have been discovered by security
31-
researchers. https://shattered.io demonstrated a practical SHA-1 hash
32-
collision. As a result, SHA-1 cannot be considered cryptographically
33-
secure any more. This impacts the communication of hash values because
34-
we cannot trust that a given hash value represents the known good
35-
version of content that the speaker intended.
31+
researchers. On 23 February 2017 the SHAttered attack
32+
(https://shattered.io) demonstrated a practical SHA-1 hash collision.
33+
34+
Git v2.13.0 and later subsequently moved to a hardened SHA-1
35+
implementation by default, which isn't vulnerable to the SHAttered
36+
attack.
37+
38+
Thus Git has in effect already migrated to a new hash that isn't SHA-1
39+
and doesn't share its vulnerabilities, its new hash function just
40+
happens to produce exactly the same output for all known inputs,
41+
except two PDFs published by the SHAttered researchers, and the new
42+
implementation (written by those researchers) claims to detect future
43+
cryptanalytic collision attacks.
44+
45+
Regardless, it's considered prudent to move past any variant of SHA-1
46+
to a new hash. There's no guarantee that future attacks on SHA-1 won't
47+
be published in the future, and those attacks may not have viable
48+
mitigations.
49+
50+
If SHA-1 and its variants were to be truly broken, Git's hash function
51+
could not be considered cryptographically secure any more. This would
52+
impact the communication of hash values because we could not trust
53+
that a given hash value represented the known good version of content
54+
that the speaker intended.
3655

3756
SHA-1 still possesses the other properties such as fast object lookup
3857
and safe error checking, but other hash functions are equally suitable
@@ -116,10 +135,15 @@ Documentation/technical/repository-version.txt) with extensions
116135
objectFormat = newhash
117136
compatObjectFormat = sha1
118137

119-
Specifying a repository format extension ensures that versions of Git
120-
not aware of NewHash do not try to operate on these repositories,
121-
instead producing an error message:
138+
The combination of setting `core.repositoryFormatVersion=1` and
139+
populating `extensions.*` ensures that all versions of Git later than
140+
`v0.99.9l` will die instead of trying to operate on the NewHash
141+
repository, instead producing an error message.
122142

143+
# Between v0.99.9l and v2.7.0
144+
$ git status
145+
fatal: Expected git repo version <= 0, found 1
146+
# After v2.7.0
123147
$ git status
124148
fatal: unknown repository extensions found:
125149
objectformat

0 commit comments

Comments
 (0)