-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
proposal: cmd/go: add go mod verify -tag #68669
Comments
Related Issues and Documentation
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.) |
CC @matloob |
isn't this just |
I'm pretty excited about this, so far we don't have a good story for how the author-to-sumdb link is secured, but it's a very small gap to fill thanks to the sumdb design. It also gives a canonically good answer to "how do I review a dependency knowing it's what will be used by my application" that doesn't involve vendoring or digging into the modcache.
Almost! That downloads the module from e.g. GitHub where it might have been tampered with. This checks the local copy as it was developed / is being reviewed. It's kind of like a hypothetical |
Change https://go.dev/cl/596097 mentions this issue: |
Do we want |
cc @ianthehat Do you have a perspective on this? |
I think that the functionality is a really good idea, and we should have it. The ability to verify that the code you intended to make up a release flows through your code hosting site, into the module proxy and back down to you without modification is an important property to be able to check, and doing so is currently far too hard. I am not totally convinced that |
This proposal has been added to the active column of the proposals project |
Just for my own understanding, can someone (@ianthehat or @Esra-Al ?) explain how this would be used? It sounds like this would slot into a release process, but I'm not really sure where. Does this have to be something that's opt-in, or is there any way we can make it more automatic? What are the potential consequences of a user not doing this verification? |
We probably want @FiloSottile to chime in here. |
Yeah, my understanding basically meshes with what @ianthehat posted - it can be incorporated into the release process and run to verify each new version shortly post-release. Note that there's another use case for manual invocation here - if someone is doing a security audit of version x.y.z of a package, they can use this tool to verify that the version of the code they've checked out for inspection is the canonical x.y.z according to the go module mirror/checksum DB, rather than whatever is tagged as x.y.z in GitHub or wherever at the moment. As far as further automation, the options I've come up with are well outside of this scope:
|
Thanks. This seems well-motivated from a security perspective, but I think it's less clear what the exact user interface to this should be. This dovetails with the question of exactly when someone/something would run this verification command. Pinging @matloob |
@ianthehat I'm interested to hear (read?) why you think @Esra-Al I think if we do use It seems like the alternatives to |
Ping @ianthehat for @matloob 's question above. |
I am not convinced it is the right place because it has very little to do with mod files, and nothing to do with verifying a modules dependencies (which is what |
The most common flow would be simply
which ensures the code made it through the code hosting and Google's service, into the checksum database, unmodified.
If it's a string flag, how can it not take an argument?
I don't have a strong argument in favor of How do we move this forward? |
I agree with @ianthehat 's point that this seems almost entirely unrelated to the current behavior of My sense is that this should be a new subcommand, like (Tongue-in-cheek alternative: make |
One possibility would be to add a |
what about go mod sum . # calculates sum for local module
go mod sum my.module@version # queries sum from sumdb and leave the comparison up to the user? I couldn't quite place my finger on why the proposed API felt off, but I think it's the local interaction with vcs and the name "tag" when verification should work over any version. bonus API since go needs to do it to calculate sums:
produce the module zip file, useful if you need to upload it to some more limited module host |
If this needs to support commit hashes too, perhaps “version” should be used instead of “tag“. |
It seems like we still need to reach consensus on the actual command. |
This still seems to be the case. |
Given the recent boltdb-go problem, it would be useful to have a way to verify that versions in the repo also match go.sum and the sum database. |
Proposal Details
Go lacks a CLI to verify local repositories against the Go checksum database. Adding a flag in go mod verify to check local git tags against the sumdb would help module authors ensure their contents haven't been tampered with. This could prevent issues from unauthorized changes by someone with force-push access to GitHub, GitHub itself, or even Google.
I propose adding a -tag flag accepting the following values
all: Check all local git tags against the sumdb.
latest: Check only the latest local git tag
[version]: Check a specific version (e.g., go mod verify -tag=v1.0.0).
-tag=latest is especially useful as the first command to run after pushing a new tag, as it will have the side-effect of loading it in the sumdb while checking it matches the local repository.
The text was updated successfully, but these errors were encountered: