johanbrandhorst / certify

Automatic client and server certificate distribution and maintenance
https://jbrandhorst.com/post/certify/
MIT License
465 stars 38 forks source link

Upgrade dependency "github.com/cloudflare/cfssl" #252

Closed Ben131-Go closed 1 year ago

Ben131-Go commented 1 year ago

Background

Repo github.com/johanbrandhorst/certify depends on github.com/cloudflare/cfssl@v1.6.2.
https://github.com/johanbrandhorst/certify/blob/master/go.mod#L8
However, comparing version v1.6.2 of github.com/cloudflare/cfssl from proxy.golang.org and github, there are inconsistencies.

commit time of the copy on github.com

"committer": {
"name": "Nicky Semenza",
"email": "nicky@cloudflare.com",
"date": "2022-08-26T21:11:36Z"
}

commit time of the copy on proxy.golang.org

{"Version":"v1.6.2","Time":"2022-08-24T17:57:20Z","Origin":{"VCS":"git","URL":"https://github.com/cloudflare/cfssl","Ref":"refs/tags/v1.6.2","Hash":"cacf1702e49e95c402b3b041a1689965e784dadd"}}

So the checksum from the code in github does not match the checksum saved in sum.golang.org. The v1.6.2 tag of github.com/cloudflare/cfssl 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/cloudflare/cfssl@v1.6.2 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/cloudflare/cfssl@v1.6.2, the following error occurs.


go: downloading github.com/cloudflare/cfssl v1.6.2
go: github.com/cloudflare/cfssl@v1.6.2: verifying module: checksum mismatch
downloaded: h1:V7EcbVzttAkK3J7PmAxjf7wD7UpMtWSCI+Wl+mu87mw=
sum.golang.org: h1:3T2oQHypP81rykPfkTxOCyJkRU3xQz5SySVahMpN5LE=

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

## References
+ <https://github.com/cloudflare/cfssl/issues/1243>
+ <https://proxy.golang.org/>
johanbrandhorst commented 1 year ago

Hm, that's pretty worrying, thanks for raising this. Should probably just bump that dependency anyway.