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

checksum mismatch when downloading with GOPROXY=direct #15

Closed
zikaeroh opened this issue Jun 16, 2021 · 14 comments
Closed

checksum mismatch when downloading with GOPROXY=direct #15

zikaeroh opened this issue Jun 16, 2021 · 14 comments

Comments

@zikaeroh
Copy link

It appears as though the published version that exists in the Go module proxy differs from the one that is in this repo; this can happen if you retag to another commit or force push, and can cause breakages.

$ go clean -modcache
$ GOPROXY=direct go install github.com/ryancurrah/gomodguard/cmd/gomodguard@latest
go: downloading github.com/ryancurrah/gomodguard v1.2.1
go install github.com/ryancurrah/gomodguard/cmd/gomodguard@latest: github.com/ryancurrah/gomodguard@v1.2.1: verifying module: checksum mismatch
	downloaded: h1:nZFSDqk8ui1DxX9Hj8td+vz9K2ByPwfq6QJPKkz6YVo=
	sum.golang.org: h1:t1WWL0RGJJBo5KZ0u2c/FGY1QQgx2gUbHWzBmOKWs98=

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'.

This module is now a part of golangci-lint, so I'm hitting this when installing it.

@pellared
Copy link

pellared commented Jun 17, 2021

@ryancurrah
Copy link
Owner

Yeah I think when I used goreleaser it messed up and I deleted the tag and tried again.

@pellared
Copy link

Could you please publish a v1.2.2 if you do not plan to make a new release soon? It would make people life easier 😉

@ryancurrah
Copy link
Owner

Done. Let me know if it fixes it for you.

@pellared
Copy link

Done. Let me know if it fixes it for you.

Thanks.
I guess it will fix once golangci-lint makes a deps bump.

@StevenACoffman
Copy link
Contributor

Not sure if this is worked? I tried the directions for Adding a package and none of them worked:

  1. Visiting that page on pkg.go.dev, and clicking the “Request” button. For example:
    https://pkg.go.dev/github.com/ryancurrah/gomodguard/@v1.2.2

  2. Making a request to proxy.golang.org for the module version, to any endpoint specified by the Module proxy protocol. For example:
    https://proxy.golang.org/github.com/ryancurrah/gomodguard/@v/v1.2.2.info

  3. Downloading the package via the go command. For example:

GOPROXY=https://proxy.golang.org GO111MODULE=on go get github.com/ryancurrah/gomodguard@v1.2.2

@zikaeroh
Copy link
Author

zikaeroh commented Jun 18, 2021

The tag is 1.2.2, but it needs to be v1.2.2 in order to be a valid version.

@pellared
Copy link

pellared commented Jun 18, 2021

The v1.2.1 tag should be pointing to the commit cached in Go Module Proxy if we want to fix the issue.

@ryancurrah
Copy link
Owner

ryancurrah commented Jun 18, 2021

What if we updated the version in golangci-lint and bumped a patch release?

The tag is 1.2.2, but it needs to be v1.2.2 in order to be a valid version.

Fixed

@zikaeroh
Copy link
Author

What if we updated the version in golangci-lint and bumped a patch release?

Yep, this will have to be updated there, since it'll keep picking the last revision.

@StevenACoffman
Copy link
Contributor

Will golangci-lint also need an exclude in it's go.mod for v1.2.1 now that v1.2.2 is available?

In the meantime, in your projects depending on golangci-lint, you can add an exclude to go.mod for the invalid version:

exclude github.com/ryancurrah/gomodguard v1.2.1

For instance, to ensure my tool dependencies are not removed and so I can leverage the Go Modules, I create a file tools.go. In this file I will list all my tool dependencies using an import statement:

// +build tools

package tools

import (
	_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
)

// There is nothing here intentionally

This allows me to again use golangci-lint v1.4.1 in my ci/cdd pipeline.

@zikaeroh
Copy link
Author

Will golangci-lint also need an exclude in it's go.mod for v1.2.1 now that v1.2.2 is available?

No, it'd bump the dep to v1.2.2 in its go.mod, and them the version is guaranteed to be at least that version (unless someone uses another go.mod to replace it to a lower version).

StevenACoffman added a commit to StevenACoffman/golangci-lint that referenced this issue Jun 18, 2021
…guard#15

Signed-off-by: Steve Coffman <steve@khanacademy.org>
@zikaeroh
Copy link
Author

I'll close this, since it's fixed. 🙂

@ryancurrah
Copy link
Owner

Apologies for the issues I'm happy it's resolved now.

StevenACoffman added a commit to StevenACoffman/gomodguard that referenced this issue Aug 3, 2021
Signed-off-by: Steve Coffman <steve@khanacademy.org>
ryancurrah pushed a commit that referenced this issue Aug 4, 2021
Signed-off-by: Steve Coffman <steve@khanacademy.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants