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: go get github.com/google/flatbuffers/go #6466

Closed
regeda opened this issue Feb 15, 2021 · 25 comments
Closed

Checksum mismatch: go get github.com/google/flatbuffers/go #6466

regeda opened this issue Feb 15, 2021 · 25 comments
Labels

Comments

@regeda
Copy link

regeda commented Feb 15, 2021

Could not get the library due to checksum mismatch:

$ go get -u github.com/google/flatbuffers/go
go: downloading github.com/google/flatbuffers v1.12.0
go get github.com/google/flatbuffers/go: github.com/google/flatbuffers@v1.12.0: verifying module: checksum mismatch
        downloaded: h1:N8EguYFm2wwdpoNcpchQY0tPs85vOJkboFb2dPxmixo=
        sum.golang.org: h1:/PtAHvnBY4Kqnx/xCQ3OIV9uYcSFGScBsWI3Oogeh6w=

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'.
$ go version
go version go1.15.7 darwin/amd64
@aardappel
Copy link
Collaborator

Not familiar with Go.. so no idea what is causing this. Anyone else?

@ceejatec
Copy link

My theory: Google did something naughty with the git history, perhaps moved the v1.12.0 tag to a new SHA. This lead to the goproxy module cache and the checksum servers being out of sync, producing the above error. It seems to have been "fixed" now - if you run the above command today (and you don't have an earlier version of the module cached on your system) you don't get the error. But we run our own internal module proxy at our work, and it's still stuck in a mode where the checksums don't match, so we still get the above error. Now I need to figure out how to manually flush that part of the cache so our builds aren't broken. Very annoying that someone being sloppy out on the internet can break our builds like that. I mean, for Go in particular, Google of all people should know better...

@aardappel
Copy link
Collaborator

@ceejatec "Google" is not a single entity, I don't think there's ever been any communication between those involved in Go and FlatBuffers. The Go implementation has been made entirely by external contributors.

And no, the v1.12.0 tag has not been touched.

@ceejatec
Copy link

That was my theory based on a basically identical issue with the azure-storage-blob-go package less than a month ago : Azure/azure-storage-blob-go#236 (comment) where someone changed the v0.12.0 tag because it was mistakenly pointing at the wrong commit. Changing the tag broke the Go module caching proxies just as we see here.

In that case, we worked around it by telling Go to use a pseudo-tag based on v0.11.0+some number of commits, which the Go proxies see as a different version and hence re-download the code and checksum. We've actually done a similar thing for now for flatbuffers, using the following in our go.mod:

github.com/google/flatbuffers v0.0.0-20200312223339-6df40a247173

If the tag wasn't changed in this case, then "something else" caused Google's go module proxies to get out of sync with each other. As I said, that particular problem seems to be fixed "somewhere" now, but if you've got your own local caches you still might be messed up.

@regeda
Copy link
Author

regeda commented Feb 19, 2021

I've resolved the issue. I set the GOPROXY variable explicitly:

go mod tidy
GOPROXY=proxy.golang.org go get -u github.com/google/flatbuffers/go

Somehow, my default GOPROXY was pointed wrongly at proxy.golang.com.cn.

@amnonbc
Copy link

amnonbc commented Feb 21, 2021

~Can someone on the flatbuffers project please create a new v1.12.1 tag so that users of the latest tag do not have to resort to these workarounds?

This will take 2 minutes, and save your users a lot of aggravation.

And ideally you should also redact v1.12.0~

@aardappel
Copy link
Collaborator

@amnonbc pointing to what commit?

So far, I am not even aware of an issue with our repo. We haven't changed these tags afaik. I'd like to understand what the problem is first.

@amnonbc
Copy link

amnonbc commented Feb 22, 2021

I have dug a bit further and found that the culprit was a stray GOPROXY=https://goproxy.cn entry.
No idea why https://goproxy.cn contained garbage.

Removing that has solved the problem for us.
Thanks for responding. And apologies for the noise.

@ceejatec
Copy link

It's not just goproxy.cn. I can reproduce this locally and reliably by using the Athens go proxy, and it (hopefully?) isn't pulling information from goproxy.cn. I filed an issue against Athens with the details, but I'm not at all convinced it's actually an Athens bug - I'm hoping they will have more info to help diagnose what's really doing on.

@XC-
Copy link

XC- commented Feb 23, 2021

For us this occurs:
github.com/google/flatbuffers/go: github.com/google/flatbuffers@v1.12.0: verifying module: checksum mismatch downloaded: h1:N8EguYFm2wwdpoNcpchQY0tPs85vOJkboFb2dPxmixo= sum.golang.org: h1:/PtAHvnBY4Kqnx/xCQ3OIV9uYcSFGScBsWI3Oogeh6w=

with the go.sum in place, the error tends to be different on developer machine and in CI. The downloaded checksum and the one received from sum.golang.org switch places in CI. On developer machine, the GOPROXY env variable is empty.

@Avokadoen
Copy link

Avokadoen commented Mar 27, 2021

Anyone who has a concrete workaround? I have the same issue as @XC-, it works fine locally but in the CI it fails with the identical error. This is a indirect dependency from badger, so I can't trivially change the flatbuffer version either ...

Doing RUN GOPROXY=proxy.golang.org go mod download in the CI Dockerfile did not resolve the issue

Any help is much appreciated :- )

