Skip to content
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

Archives checksums are not checked along with their corresponding urls #3504

Closed
kit-ty-kate opened this issue Aug 10, 2018 · 4 comments
Closed

Comments

@kit-ty-kate
Copy link
Member

Let's say you have a package A with the following url section:

src: "https://github.com/<name1>/<project1>/archive/0.1.tar.gz"
checksum: "md5=a18d39762a27e18ff4548978536b8477"

and a package B with the following url section:

src: "https://github.com/<name2>/<project2>/archive/0.1.tar.gz"
checksum: "md5=a18d39762a27e18ff4548978536b8477"

If the archive of A is already present in the archive cache then if you try to install package B the archive from package A will be extracted instead and the build might fail (or worst: succeed and then install the wrong thing).

Tested with opam 2.0.0/rc4/final

@hannesm
Copy link
Member

hannesm commented Aug 13, 2018

I don't fully understand - in your example the two checksums are equal, and that means that both archives should be equal as well!?

@kit-ty-kate
Copy link
Member Author

no the two archives have distinct contents. One does really have the right checksum and the other does not and that's the problem

@rjbou
Copy link
Collaborator

rjbou commented Feb 20, 2019

As opam cache archives using the checksum, when package B is installed, archive is found in cache. One way to validate the archive checksum is to do not use caching. Even with that, by default, opam2 downloads package from opam.ocaml.org using their hashes.
This checksum validation should be done prior to repository acceptance.

@rjbou
Copy link
Collaborator

rjbou commented Jun 13, 2019

Option --check-upstream and lint 60 added in #3758 (returns error if the archive is reachable && don't validate the checksum).
Closing this issue, feel free to open it if needed.
Thanks for the report!

@rjbou rjbou closed this as completed Jun 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants