ruby-install icon indicating copy to clipboard operation
ruby-install copied to clipboard

Recommended improvement to the checksum verification output for clarity and simplified UX.

Open todd-a-jacobs opened this issue 11 years ago • 3 comments

When passing a hash for validation as follows:

ruby-install ruby 2.2.1 --sha512 af6a8e75a66b953ff33ecbca5111bcf1c6560b6b48b370b700820fcbe91363146c5ac8abd670a14e693b44343ae598bab472ed2902834304c03ffcd9550886d1

the UI confuses the user by saying what checksums were not validated, and doesn't give any explicit response to the validation. For example, the above yields:

>>> Verifying ruby-2.2.1.tar.bz2 ...
*** No md5 checksum for /Users/foo/src/ruby-2.2.1.tar.bz2
*** No sha1 checksum for /Users/foo/src/ruby-2.2.1.tar.bz2
*** No sha256 checksum for /Users/foo/src/ruby-2.2.1.tar.bz2
>>> Extracting ruby-2.2.1.tar.bz2 to /Users/foo/src/ruby-2.2.1 ...
>>> Configuring ruby 2.2.1 ...

Presumably the checksum was verified, but the output doesn't really say so. It's also extremely confusing that it says nothing about the SHA-512 hash at all; it doesn't acknowledge receiving it (except by omission) and doesn't say whether or not it passed the validation step.

Expected behavior would be something more along the lines of:

>>> Verifying ruby-2.2.1.tar.bz2 with SHA-512 checksum ...
>>> Valid checksum for ruby-2.2.1.tar.bz2 ...
>>> Extracting ruby-2.2.1.tar.bz2 to /Users/foo/src/ruby-2.2.1 ...

I think this would make it clearer what it going on, resulting in a better user experience. If the less relevant messages about what checksums aren't provided are valuable, perhaps a a verbose flag or other debugging process would be the right place to log that information.

Please consider the merits of improving the clarity of the checksum validation process. I think it would result in a cleaner, more effective communication with the user.

todd-a-jacobs avatar Mar 07 '15 07:03 todd-a-jacobs

Now that we keep an exhaustive list of checksums, I don't think this is such an annoyance anymore? Perhaps we should change the logic to fail if no checksums can be found?

postmodern avatar Dec 28 '15 00:12 postmodern

@postmodern I think from a UX perspective I expect a message saying something like "Verified by SHA-512" (or whatever) in the output to show that it has been verified, and then fail if no checksums are found or provided unless someone has used some kind of force flag.

My thinking is that:

  1. Verification should be an explicit user-visible action, rather than something implicit in the process.
  2. Only the strongest checksum needs to be used, rather than all of them, unless overriden. I haven't looked at the code, but assume this is what is going on now.
  3. There may be a valid use case for allowing users to install without checksums (e.g. from a known-good tarball or when shasum or similar is unavailable), so a force flag seems like good UX even though it's bad security. "Fail closed" is certainly the more secure default, but I generally prefer not to prevent power users from shooting themselves in the foot if they're doing so intentionally.

Finally, I'm not sure how up-to-date the checksums are. For example, if I'm installing Ruby 2.3.0 the day it's released, and the checksums for ruby-install haven't been updated yet, I still have to specify the checksum on the command line. Hence, I still think this remains a valid bug, although the new checksum process is likely to mitigate the issue for everyone except early adopters of a new Ruby version.

Thoughts?

todd-a-jacobs avatar Jan 06 '16 10:01 todd-a-jacobs

Going to close this because there's a lot of confusion here.

  • New ruby versions and checksums are added to ruby-versions, usually within 0-2 days after a new ruby version has been released.
  • Downloaded releases are always verified by default against the checksums from ruby-versions.
  • There's already a --no-verify option for optionally disabling checksum verification.
  • If you'd like a better error message (ex: "No checksums found for ..."), feel free to submit a PR.

postmodern avatar Feb 01 '25 22:02 postmodern