@ceejatec
Copy link

ceejatec commented Apr 2, 2021

@Avokadoen My workaround (posted here on February 18) does the trick for us.

@Avokadoen
Copy link

@Avokadoen My workaround (posted here on February 18) does the trick for us.

We have flatbuffers as a indirect dependency, I might be misinterpreting but the workaround you posted is to modify go.mod? In that case it would not work for us. But thanks for the tip anyways! 👍

@burningalchemist
Copy link

I'm having the same issue, when using Github-native Dependabot for security updates:

Dependabot failed to update your dependencies because there was an error resolving your Go dependency files.

Dependabot encountered the following error:
verifying github.com/google/flatbuffers@v1.12.0: checksum mismatch

Given that this dependency is indirect in my case as well, and there is no way to control the way Dependabot verifies checksums, it seems a blocking issue.

I'd appreciate any advice here, too.

@ceejatec
Copy link

ceejatec commented May 3, 2021

Despite @aardappel 's earlier assertion, it seems clear that the v1.12.0 tag was changed at some point, and that it happened after Google had consumed the earlier commit.

Evidence:

cd /tmp && git clone git://github.com/google/flatbuffers -b v1.12.0
go mod download github.com/google/flatbuffers@v1.12.0
cd ~/co/pkg/mod/github.com/google/flatbuffers@v1.12.0
diff -r . /tmp/flatbuffers

This shows numerous differences. It is true that none of those differences are in the Go code, but the Go proxy will calculate its checksum based on the full contents of the repository, not just the Go code.

Additional evidence: if you rm -rf ~/go, set GOPROXY=direct and GOSUMDB=off, and repeat the above steps, you'll find that there are no differences. This confirms that the set of code stored by Google in its proxy is different than the tagged content here on github.

I can't find any commit in the flatbuffers repository which corresponds to the code in the module, so I don't know how this happened. But it definitely did happen, and it definitely is breaking a lot of use cases.

I also don't know if there's any way to request Google to reset its cached modules based on the actual v1.12.0 tag, but even if you could, that would quite possibly break everybody who isn't currently broken.

I think the only way forward, as was suggested back in February, is to create a "v1.12.1" tag and make sure that it doesn't get messed with. At least that way, people who are hitting this issue can add v1.12.1 to their go.mod files, which will override any dependencies they have which are pointing to the broken v1.12.0.

@aardappel
Copy link
Collaborator

the v1.12.0 points to 6df40a2 (pre-tag version bump for 1.12) like it always has. For the 3rd time, it hasn't moved. Whatever problem there is, it is entirely inside Go's handling of things.

This is how we release things, and it doesn't include Go: https://github.com/google/flatbuffers/wiki/FlatBuffers-release-process which means whatever is on the Go package manager (is there one?) was uploaded by someone else, not me. Would be good first to track that person down?

I have no idea how Go works, but I'd be happy to add a v1.12.1 tag pointing to whatever commit you desire to the repo if that helps.

@aardappel
Copy link
Collaborator

