-
Notifications
You must be signed in to change notification settings - Fork 13
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
narinfo: more validation + underlying data structures #12
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Instead of returning strings, which need to be parsed again, return a struct containing the key name and digest. This also takes care of nixbase64 decoding/encoding.
zimbatm
reviewed
Apr 12, 2021
zimbatm
reviewed
Apr 12, 2021
zimbatm
reviewed
Apr 12, 2021
zimbatm
reviewed
Apr 12, 2021
zimbatm
reviewed
Apr 12, 2021
zimbatm
approved these changes
Apr 12, 2021
This adds a Hash struct, holding HashType and Digest []byte, and provides functions to parse from and output a "nix-style" hash string. Co-Authored-By: edef <edef@edef.eu>
This just being called test.go won't execute the test - which is why this error wasn't spotted.
This provides some more sanity checking, and ensures hashes are in an easy-to consume format.
This adds functions to parse and render nix paths. Co-Authored-By: edef <edef@edef.eu>
This provides some more sanity checking on parsed .narinfo files, ensuring the paths in StorePath, References and Deriver are syntactically valid when no compression is present, ensuring File{Hash,Size} and Nar{Hash,Size} are equal This is also added to the narinfo unit test, ensuring our example narfile passes the validation.
nameRe isn't really used anywhere else currently, so this can be skipped.
flokli
force-pushed
the
narinfo-validation
branch
from
April 12, 2021 17:53
535ef0b
to
60aed15
Compare
Thanks for the review! I addressed all the remarks. |
zimbatm
approved these changes
Apr 12, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This teaches go-nix how to parse signature lines and checksums, and provides the parsed version them it in the NarInfo.
For this to work, the
hash.Hash
andnar.narinfo.Signature
structs, surrounding functions and corresponding tests were introduced.There's also a
path
package now, which provides some basic sanity-checking for store paths.Together with the nar.narinfo.NarInfo.Validate()
function, this provides some pretty good coverage in checking for invalid
.narinfo` files.