pingcap / pingcap/tiup

Upgrade dependency "github.com/prometheus/prom2json"

Open
#2,114 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
466
Forks
338
Avg merge
3d 7h
Merged PRs (30d)
8

Description

Background

Repo github.com/pingcap/tiup depends on github.com/prometheus/prom2json@v1.3.1.

https://github.com/pingcap/tiup/blob/master/go.mod#L43

However, comparing version v1.3.1 of github.com/prometheus/prom2json from proxy.golang.org and github, there are inconsistencies.

commit time of the copy on github.com

"committer": {
      "name": "beorn7",
      "email": "beorn@grafana.com",
      "date": "2022-04-19T20:18:52Z"
    }

commit time of the copy on proxy.golang.org

{"Version":"v1.3.1","Time":"2022-04-19T16:24:19Z"}

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

go: downloading github.com/prometheus/prom2json v1.3.1
go: github.com/prometheus/prom2json@v1.3.1: verifying module: checksum mismatch
        downloaded: h1:7+kNt7FSQFjppCuTlgg4/QVMIo6vS4oqByCvb4ePuXc=
        sum.golang.org: h1:OogL5hsrJpLPz3jZ4LPz4sJRTtADzViCNRQoqrzUQvk=

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/prometheus/prom2json.

Solution

1. Bump the version of dependency github.com/prometheus/prom2json

I would recommend bumping the version of github.com/prometheus/prom2json to a new release to ensure dependency copy in proxy.golang.org and github in sync.

References

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the dependency entry in go.mod at the referenced line and inspect the current go.sum entries for github.com/prometheus/prom2json. Update the dependency to a release whose GitHub and proxy copies are consistent, then verify that downloads do not produce a checksum mismatch and that the project still builds.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.