There is also a v2.0.0 release coming up, if Go is helped by any particular incantations when that tag gets added, now would be a good time to figure that out.

@ceejatec
Copy link

ceejatec commented May 3, 2021

Go modules uses tags on GitHub which (fortunately?) conform to the standard you're using, vX.Y.Z. Details: the first time someone tries to build a Go project that declares a dependency on github.com/google/flatbuffers v1.12.0, the Go compiler will hit the Go module proxy - by default proxy.golang.org - and ask for the module. The proxy will not yet have the code for the module (FYI go modules are purely source code, not any kind of compiled artifact), so the proxy will internally fall back to "direct" mode which means it will look up that tag on GitHub and pull the source at that moment in time. It will store that source code forever as the source code for github.com/google/flatbuffers v1.12.0. It will also form a checksum of the source code, and there is a separate checksum database which is populated accordingly (by default this is sum.golang.org).

For any later builds, the Go compiler will ask the proxy for the source code of the module, and it will get it. The compiler will compute the checksum, and then request the checksum for that module from the checksum database and confirm that it matches the checksum it computed. And that is the step that is failing for a number of people today.

The fundamental cause of this problem is that the source code cached in proxy.golang.org does not match the code that is available on GitHub at that tag. This triggers problems whenever something uses a different Go proxy (or no proxy at all, ie. GOPROXY=direct) but is still referencing the default checksum database. This is, for better or worse, not at all an uncommon scenario, and normally shouldn't cause any problems because normally everybody on the planet (all Go module proxies, plus GitHub) would agree about exactly what source code constitutes a given version of a module.

I cannot explain how the world got into this state. By far the easiest explanation is that the tag on GitHub got moved sometime after the first time proxy.golang.org consumed the source code. If that didn't happen, then I'm stumped. Perhaps Google itself did something wonky because google/flatbuffers is its own code, although that seems like a really bad idea if true.

@ceejatec
Copy link

ceejatec commented May 3, 2021

FYI, I did my same experiment above with flatbuffers v1.11.0, and there are no differences in the source code. So whatever process was done for v1.11.0 worked as expected. That makes it all the more weird that v1.12.0 is messed up, since I have to assume you did exactly the same things.

@aardappel
Copy link
Collaborator

aardappel commented May 6, 2021

Well, I am the one applying tags and doing releases, no-one else at Google is involved in that so far. And yes, I've been doing these releases exactly the same way, all 13 of them over the past 7 years.

Anyway, if I'd thus tag v1.12.1 to whatever the tag is right after that commit, it should cause something new to be cached, and everyone would be happy, right? That would be this one, which doesn't change any Go files: 697147a

@Avokadoen
Copy link

Avokadoen commented May 9, 2021

I do believe that creating a v1.12.1 release would at least help those of us that has flatbuffers as a indirect dependency to resolve our CI issues using the replace directive. Thanks you @aardappel for all the hard work you do on this project, and thank you @ceejatec for investigating! ❤️

@ceejatec
Copy link

ceejatec commented May 9, 2021

Agreed, creating that tag would be very helpful for those with indirect (or direct!) dependencies.

@Avokadoen Using a replace directive will work, but it also introduces a small risk - later if some code you depend on uses the upcoming v1.20.0 version, your builds won't pick that up automatically. Just something to watch out for.

@aardappel
Copy link
Collaborator

We now have https://github.com/google/flatbuffers/tree/v1.12.1

Note I will be releasing v2.0.0 likely today, so some of you may want to update to that instead.

@burningalchemist
Copy link

@aardappel @ceejatec Updating go.mod to v.1.12.1 fixed my problem with Github/Dependabot. Thanks! 😃

jalseth added a commit to open-policy-agent/conftest that referenced this issue Sep 18, 2021
Dependabot introduced [1] an incorrect hash in the go.sum file for the
github.com/google/flatbuffers@v1.12.0 dependency. After working with
Github support, the root cause was determined to be that the default
public Go modules proxy has a different hash than if you connect
directly, likely because at some point the tags were swapped. Dependabot
runs with GOPRIVATE=* set, so it does not use the default proxy and is
why the hash is different.

