Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GIT sha256 support #13794

Closed
6543 opened this issue Dec 2, 2020 · 9 comments · Fixed by #23894
Closed

GIT sha256 support #13794

6543 opened this issue Dec 2, 2020 · 9 comments · Fixed by #23894
Labels
proposal/accepted We have reviewed the proposal and agree that it should be implemented like that/at all. type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.
Milestone

Comments

@6543
Copy link
Member

6543 commented Dec 2, 2020

SHA256 support comes in git-2.29, test deployment on codeberg-test does not work. Steps to reproduce:

git init --object-format=sha256
touch test
git add test
git commit -m "test"
git remote add origin git@codeberg.org:reinerh/test.git
git push -u origin main

Error: fatal: Protokollfehler: unerwartetes capabilities^{}

gitea version: 1.14.0+dev-294-g594cc4aa2

@6543 6543 added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Dec 2, 2020
@a1012112796
Copy link
Member

a1012112796 commented Dec 3, 2020

Not suggest add it now because it still an experimental feature in git.
The error message is because git sha256 need core > repositoryformatversion=1 and extensions > objectformat = sha256.

@Gusted
Copy link
Contributor

Gusted commented Mar 25, 2022

How do we propose to set the SHA-256 setting for a repo? I assume we don't want to set this global(as this would only make sense for "new" gitea instance). Would it be a simple option on the repo creation to enable the SHA256 format?

@lunny
Copy link
Member

lunny commented Mar 26, 2022

If the repository is initialized in Gitea, we can have option in creating repository page, but if it's a repository pushing to create, we should have another method to detect it.

@deknos
Copy link

deknos commented Dec 17, 2022

Hello,
NIST wanna sunset SHA1: https://www.nist.gov/news-events/news/2022/12/nist-retires-sha-1-cryptographic-algorithm

Yes, this will take some time and it is until 2030. Still, people should start it, as there are still no migration possibilities like i don't know, git make-readonly ; git migrate start --to=SHA2-256 ; git migrate clean --away=SHA1 or whatever. Also, this is also only for local git, there's no possibility for this for fetching/pulling already cloned gits.

Also, there may be more hashing algorithms in the future, or some are broken, just migrating to one will perhaps be enough for 10 years, but then we may have this issue again. Please for now, at least test and provide sha256 as an option.

migrating data will take time.

@6543 6543 added type/feature Completely new functionality. Can only be merged if feature freeze is not active. issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented labels Dec 23, 2022
@Sword-Smith
Copy link

Sword-Smith commented Feb 10, 2023

Hello, NIST wanna sunset SHA1: https://www.nist.gov/news-events/news/2022/12/nist-retires-sha-1-cryptographic-algorithm

Yes, this will take some time and it is until 2030. Still, people should start it, as there are still no migration possibilities like i don't know, git make-readonly ; git migrate start --to=SHA2-256 ; git migrate clean --away=SHA1 or whatever. Also, this is also only for local git, there's no possibility for this for fetching/pulling already cloned gits.

Also, there may be more hashing algorithms in the future, or some are broken, just migrating to one will perhaps be enough for 10 years, but then we may have this issue again. Please for now, at least test and provide sha256 as an option.

migrating data will take time.

I second this. Also even if SHA-1 wasn't broken, it would still only be secure up to 80 bits, which shouldn't be considered safe nowadays. You should aim for 100 bits or preferably 128 bits which SHA-256 will give you.

Not as critical as I thought since the SHA-1 function is being used in a way that guarantees that the length is not affected, so the known SHA-1 attacks would not work. Also: A collision is not that dangerous, you need a second-preimage attack which AFAIK still has 160 bits security the way that SHA-1 is currently being used in git.

@ptman
Copy link
Contributor

ptman commented May 16, 2023

https://medium.com/@v3ai/how-to-use-sha-2-git-repositories-6c2a6ed5d580 - mentions how few git tools support sha256

@applemayexist
Copy link

What's the status of this? Git's documentation in 2.42.0 no longer calls the use of sha256 experimental, and states that no backward-incompatible changes are expected.

@lunny
Copy link
Member

lunny commented Sep 9, 2023

Follow #23894

AdamMajer added a commit to AdamMajer/gitea that referenced this issue Sep 22, 2023
@denyskon denyskon added proposal/accepted We have reviewed the proposal and agree that it should be implemented like that/at all. and removed type/feature Completely new functionality. Can only be merged if feature freeze is not active. issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented labels Oct 9, 2023
@lunny lunny added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Jan 17, 2024
@lunny lunny added this to the 1.22.0 milestone Jan 17, 2024
6543 added a commit that referenced this issue Jan 19, 2024
Currently only SHA1 repositories are supported by Gitea. This adds
support for alternate SHA256 with the additional aim of easier support
for additional hash types in the future.

Fixes: #13794
Limited by: go-git/go-git#899
Depend on: #28138

<img width="776" alt="图片" src="https://github.com/go-gitea/gitea/assets/81045/5448c9a7-608e-4341-a149-5dd0069c9447">

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
AdamMajer added a commit to AdamMajer/gitea that referenced this issue Jan 22, 2024
Currently only SHA1 repositories are supported by Gitea. This adds
support for alternate SHA256 with the additional aim of easier support
for additional hash types in the future.

Fixes: go-gitea#13794
Limited by: go-git/go-git#899
Depend on: go-gitea#28138

<img width="776" alt="图片" src="https://github.com/go-gitea/gitea/assets/81045/5448c9a7-608e-4341-a149-5dd0069c9447">

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
henrygoodman pushed a commit to henrygoodman/gitea that referenced this issue Jan 31, 2024
Currently only SHA1 repositories are supported by Gitea. This adds
support for alternate SHA256 with the additional aim of easier support
for additional hash types in the future.

Fixes: go-gitea#13794
Limited by: go-git/go-git#899
Depend on: go-gitea#28138

<img width="776" alt="图片" src="https://github.com/go-gitea/gitea/assets/81045/5448c9a7-608e-4341-a149-5dd0069c9447">

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
silverwind pushed a commit to silverwind/gitea that referenced this issue Feb 20, 2024
Currently only SHA1 repositories are supported by Gitea. This adds
support for alternate SHA256 with the additional aim of easier support
for additional hash types in the future.

Fixes: go-gitea#13794
Limited by: go-git/go-git#899
Depend on: go-gitea#28138

<img width="776" alt="图片" src="https://github.com/go-gitea/gitea/assets/81045/5448c9a7-608e-4341-a149-5dd0069c9447">

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Copy link

github-actions bot commented Mar 1, 2024

Automatically locked because of our CONTRIBUTING guidelines

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
AdamMajer added a commit to AdamMajer/gitea that referenced this issue May 14, 2024
Currently only SHA1 repositories are supported by Gitea. This adds
support for alternate SHA256 with the additional aim of easier support
for additional hash types in the future.

Fixes: go-gitea#13794
Limited by: go-git/go-git#899
Depend on: go-gitea#28138

<img width="776" alt="图片" src="https://github.com/go-gitea/gitea/assets/81045/5448c9a7-608e-4341-a149-5dd0069c9447">

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
proposal/accepted We have reviewed the proposal and agree that it should be implemented like that/at all. type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants