Skip to content

Perform MD5 checks for fetched datasets where possible #8089

Closed

Description

@jnothman

I think we should record expected MD5 sums for fetched files in datasets. This way we can give appropriate error messages when a fetch was incomplete, avoiding issues like #8080.

Activity

  1. added
    Moderate
    on Dec 20, 2016
  2. souravsingh commented on Dec 20, 2016

    @souravsingh
    Contributor

    I am interested in working on the issue. How do I start?

  3. nelson-liu commented on Dec 20, 2016

    @nelson-liu
    Contributor

    Oops, just realized I never got around to pushing my work at #7429 (might be a few days until I can do so, only have my phone with me for the next few days). That PR also needs an additional look, I think

  4. jnothman commented on Dec 20, 2016

    @jnothman
    MemberAuthor

    I assume @nelson-liu already has a fix, @souravsingh, so I'll take away Need Contributor.

  5. jnothman commented on Dec 20, 2016

    @jnothman
    MemberAuthor

    Thanks for the offer, @souravsingh

  6. nelson-liu commented on Dec 20, 2016

    @nelson-liu
    Contributor

    on a related note, how does using sha-1 instead of md5 sound? I know we aren't using it for any cryptographic purposes, but it would be good to also have this in place to guarantee that we're downloading a trusted file.

  7. jnothman commented on Dec 20, 2016

    @jnothman
    MemberAuthor
  8. toastedcornflakes commented on Dec 20, 2016

    @toastedcornflakes
    Contributor

    FWIW, in #6112, instead of using checksums, I downloaded the archive to a temporary directory, then moved it to the right place. This allows for

    • automatic clean-up, handled by the OS
    • more flexibility: the actual file can change server-side (which can be good or bad depending on what you value)
  9. nelson-liu commented on Dec 20, 2016

    @nelson-liu
    Contributor

    I think I'd prefer for the file to not change server side silently -- that seems like a security vulnerability.
    By first downloading it to a temp file, if the download is interrupted is the temp file automatically deleted (sorry if this has an obvious answer)

  10. toastedcornflakes commented on Dec 20, 2016

    @toastedcornflakes
    Contributor

    By first downloading it to a temp file, if the download is interrupted is the temp file automatically deleted (sorry if this has an obvious answer)

    Yes, after some time (usually a reboot) if you use something like TemporaryFile.

  11. nelson-liu commented on Dec 21, 2016

    @nelson-liu
    Contributor

    Hmm but are you using TemporaryFile in #6112? Seems like an interesting solution to explore to increase download robustness, though.

  12. toastedcornflakes commented on Dec 21, 2016

    @toastedcornflakes
    Contributor

    I did not use it because it seemed like a hassle to pass a file descriptor to urllib.urlretrieve ☹️

    But if we are writing a download function used by all datasets that checks the hash, we might as well use a correct scheme and download to a temporary file.

  13. nelson-liu commented on Dec 22, 2016

    @nelson-liu
    Contributor

    @toastedcornflakes i ended up keeping the temp files around (so not using TemporaryFile, since those are deleted when the file handler is closed) and implementing resume-able downloads from the temp files. If the temp file is fully downloaded, it's moved to the proper path. Else if the file was not fully downloaded, the temp file will remain and you can pick up right where progress was left off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementModerate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions