pluveto / upgit

Another upload hub that supports clipboard. It works well with Typora, Snipaste, VSCode.
MIT License
529 stars 44 forks source link

Upgrade dependency "github.com/pelletier/go-toml" #62

Closed Ben131-Go closed 1 year ago

Ben131-Go commented 1 year ago

Background

Repo github.com/pluveto/upgit depends on github.com/pelletier/go-toml/v2@v2.0.0-beta.6.
https://github.com/pluveto/upgit/blob/main/go.mod#L9
However, comparing version v2.0.0-beta.6 of github.com/pelletier/go-toml from proxy.golang.org and github, there are inconsistencies.

commit time of the copy on github.com

"committer": {
"name": "GitHub",
"email": "noreply@github.com",
"date": "2022-04-07T23:51:09Z"
}

commit time of the copy on proxy.golang.org

{"Version":"v2.0.0-beta.6","Time":"2022-01-01T01:03:18Z"}

So the checksum from the code in github does not match the checksum saved in sum.golang.org. The v2.0.0-beta.6 tag of github.com/pelletier/go-toml 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/pelletier/go-toml@v2.0.0-beta.6 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/pelletier/go-toml/v2@v2.0.0-beta.6, the following error occurs.


go: downloading github.com/pelletier/go-toml/v2 v2.0.0-beta.6
go: github.com/pelletier/go-toml/v2@v2.0.0-beta.6: verifying module: checksum mismatch
downloaded: h1:wURrrr62LqAzIR22w6KSpuDTdzPljPWc5UrtWOsWPfU=
sum.golang.org: h1:JFNqj2afbbhCqTiyN16D7Tudc/aaDzE2FBDk+VlBQnE=

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/pelletier/go-toml`.
## Solution
### 1. Bump the version of dependency `github.com/pelletier/go-toml`
I would recommend bumping the version of `github.com/pelletier/go-toml` to a new release to ensure dependency copy in proxy.golang.org and github in sync.

## References
+ <https://github.com/pelletier/go-toml/issues/743>
+ <https://proxy.golang.org/>
pluveto commented 1 year ago

Resolved.