This change uses the same hash as the public Go modules proxy in order
to ensure the builds work and anyone consuming the Conftest repository
are able to build. The flatbuffers maintainers introduced a 1.12.1 which
is the same code as the 1.12.0 release to fix [2] this issue going forward,
which we will use once the dependency that introduced the 1.12.0 version
is updated.

[1] #607
[2] google/flatbuffers#6466

Signed-off-by: James Alseth <james@jalseth.me>
NamanJain8 pushed a commit to dgraph-io/badger that referenced this issue Sep 22, 2021
The v1.12.0 version of the flatbuffers package has an issue where the
hash of the package will differ depending on if you fetch the source
using the default, public Go Modules proxy or if you fetch the source
directly, which can cause build issues [1][2]. The flatbuffers maintainers
released v1.12.1 to fix this issue [3].

[1] https://github.com/open-policy-agent/conftest/runs/3576130950?check_suite_focus=true
[2] open-policy-agent/conftest#613
[3] google/flatbuffers#6466

Signed-off-by: James Alseth <james@jalseth.me>
NamanJain8 pushed a commit to dgraph-io/badger that referenced this issue Oct 5, 2021
The v1.12.0 version of the flatbuffers package has an issue where the
hash of the package will differ depending on if you fetch the source
using the default, public Go Modules proxy or if you fetch the source
directly, which can cause build issues [1][2]. The flatbuffers maintainers
released v1.12.1 to fix this issue [3].

[1] https://github.com/open-policy-agent/conftest/runs/3576130950?check_suite_focus=true
[2] open-policy-agent/conftest#613
[3] google/flatbuffers#6466

Signed-off-by: James Alseth <james@jalseth.me>
(cherry picked from commit a6bf4fd)
macox pushed a commit to macox/conftest that referenced this issue Oct 5, 2021
Dependabot introduced [1] an incorrect hash in the go.sum file for the
github.com/google/flatbuffers@v1.12.0 dependency. After working with
Github support, the root cause was determined to be that the default
public Go modules proxy has a different hash than if you connect
directly, likely because at some point the tags were swapped. Dependabot
runs with GOPRIVATE=* set, so it does not use the default proxy and is
why the hash is different.

This change uses the same hash as the public Go modules proxy in order
to ensure the builds work and anyone consuming the Conftest repository
are able to build. The flatbuffers maintainers introduced a 1.12.1 which
is the same code as the 1.12.0 release to fix [2] this issue going forward,
which we will use once the dependency that introduced the 1.12.0 version
is updated.

[1] open-policy-agent#607
[2] google/flatbuffers#6466

Signed-off-by: James Alseth <james@jalseth.me>
@github-actions
Copy link

github-actions bot commented Nov 9, 2021

This issue is stale because it has been open 6 months with no activity. Please comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Nov 9, 2021
altergui added a commit to altergui/vocdoni-node that referenced this issue Jan 4, 2022
altergui added a commit to altergui/vocdoni-node that referenced this issue Jan 10, 2022
manishrjain pushed a commit to outcaste-io/outserv that referenced this issue Jul 6, 2022
The v1.12.0 version of the flatbuffers package has an issue where the
hash of the package will differ depending on if you fetch the source
using the default, public Go Modules proxy or if you fetch the source
directly, which can cause build issues [1][2]. The flatbuffers maintainers
released v1.12.1 to fix this issue [3].

[1] https://github.com/open-policy-agent/conftest/runs/3576130950?check_suite_focus=true
[2] open-policy-agent/conftest#613
[3] google/flatbuffers#6466

Signed-off-by: James Alseth <james@jalseth.me>
mangalaman93 pushed a commit to dgraph-io/badger that referenced this issue Feb 14, 2023
The v1.12.0 version of the flatbuffers package has an issue where the
hash of the package will differ depending on if you fetch the source
using the default, public Go Modules proxy or if you fetch the source
directly, which can cause build issues [1][2]. The flatbuffers maintainers
released v1.12.1 to fix this issue [3].

[1] https://github.com/open-policy-agent/conftest/runs/3576130950?check_suite_focus=true
[2] open-policy-agent/conftest#613
[3] google/flatbuffers#6466

Signed-off-by: James Alseth <james@jalseth.me>
(cherry picked from commit a6bf4fd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants