Verifying libsodium with minisign instead of sha2 #329
Conversation
|
Looks good. How does it affect total number of deps in dependency tree? See ‘cargo tree’ |
|
The relevant part of the dependency tree looks like this: Notice that the sha2 package is still in there even though we're not depending on it directly. On the master branch, I count 47 unique dependencies total. On the minisign branch, 64. |
|
That’s a shame we need so many deps to verify hashes :( |
|
The ironic part is that minisign would be easy to implement without further dependencies if we had access to libsodium :) |
|
These are just build dependencies, and are required by |
https://github.com/tox-rs/tox-node already got 195 deps and roughly half of them are ssl, http, tar and sha2 to download and verify libsodium. I thought it did not matter until I tried to compile tox-node under AWS micro and it took 12 minutes. I believe we don't have an option, so it's a yes from me. A sad yes. |
|
Keep in mind that this resolves the build failure, but the root cause that we're using mutable data in our build makes the build nondeterministic from a reproducible builds point of view. To guarantee independent verification of the binary we would need to track which rebuild of the library release was used during our build or make sure all inputs of the build are immutable (eg. by building libsodium from immutable source releases). More on that topic can be found here: https://reproducible-builds.org/ |
|
Also note that this allows a subtle way for the owner of the minisign private key to carry out very targeted attacks by serving a malicious pre-built library with a valid signature. Since there's no binary transparency you can't be sure you are getting the same library everybody else is getting unless we're pinning the file content by hash. |
|
Version |
That is so true. |
|
That is a really good point about reproducible builds. Especially when considering what kind of downstream projects could be using this library, reproducible builds would be a good feature to provide. I wonder if it would be worthwhile maintaining our own libsodium repo by forking it, and using the GitHub Releases feature to host libsodium releases in an immutable way (i.e. And to be clear, I'm not suggesting forking the project. Just forking the repository and keeping it in sync with the original. |
|
Closed in favor of #332 |
This would resolve 326, and makes it so we don't have to keep updating hard-coded SHA hashes all the time. The build seems to run fine on Windows and Ubuntu.
Sorry if anything is out of order - I'm a bit new to Rust, not to mention contributing to open source projects in general.