You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Perform MD5 checks for fetched datasets where possible #8089
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.
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
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.
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)
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.
@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.
Activity
souravsingh commentedon Dec 20, 2016
I am interested in working on the issue. How do I start?
nelson-liu commentedon Dec 20, 2016
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
jnothman commentedon Dec 20, 2016
I assume @nelson-liu already has a fix, @souravsingh, so I'll take away Need Contributor.
jnothman commentedon Dec 20, 2016
Thanks for the offer, @souravsingh
nelson-liu commentedon Dec 20, 2016
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.
jnothman commentedon Dec 20, 2016
toastedcornflakes commentedon Dec 20, 2016
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
nelson-liu commentedon Dec 20, 2016
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)
toastedcornflakes commentedon Dec 20, 2016
Yes, after some time (usually a reboot) if you use something like TemporaryFile.
nelson-liu commentedon Dec 21, 2016
Hmm but are you using TemporaryFile in #6112? Seems like an interesting solution to explore to increase download robustness, though.
toastedcornflakes commentedon Dec 21, 2016
I did not use it because it seemed like a hassle to pass a file descriptor to☹️
urllib.urlretrieveBut 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.
nelson-liu commentedon Dec 22, 2016
@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.