-
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
x/mod/zip: verify file list without creating zip #36058
Comments
Incompatible changes would be fine too, I think: the latest tagged version of that repo is still |
This pre-receive git hook validates commits pushed to master branches to catch problems that would cause bad module versions to be produced. The golang.org/x/mod/zip package is used to verify that the module zip includes only the expected files and no others, and doesn't violate any of the restrictions placed on Go module zips. Improve consistency of parameter order across the codebase. Prefer to place module.Version first, source of data (repository and commit ID) second, because module version is higher level information. Use canonical "Www-Authenticate" header case to save an allocation. Fixes #35. Updates golang/go#36058.
Issue #37397 is related. It's worth considering that depending on the exact goal of a user, they may want to reproduce that vendor bug in order to ensure consistent behavior with A good high-level way of asking that question is whether the user goal is to stay within the rules of the module proxy protocol, or additionally within the |
That's a good way to phrase it. Perhaps
|
Change https://golang.org/cl/235597 mentions this issue: |
golang.org/x/mod/zip
provides aCreate
function that takes a list of files ([]File
). On success, it creates a zip file with some of those files. It ignores files in submodules and vendor directories and reports errors for files with invalid names or types (symbolic links). On failure, it reports an error on the first file that caused a problem.This is not the most useful API for clients creating zip files or verifying that a set of files can be used to create a zip file. Some improvements are possible without making incompatible changes to the API:
Verify
function that accepts[]File
and reports whether each file in that list will be included, ignored, or rejected.Verify
would not create a zip file, and it would not read files (just stat to get sizes and types), so it should be faster thanCreate
.Create
encounters an error due to the[]File
argument, it should return a structured error with information about each file. This should be similar to whatVerify
returns (perhaps whateverVerify
returns can satisfy theerror
interface).Unzip
should also return a structured error so that issues with multiple zip entries can be reported.VerifyZip
function which checks a zip file for errors without extracting it. Currently,Unzip
always needs a directory to write files.cc @dmitshur
The text was updated successfully, but these errors were encountered: