ihexxa / quickshare

Quick and simple file sharing between different devices, built with Go, React and Typescript.
https://ihexxa.github.io/quickshare.site
GNU Lesser General Public License v3.0
506 stars 32 forks source link

Upgrade dependency "github.com/gin-gonic/gin" #188

Closed Ben131-Go closed 1 year ago

Ben131-Go commented 1 year ago

Background

Repo github.com/ihexxa/quickshare depends on github.com/gin-gonic/gin@v1.7.3.
https://github.com/ihexxa/quickshare/blob/main/go.mod#L9
However, comparing version v1.7.3 of github.com/gin-gonic/gin from proxy.golang.org and github, there are inconsistencies.

commit time of the copy on github.com

"committer": {
"name": "Bo-Yi Wu",
"email": "appleboy.tw@gmail.com",
"date": "2021-08-03T02:40:44Z"
}

commit time of the copy on proxy.golang.org

{"Version":"v1.7.3","Time":"2021-08-03T02:36:43Z"}

So the checksum from the code in github does not match the checksum saved in sum.golang.org. The v1.7.3 tag of github.com/gin-gonic/gin might have been retagged after a minor edition on github. I guess you use proxy.golang.org to get dependencies, but that also shows that your project is depending on the copy of github.com/gin-gonic/gin@v1.7.3 before its edition. Depending upon such inconsistent tag version may also result in some unexpected errors as well as build errors due to different proxy settings.
For example, when someone who does not use proxy.golang.org, say GOPROXY=direct, attempts to get github.com/gin-gonic/gin@v1.7.3, the following error occurs.


go: downloading github.com/gin-gonic/gin v1.7.3
go: github.com/gin-gonic/gin@v1.7.3: verifying module: checksum mismatch
downloaded: h1:3U500Wp728rATEiFJtk1L7dhAbWobNDQC0Cbd4yhhdc=
sum.golang.org: h1:aMBzLJ/GMEYmv1UWs2FFTcPISLrQH2mRgL9Glz8xows=

SECURITY ERROR This download does NOT match the one reported by the checksum server. The bits may have been replaced on the origin server, or an attacker may have intercepted the download attempt.

For more information, see 'go help module-auth'.


So, this is a reminder in the hope that you can get rid of this problematic version of project `github.com/gin-gonic/gin`.
## Solution
### 1. Bump the version of dependency `github.com/gin-gonic/gin`
I would recommend bumping the version of `github.com/gin-gonic/gin` to a new release to ensure dependency copy in proxy.golang.org and github in sync.

## References
+ <https://github.com/gin-gonic/gin/issues/2806>
+ <https://proxy.golang.org/>
ihexxa commented 1 year ago

Really appreciate for the detailed description and the reference. And you are right, I'm using a proxy. Will create a patch for this. I'm migrating boltdb to sqlite, it may take some time.

Ben131-Go commented 1 year ago

Ok, thanks for your response.